Question about FcFontSetSort code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm looking at the FcFontSetSort code in fcmatch.c, line 893
in 2.3.93:

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
for coverage.

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 close
    * 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,

Jay
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux