Commit d354a321 authored by Behdad Esfahbod's avatar Behdad Esfahbod

Bug 23419 - "contains" expression seems not working on the fontconfig rule

Fix bug in FcLangSetContains(), similar to
5c6d1ff2
parent f33a2313
...@@ -370,6 +370,7 @@ main (int argc, char **argv) ...@@ -370,6 +370,7 @@ main (int argc, char **argv)
printf ("#define LEAF(o,l) (LEAF0 + l * sizeof (FcCharLeaf) - (OFF0 + o * sizeof (intptr_t)))\n"); printf ("#define LEAF(o,l) (LEAF0 + l * sizeof (FcCharLeaf) - (OFF0 + o * sizeof (intptr_t)))\n");
printf ("#define fcLangCharSets (fcLangData.langCharSets)\n"); printf ("#define fcLangCharSets (fcLangData.langCharSets)\n");
printf ("#define fcLangCharSetIndices (fcLangData.langIndices)\n"); printf ("#define fcLangCharSetIndices (fcLangData.langIndices)\n");
printf ("#define fcLangCharSetIndicesInv (fcLangData.langIndicesInv)\n");
printf ("\n"); printf ("\n");
printf ("static const struct {\n" printf ("static const struct {\n"
...@@ -378,9 +379,10 @@ main (int argc, char **argv) ...@@ -378,9 +379,10 @@ main (int argc, char **argv)
" intptr_t leaf_offsets[%d];\n" " intptr_t leaf_offsets[%d];\n"
" FcChar16 numbers[%d];\n" " FcChar16 numbers[%d];\n"
" FcChar%s langIndices[%d];\n" " FcChar%s langIndices[%d];\n"
" FcChar%s langIndicesInv[%d];\n"
"} fcLangData = {\n", "} fcLangData = {\n",
nsets, tl, tn, tn, nsets, tl, tn, tn,
nsets < 256 ? "8 " : "16", nsets); nsets < 256 ? "8 " : "16", nsets, nsets < 256 ? "8 " : "16", nsets);
/* /*
* Dump sets * Dump sets
...@@ -469,15 +471,27 @@ main (int argc, char **argv) ...@@ -469,15 +471,27 @@ main (int argc, char **argv)
} }
printf ("},\n"); printf ("},\n");
/* langIndices */
printf ("{\n"); printf ("{\n");
for (i = 0; sets[i]; i++) for (i = 0; sets[i]; i++)
{ {
printf (" %d, /* %s */\n", entries[i].id, names[i]); printf (" %d, /* %s */\n", entries[i].id, names[i]);
} }
printf ("},\n");
/* langIndicesInv */
printf ("{\n");
{
static int entries_inv[MAX_LANG];
for (i = 0; sets[i]; i++)
entries_inv[entries[i].id] = i;
for (i = 0; sets[i]; i++)
printf (" %d, /* %s */\n", entries_inv[i], names[entries_inv[i]]);
}
printf ("}\n"); printf ("}\n");
printf ("};\n\n"); printf ("};\n\n");
printf ("#define NUM_LANG_CHAR_SET %d\n", i); printf ("#define NUM_LANG_CHAR_SET %d\n", i);
num_lang_set_map = (i + 31) / 32; num_lang_set_map = (i + 31) / 32;
printf ("#define NUM_LANG_SET_MAP %d\n", num_lang_set_map); printf ("#define NUM_LANG_SET_MAP %d\n", num_lang_set_map);
......
...@@ -686,10 +686,10 @@ FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb) ...@@ -686,10 +686,10 @@ FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb)
if (missing & (1 << j)) if (missing & (1 << j))
{ {
if (!FcLangSetContainsLang (lsa, if (!FcLangSetContainsLang (lsa,
fcLangCharSets[i*32 + j].lang)) fcLangCharSets[fcLangCharSetIndicesInv[i*32 + j]].lang))
{ {
if (FcDebug() & FC_DBG_MATCHV) if (FcDebug() & FC_DBG_MATCHV)
printf ("\tMissing bitmap %s\n", fcLangCharSets[i*32+j].lang); printf ("\tMissing bitmap %s\n", fcLangCharSets[fcLangCharSetIndicesInv[i*32+j]].lang);
return FcFalse; return FcFalse;
} }
} }
......
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