]> git.wh0rd.org - fontconfig.git/commitdiff
[fclang] Implement FcLangSetGetLangs() (#18846)
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 14 Feb 2009 00:30:43 +0000 (16:30 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 15 Feb 2009 22:13:34 +0000 (14:13 -0800)
doc/fclangset.fncs
fontconfig/fontconfig.h
src/fclang.c

index 3f69f0d3040f0f01843fab81d88714abe4078d7c..f9d578e6585f9818758268c5d08ab0626c443188 100644 (file)
@@ -123,6 +123,14 @@ function returns FcLangDiffentTerritory. If <parameter>ls</parameter>
 has no matching language, this function returns FcLangDifferentLang.
 @@
 
+@RET@          FcStrSet *
+@FUNC@         FcLangSetGetLangs
+@TYPE1@                const FcLangSet *               @ARG1@          ls
+@PURPOSE@      get the list of languages in the langset
+@DESC@
+Returns a string set of all languages in <parameter>langset</parameter>.
+@@
+
 @RET@          FcStrSet *
 @FUNC@         FcGetLangs
 @TYPE1@                void
index 99e2f0421a67909afdd97e58e370c09707230a33..54dedacae3da134cdafbcb87b19c8de15b788314 100644 (file)
@@ -597,6 +597,9 @@ FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb);
 FcPublic FcChar32
 FcLangSetHash (const FcLangSet *ls);
 
+FcPublic FcStrSet *
+FcLangSetGetLangs (const FcLangSet *ls);
+
 /* fclist.c */
 FcPublic FcObjectSet *
 FcObjectSetCreate (void);
index 255333683e29a2ddc99a2536983f3dab46066739..d5afd528f39e61a75d391b906684a4332364bb36 100644 (file)
@@ -744,6 +744,38 @@ FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l)
     *l_serialize = *l;
     return l_serialize;
 }
+
+FcStrSet *
+FcLangSetGetLangs (const FcLangSet *ls)
+{
+    FcStrSet *langs;
+    int              i;
+
+    langs = FcStrSetCreate();
+    if (!langs)
+       return 0;
+
+    for (i = 0; i < NUM_LANG_CHAR_SET; i++)
+       if (FcLangSetBitGet (ls, i))
+           FcStrSetAdd (langs, fcLangCharSets[i].lang);
+
+    if (ls->extra)
+    {
+       FcStrList       *list = FcStrListCreate (ls->extra);
+       FcChar8         *extra;
+
+       if (list)
+       {
+           while ((extra = FcStrListNext (list)))
+               FcStrSetAdd (langs, extra);
+
+           FcStrListDone (list);
+       }
+    }
+
+    return langs;
+}
+
 #define __fclang__
 #include "fcaliastail.h"
 #include "fcftaliastail.h"