Commit b0a5b4b4 authored by Florent Rougon's avatar Florent Rougon Committed by Akira TAGOH

FcLangSetCompare(): fix bug when two charsets come from different "buckets"

In fcLangCountrySets, it may happen that two charsets for the same
language but different territories are found in different FcChar32
"buckets" (different "columns" on the same line). This is currently the
case for the following pairs:

  mn-cn  and mn-mn
  pap-an and pap-aw

The FcLangSetCompare() code so far used to return FcLangDifferentLang
instead of FcLangDifferentTerritory when comparing:

  an FcLangSet containing only mn-cn with one containing only mn-mn


  an FcLangSet containing only pap-an with one containing only pap-aw

This commit fixes this problem.
parent 209619b1
......@@ -680,6 +680,7 @@ FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb)
int i, j, count;
FcLangResult best, r;
FcChar32 aInCountrySet, bInCountrySet;
count = FC_MIN (lsa->map_size, lsb->map_size);
count = FC_MIN (NUM_LANG_SET_MAP, count);
......@@ -688,13 +689,22 @@ FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb)
return FcLangEqual;
best = FcLangDifferentLang;
for (j = 0; j < NUM_COUNTRY_SET; j++)
aInCountrySet = 0;
bInCountrySet = 0;
for (i = 0; i < count; i++)
if ((lsa->map[i] & fcLangCountrySets[j][i]) &&
(lsb->map[i] & fcLangCountrySets[j][i]))
aInCountrySet |= lsa->map[i] & fcLangCountrySets[j][i];
bInCountrySet |= lsb->map[i] & fcLangCountrySets[j][i];
if (aInCountrySet && bInCountrySet)
best = FcLangDifferentTerritory;
if (lsa->extra)
r = FcLangSetCompareStrSet (lsb, lsa->extra);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment