[cairo] Re: Patch to improve the rule for artificial emboldening

sunmoon1997 sunmoon1997 at gmail.com
Mon Oct 24 07:16:58 PDT 2005


bump for this thread:)
sunmoon1997 wrote:
> hi,
>   I vote for adding embeddedbitmap option to official fontconfig.
>   Several distros have shiped patched version of fontconfig which adds
> an option like rh_prefer_bitmap or embeddedbitmap. Because we need a way
> to explictly tell Xft/Cairo to load bitmaps embedded in fonts or not.
> And for cairo, if i want to cairo transform a font to pretend as an
> oblique one, and when i disable antialias for the font, then cairo will
> always load embedded bitmaps if available, latter cairo(exactly to say
> it's freetype) will be unable to transform the font glyphs because they
> are bitmaps. If option embeddedbitmap is available, we can tell freetype
> to load outlines rather than embedded bitmaps by set embeddedbitmap to
> false and then can transform font glyphs as expected. Xft is smart
> enough in this case, it add FC_LOAD_NO_BITMAP to load flags when loading
> glyphs. But that is not easily to implement in cairo, because cairo
> doesn't handle FC_MATRIX itself.
> Mike FABIAN wrote:
> 
>>For details please see
>>
>>http://bugzilla.novell.com/show_bug.cgi?id=118727
>>
>>This patch makes two small changes to the rule for artificial
>>emboldening in /etc/fonts/fonts.conf:
>>
>>1)
>>    don't check for "weight >= 200" but for "weight > 100",
>>    i.e. instead of 
>>
>>                <!-- check to see if the pattern requests bold -->
>>                <test target="pattern" name="weight" compare="more_eq">
>>                        <int>200</int>
>>                </test>
>>
>>    use
>>
>>                <!-- check to see if the pattern requests bold -->
>>                <test target="pattern" name="weight" compare="more">
>>                        <int>100</int>
>>                </test>
>>
>>    This is necessary to make <strong>foo</strong> appear bold
>>    in firefox. When checking "weight >= 200", emboldening will work for
>>
>>        <span style="font-weight:bold;">foo</span>
>>
>>    in firefox but not for <strong>foo</strong>
>>
>>    (To make it a better readable I used "<const>medium</const>"
>>    instead of "<int>100</int>". This makes no functional difference
>>    it only enhances the readability).
>>
>>2)
>>    in addition to setting "embolden" to "true", also set
>>    "weight" to "bold", i.e. add:
>>
>>		<!--
>>		 set weight to bold
>>		 needed for applications using Xft directly, e.g. Firefox, ...
>>		-->
>>		<edit name="weight" mode="assign">
>>			<const>bold</const>
>>		</edit>
>>
>>    to the rule. This is necessary to make artificial emboldening
>>    work in applications who do no (yet) use cairo but use
>>    Xft directly[1]
>>
>>Footnotes: 
>>[1]  to make this work Xft needs to have the patch for embedded bitmap
>>support and artificial emboldening applied which I attach here as well
>>for reference.
>>
>>
>>


More information about the cairo mailing list