[Fontconfig] Re: Bug with fc-match

Mike FABIAN mfabian at suse.de
Fri Feb 10 14:59:35 PST 2006


Takashi Iwai <tiwai at suse.de> さんは書きました:

> At Fri, 10 Feb 2006 11:58:33 -0500,
> Patrick Lam wrote:
>> 
>> Ok, here's what I've discovered so far:
>> 
>> * scalable=true isn't recognized by fc-match as a matching criterion.
>> (_FcMatchers in fcmatch.c:187 is the list of matchers)
>> 
>> * FcDefaultSubstitute adds a bunch of criteria to the pattern which
>> cause the outline version to be rejected.
>> 
>> * The criterion which causes the outline version to be rejected is
>> FC_PIXEL_SIZE.  FcDefaultSubstitute notes that we don't specify a
>> pixelsize, so it computes one.  (fcdefault.c lines 131-1515).
>> Furthermore, FC_PIXEL_SIZE gets put before FC_OUTLINE, so that it
>> eliminates the outline version before FC_OUTLINE can work.
>> 
>> * Since the outline font doesn't have an FC_PIXEL_SIZE element, then it
>> doesn't get the v = v * 100 + v1_offset, which causes it to have a lower
>> score than the bitmap fonts, which is why it gets rejected.
>> 
>> * The pattern elements are sorted to enable binary search on pattern
>> elements, which is why pixelsize comes before outline.  In fact, the
>> matching pattern never has FcPatternGet called on it (it's only accessed
>> sequentially), so we don't quite need to sort elements there, but that
>> seems to enable a whole bunch of unsortedness bugs to come up.
>> 
>> I don't know what the correct solution to this problem is, but that's
>> what happening.  Perhaps we shouldn't sort patterns used for matching.
>
> Stop blocking the fonts which have no corresponding elements.
> The patch below should fix this problem.
>
> Takashi
>
> --- src/fcmatch.c-dist	2006-02-10 14:42:51.000000000 +0100
> +++ src/fcmatch.c	2006-02-10 17:55:00.000000000 +0100
> @@ -673,6 +673,10 @@ FcFontSetMatch (FcConfig    *config,
>  			}
>  		    }
>  
> +		    /* We had no matching, just try the next one */
> +		    if (score == 1e99)
> +			continue;
> +
>  		    /* If there's a previous champion, and current score
>  		     * beats previous best score, on this element, then
>  		     * knock out the previous champion and anything

This patch alone was not enough.

It fixed the problem on Takashi's machine, but not on my machine. Probably
the reason was that the order of fonts in the cache files on Takashi's
machine and my machine was different, i.e. it just accidentally
"fixed" the problem on Takashi's machine.

Takashi made a better patch, which is slightly more complicated.

It is attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fc-fcmatch-pattern-fix.diff
Type: text/x-patch
Size: 2027 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060210/d22f842f/fc-fcmatch-pattern-fix.bin
-------------- next part --------------

-- 
Mike FABIAN   <mfabian at suse.de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。


More information about the Fontconfig mailing list