]> git.wh0rd.org Git - fontconfig.git/commitdiff
Revert "Fix FcNameUnparseLangSet()" and redo it
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 26 Aug 2009 00:40:30 +0000 (20:40 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 26 Aug 2009 00:41:34 +0000 (20:41 -0400)
This reverts commit 5c6d1ff23bda4386984a1d6e4c024958f8f5547c and
fixes that bug using the new reverse-map I added in the previous
commit.

src/fclang.c

index 6a3b7b5e3dbd44a71d9b54ae44a51561ea5556a0..ab7ae5381b6d020da2305594d3dd543e491088b4 100644 (file)
@@ -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);