From: Behdad Esfahbod Date: Wed, 26 Aug 2009 00:40:30 +0000 (-0400) Subject: Revert "Fix FcNameUnparseLangSet()" and redo it X-Git-Tag: 2.7.2~2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=c5f0a65b36bc863d67bbf1f334262c35445ce610;p=fontconfig.git 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);