[Fontconfig] fontconfig: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Aug 25 17:44:23 PDT 2009
fc-lang/fc-lang.c | 20 +++++++++++++++++---
src/fclang.c | 33 ++++++++++++++++++++-------------
2 files changed, 37 insertions(+), 16 deletions(-)
New commits:
commit c5f0a65b36bc863d67bbf1f334262c35445ce610
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 25 20:40:30 2009 -0400
Revert "Fix FcNameUnparseLangSet()" and redo it
This reverts commit 5c6d1ff23bda4386984a1d6e4c024958f8f5547c and
fixes that bug using the new reverse-map I added in the previous
commit.
diff --git a/src/fclang.c b/src/fclang.c
index 6a3b7b5..ab7ae53 100644
--- a/src/fclang.c
+++ b/src/fclang.c
@@ -551,20 +551,27 @@ bail0:
FcBool
FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls)
{
- int i;
+ int i, bit;
+ FcChar32 bits;
FcBool first = FcTrue;
- for (i = 0; i < NUM_LANG_CHAR_SET; i++)
- if (FcLangSetBitGet (ls, i))
- {
- if (!first)
- if (!FcStrBufChar (buf, '|'))
+ for (i = 0; i < NUM_LANG_SET_MAP; i++)
+ {
+ if ((bits = ls->map[i]))
+ {
+ for (bit = 0; bit <= 31; bit++)
+ if (bits & (1 << bit))
+ {
+ int id = (i << 5) | bit;
+ if (!first)
+ if (!FcStrBufChar (buf, '|'))
+ return FcFalse;
+ if (!FcStrBufString (buf, fcLangCharSets[fcLangCharSetIndicesInv[id]].lang))
return FcFalse;
- if (!FcStrBufString (buf, fcLangCharSets[i].lang))
- return FcFalse;
- first = FcFalse;
- }
-
+ first = FcFalse;
+ }
+ }
+ }
if (ls->extra)
{
FcStrList *list = FcStrListCreate (ls->extra);
commit d354a321ee51f0bb70a39faeed541d1a90477d7d
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 25 20:39:20 2009 -0400
Bug 23419 - "contains" expression seems not working on the fontconfig rule
Fix bug in FcLangSetContains(), similar to
5c6d1ff23bda4386984a1d6e4c024958f8f5547c
diff --git a/fc-lang/fc-lang.c b/fc-lang/fc-lang.c
index a00aabc..21d568d 100644
--- a/fc-lang/fc-lang.c
+++ b/fc-lang/fc-lang.c
@@ -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 fcLangCharSets (fcLangData.langCharSets)\n");
printf ("#define fcLangCharSetIndices (fcLangData.langIndices)\n");
+ printf ("#define fcLangCharSetIndicesInv (fcLangData.langIndicesInv)\n");
printf ("\n");
printf ("static const struct {\n"
@@ -378,9 +379,10 @@ main (int argc, char **argv)
" intptr_t leaf_offsets[%d];\n"
" FcChar16 numbers[%d];\n"
" FcChar%s langIndices[%d];\n"
+ " FcChar%s langIndicesInv[%d];\n"
"} fcLangData = {\n",
nsets, tl, tn, tn,
- nsets < 256 ? "8 " : "16", nsets);
+ nsets < 256 ? "8 " : "16", nsets, nsets < 256 ? "8 " : "16", nsets);
/*
* Dump sets
@@ -469,15 +471,27 @@ main (int argc, char **argv)
}
printf ("},\n");
+ /* langIndices */
printf ("{\n");
for (i = 0; sets[i]; 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\n");
-
+
printf ("#define NUM_LANG_CHAR_SET %d\n", i);
num_lang_set_map = (i + 31) / 32;
printf ("#define NUM_LANG_SET_MAP %d\n", num_lang_set_map);
diff --git a/src/fclang.c b/src/fclang.c
index c5ad5ef..6a3b7b5 100644
--- a/src/fclang.c
+++ b/src/fclang.c
@@ -686,10 +686,10 @@ FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb)
if (missing & (1 << j))
{
if (!FcLangSetContainsLang (lsa,
- fcLangCharSets[i*32 + j].lang))
+ fcLangCharSets[fcLangCharSetIndicesInv[i*32 + j]].lang))
{
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;
}
}
More information about the Fontconfig
mailing list