[Fontconfig] Missing FcValueSave() in FcConfigEvaluate() (KDE bug #119108)

Lubos Lunak l.lunak at suse.cz
Tue Jan 3 05:29:14 PST 2006

On Tuesday 03 January 2006 00:44, Behdad Esfahbod wrote:
> On Mon, 2 Jan 2006, Lubos Lunak wrote:
> >  Hello,
> >
> >  please review the attached patch. It should fix a fontconfig crash
> > triggered by a Qt patch that should improve font loading performance
> > (FcFontSort->FcFontMatch, but that should be actually irrelevant). A
> > Valgrind log for the crash is attached, it's a double free.
> I'm curious about the original patch, since fontconfig
> (FcFontSort) is taking around 30% of time in Firefox, and quite a
> lot in other scenarios too...

 The patch is at 
http://websvn.kde.org/*checkout*/branches/qt/3.3/qt-copy/patches/0066-fcsort2fcmatch.patch . 
Because of whitespace changes it looks more complicated than it really is, as 
it is just trying FcFontMatch() before going the noticeably more expensive 
FcFontSort() way.

 Basically, in that function Qt creates FcPattern that describes the font it 
wants, then does FcFontSort() and starts checking the results until it finds 
one that fully satisfies its additional requirements (as I'm not fonts expert 
I have actually no clue what that code really does). And since I noticed that 
with a reasonable fonts installation the very first match is already enough, 
it should be sufficient to just get that very first match using FcFontMatch() 
instead of finding all suitable fonts with the more expensive FcFontSort(), 
which should be only used as a fallback.

 I'm not sure if the same could be done in Firefox though - this is Qt3 and in 
Qt4 it won't be possible to do this, as Qt4 seems to try to combine more 
fonts into one when just one doesn't provide all the required characters. 
There FcFontSort() will be still needed :-/. I'm not yet sure what to do with 

Lubos Lunak
KDE developer
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/

More information about the Fontconfig mailing list