[Fontconfig] Question about FcFontSetSort code
Jay.Hobson at Sun.COM
Wed Jan 11 13:49:33 PST 2006
I'm looking at the FcFontSetSort code in fcmatch.c, line 893
if (nodeps[f]->score[MATCH_LANG_INDEX] < nPatternLang)
Isn't this an apples to oranges comparison?
nodeps[f]->score[MATCH_LANG_INDEX] is either
0 for exact match
100 for language match, but possible region mismatch
200 for no match.
nPatternLang is just the number of languages requested
The reason I'm asking is that on Solaris, locales are
presented as ja_JP, en_US, etc. The fonts use ja, and
en in this case, causing language matches to be scored
100 at best. By having 100 in the score value for
language, I end up with no matches and all scores are
reset to 1000 before the next quick sort.
My basic question is: Is the line 893 correct?
I'm looking at adding an extra line to the if statement above
to fix this.
int allow_close_match = FcFalse;
* For Solaris, because of ja_JP, en_US, and such locales, exact matches
* with font language support is sporatic. Check to see if we allow
* matches to count as the same as exact matches.
FcPatternGetBool ( p, "allow_close_match", 0, &allow_close_match );
if (nodeps[f]->score[MATCH_LANG_INDEX] < nPatternLang ||
( nodeps[f]->score[MATCH_LANG_INDEX] == 100 && allow_close_match ))
or would it be OK to simplify this to:
if (nodeps[f]->score[MATCH_LANG_INDEX] <= 100)
Thanks in advance for any feedback,
More information about the Fontconfig