diff options
author | marha <marha@users.sourceforge.net> | 2012-06-11 08:22:24 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-06-11 08:22:24 +0200 |
commit | 080d1527a5358dd66ac927acbe0ec61cba7aa7e1 (patch) | |
tree | 6d54a6409a4627162bddaad63186327e1ecdbad1 /fontconfig/src/fcstr.c | |
parent | 990bc3f015a4f8fce2eb918375defcd44980a845 (diff) | |
download | vcxsrv-080d1527a5358dd66ac927acbe0ec61cba7aa7e1.tar.gz vcxsrv-080d1527a5358dd66ac927acbe0ec61cba7aa7e1.tar.bz2 vcxsrv-080d1527a5358dd66ac927acbe0ec61cba7aa7e1.zip |
fontconfig glproto mesa pixman git update 11 Jun 2012
Diffstat (limited to 'fontconfig/src/fcstr.c')
-rw-r--r-- | fontconfig/src/fcstr.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index e372af080..c446bcd8e 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -1177,6 +1177,50 @@ FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s) } FcBool +FcStrSetAddLangs (FcStrSet *strs, const char *languages) +{ + const char *p = languages, *next; + FcChar8 lang[128] = {0}, *normalized_lang; + size_t len; + FcBool ret = FcFalse; + + if (!languages) + return FcFalse; + + while ((next = strchr (p, ':'))) + { + len = next - p; + len = FC_MIN (len, 128); + strncpy ((char *) lang, p, len); + lang[len] = 0; + /* ignore an empty item */ + if (*lang) + { + normalized_lang = FcLangNormalize ((const FcChar8 *) lang); + if (normalized_lang) + { + FcStrSetAdd (strs, normalized_lang); + free (normalized_lang); + ret = FcTrue; + } + } + p = next + 1; + } + if (*p) + { + normalized_lang = FcLangNormalize ((const FcChar8 *) p); + if (normalized_lang) + { + FcStrSetAdd (strs, normalized_lang); + free (normalized_lang); + ret = FcTrue; + } + } + + return ret; +} + +FcBool FcStrSetDel (FcStrSet *set, const FcChar8 *s) { int i; |