[Fontconfig] Tutorial or guidance for using fontconfig

Behdad Esfahbod behdad at behdad.org
Thu Jan 8 13:48:44 PST 2009


Jesper L. Nielsen wrote:

> I do have a various number of fonts for different languages and other
> things, so the first performance hit is when fontconfig builds it's
> cache on startup, if there is a way to disable this, I haven't found it.

Sure, building caches is slow.  The first question is why is it building the
cache on each startup.

> I have been running sysprof and the majority of time spend while
> rendering fonts seems to be in fontconfig.
> 
> I don't know how to dump Sysprof output to text, so I've attached a
> screendump.

The screenshot shows nothing really.  The fontconfig functions you are showing
in the shot are taking only 3% of the total time.

>>> At the
>>> moment I'm looking at taking out Fontconfig from Pango, but
>>> unfortunately their are tightly bound together in the Pango sourcecode.
>>
>> That makes little sense.
> 
> I've been looking at the Pango 1.22 code, and seperating the *ft2*.c
> files from the *fc*.c files is difficult becuase the ft2 files contain
> direct references for structures within FontConfig.
> 
> A quick grep:
> 
> $ grep Fc pangoft2.c | wc -l
> 43
> 
> So what I mean is that there a references to FcPattern, PangoFcFont and
> other things defined in the Fontconfig specific source files. So taking
> out just the Fontconfig part for the pangoft2.c would require some work.

pantoft2 subclasses pangofc.  So, you are pretty much talking about writing a
new pango backend.  And then, the pango shapers also depend on pangofc.  So
you have to modify those too.  Really, your fighting the wrong battle.  Just
focus on getting fontconfig working for you.


behdad


More information about the Fontconfig mailing list