[poppler] Fontconfig patch

Albert Astals Cid aacid at kde.org
Sat Jul 16 06:33:27 EST 2005


Ok guys, this patch is both somewhat big and important so have a careful look 
at it.

Rationale of the patch, it has been discussed in the list that using hardcoded 
fonts as xpdf does is a bad thing. This patches tries to address that 
problems.

Quick review of the patch:
 - All font substitutions have been removed as fontconfig always gives the 
best font it can.
 - getDisplayCIDFont and getDisplayFont have been merged has there's no point 
to have them separated.
 - All the code in GlobalParams to parse the font parts of xpdfrc has been 
removed or commented
 - getDisplayFont now accepts a GfxFont so we can access all the meaningfull 
data (and not only the name) we need to do the proper fontconfig call.
 
The core logic is inside buildFcPattern that creates a FcPattern getDispayFont 
uses to ask FontConfig for the font.

The pattern we build has that fields 
 - FC_FAMILY: If the font descriptor provides a family name we use it, if not 
we try to get a meaningful family name from the font name.

 - FC_SLANT: Slant is extracted either from the font name or from the font 
flags the pdf has.

 - FC_WEIGHT: If the font descriptor provides a weight we use it, if not we 
use the font flags and finally the name of the font.

 - FC_WIDTH: If the font descriptor provides one we use it, if not try to 
extract one from the font name.

 - FC_SPACING: If the font flags says the font is monospaced we set the flag 
to it.

 - FC_LANG: The default lang is "xx", that is no specific language. If the 
font is a CID font and has a collection, we ask for a font that supports the 
given language, so if that exact font is not in the system, we can still end 
with a font that supports that language if present on the system.

Of course comments are welcome as always.

If nobody has comments or oposes i'll trigger a "silence as aproval" commit in 
7 days.

Albert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontconfig.patch
Type: text/x-diff
Size: 33739 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20050715/cf87a7d5/fontconfig-0001.bin


More information about the poppler mailing list