Add FcGetLangs() and FcLangGetCharSet().

This commit is contained in:
Behdad Esfahbod 2007-11-05 15:29:44 -05:00
parent 811995b79d
commit cf223cc7bc
4 changed files with 40 additions and 5 deletions

View File

@ -122,3 +122,19 @@ a matching language but differs in which territory that language is for, this
function returns FcLangDiffentTerritory. If <parameter>ls</parameter> function returns FcLangDiffentTerritory. If <parameter>ls</parameter>
has no matching language, this function returns FcLangDifferentLang. has no matching language, this function returns FcLangDifferentLang.
@@ @@
@RET@ FcStrSet *
@FUNC@ FcGetLangs
@TYPE1@ void
@PURPOSE@ Get list of languages
@DESC@
Returns a string set of all known languages.
@@
@RET@ const FcCharSet *
@FUNC@ FcLangGetCharSet
@TYPE1@ const FcChar8 * @ARG1@ lang
@PURPOSE@ Get character map for a language
@DESC@
Returns the FcCharMap for a language.
@@

View File

@ -551,6 +551,12 @@ FcPublic FcBool
FcInitBringUptoDate (void); FcInitBringUptoDate (void);
/* fclang.c */ /* fclang.c */
FcStrSet *
FcGetLangs (void);
FcPublic const FcCharSet *
FcLangGetCharSet (const FcChar8 *lang);
FcPublic FcLangSet* FcPublic FcLangSet*
FcLangSetCreate (void); FcLangSetCreate (void);

View File

@ -890,9 +890,6 @@ FcFreeTypeLangSet (const FcCharSet *charset,
FcPrivate FcLangResult FcPrivate FcLangResult
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2); FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
FcPrivate const FcCharSet *
FcCharSetForLang (const FcChar8 *lang);
FcPrivate FcLangSet * FcPrivate FcLangSet *
FcLangSetPromote (const FcChar8 *lang); FcLangSetPromote (const FcChar8 *lang);

View File

@ -54,7 +54,7 @@ FcFreeTypeLangSet (const FcCharSet *charset,
FcLangSet *ls; FcLangSet *ls;
if (exclusiveLang) if (exclusiveLang)
exclusiveCharset = FcCharSetForLang (exclusiveLang); exclusiveCharset = FcLangGetCharSet (exclusiveLang);
ls = FcLangSetCreate (); ls = FcLangSetCreate ();
if (!ls) if (!ls)
return 0; return 0;
@ -196,7 +196,7 @@ FcLangContains (const FcChar8 *super, const FcChar8 *sub)
} }
const FcCharSet * const FcCharSet *
FcCharSetForLang (const FcChar8 *lang) FcLangGetCharSet (const FcChar8 *lang)
{ {
int i; int i;
int country = -1; int country = -1;
@ -218,6 +218,22 @@ FcCharSetForLang (const FcChar8 *lang)
return &fcLangCharSets[country].charset; 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 * FcLangSet *
FcLangSetCreate (void) FcLangSetCreate (void)
{ {