From: Kristian Rietveld Date: Fri, 23 Sep 2011 11:50:25 +0000 (+0200) Subject: Get _pango_get_lc_ctype from system prefs on Mac OS X X-Git-Tag: 1.29.5~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c21b1bfe1278de08673c495ba398fbdee874a778;p=platform%2Fupstream%2Fpango.git Get _pango_get_lc_ctype from system prefs on Mac OS X --- diff --git a/pango/pango-language.c b/pango/pango-language.c index 5b8583e..1cdc4f0 100644 --- a/pango/pango-language.c +++ b/pango/pango-language.c @@ -29,6 +29,10 @@ #include "pango-language.h" #include "pango-impl-utils.h" +#ifdef HAVE_CORE_TEXT +#include +#endif /* HAVE_CORE_TEXT */ + /* We embed a private struct right *before* a where a PangoLanguage * * points to. @@ -188,6 +192,23 @@ _pango_get_lc_ctype (void) return g_strdup (p); return g_win32_getlocale (); +#elif HAVE_CORE_TEXT + CFArrayRef languages; + CFStringRef language; + gchar ret[16]; + + languages = CFLocaleCopyPreferredLanguages (); + language = CFArrayGetValueAtIndex (languages, 0); + + if (!CFStringGetCString (language, ret, 16, kCFStringEncodingUTF8)) + { + CFRelease (languages); + return g_strdup (setlocale (LC_CTYPE, NULL)); + } + + CFRelease (languages); + + return g_strdup (ret); #else return g_strdup (setlocale (LC_CTYPE, NULL)); #endif