X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffclang.c;h=90426a049f7ef7b96855c8d91cac60328c754c4e;hb=3074a73b418b40135d4a4f4e0713fcf987d34795;hp=361803a60e44a295263626dce35d1396f96abebc;hpb=c833409f6b68c191ac354cd2fdeb183f73a65c4c;p=fontconfig.git diff --git a/src/fclang.c b/src/fclang.c index 361803a..90426a0 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -1,5 +1,5 @@ /* - * $RCSId: xc/lib/fontconfig/src/fclang.c,v 1.7 2002/08/26 23:34:31 keithp Exp $ + * fontconfig/src/fclang.c * * Copyright © 2002 Keith Packard * @@ -13,9 +13,9 @@ * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR @@ -23,6 +23,7 @@ */ #include "fcint.h" +#include "fcftint.h" typedef struct { const FcChar8 lang[8]; @@ -54,7 +55,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, FcLangSet *ls; if (exclusiveLang) - exclusiveCharset = FcCharSetForLang (exclusiveLang); + exclusiveCharset = FcLangGetCharSet (exclusiveLang); ls = FcLangSetCreate (); if (!ls) return 0; @@ -196,7 +197,7 @@ FcLangContains (const FcChar8 *super, const FcChar8 *sub) } const FcCharSet * -FcCharSetForLang (const FcChar8 *lang) +FcLangGetCharSet (const FcChar8 *lang) { int i; int country = -1; @@ -218,6 +219,22 @@ FcCharSetForLang (const FcChar8 *lang) return &fcLangCharSets[country].charset; } +FcStrSet * +FcGetLangs (void) +{ + FcStrSet *langs; + int i; + + langs = FcStrSetCreate(); + if (!langs) + return 0; + + for (i = 0; i < NUM_LANG_CHAR_SET; i++) + FcStrSetAdd (langs, fcLangCharSets[i].lang); + + return langs; +} + FcLangSet * FcLangSetCreate (void) { @@ -727,6 +744,39 @@ 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" #undef __fclang__