[Fontconfig] Forcing Artificial Italics on Fonts That *DO* Have One Available?

Keith Packard keithp at keithp.com
Mon Aug 4 23:27:23 PDT 2008


On Mon, 2008-08-04 at 20:06 -0500, Erik wrote:

> Does anybody have an idea on how to force it to first select the regular 
> font, then apply artificial slanting to it?

Not to condone this kind of typographical abuse, but it seemed an
interesting problem. The key is to switch to a roman font for the match,
but then patch up the returned roman font to perform the artificial
oblique effect. I think fontconfig provides too much flexibility some
days.

<match target="pattern">

        <!-- match requests for non-roman face -->
        <test name="slant" compare="not_eq">
                <const>roman</const>
        </test>

        <!-- remember that this should be slanted -->
        <edit name="fake_slant">
                <bool>true</bool>
        </edit>

        <!--- change to match a roman face instead -->
        <edit name="slant">
                <const>roman</const>
        </edit>
</match>

<match target="font">

        <!-- check to see if the font is roman -->
        <test name="slant">
                <const>roman</const>
        </test>

        <!-- look for fonts which were marked for fake obliquing -->
        <test name="fake_slant">
                 <bool>true</bool>
        </test>

        <!-- multiply the matrix to slant the font -->
        <edit name="matrix" mode="assign">
                <times>
                        <name>matrix</name>
                                <matrix><double>1</double><double>0.2</double>
                                        <double>0</double><double>1</double>
                                </matrix>
                </times>
        </edit>

        <!-- mark the font as oblique now -->
        <edit name="slant">
                <const>oblique</const>
        </edit>
</match>

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080804/8ae75874/attachment.pgp 


More information about the Fontconfig mailing list