]> Dogcows Code - chaz/openbox/commitdiff
use pango 1.16 stuff if its there. and use the old stuff if not. also! save it in...
authorDana Jansens <danakj@orodu.net>
Wed, 9 May 2007 21:41:16 +0000 (21:41 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 9 May 2007 21:41:16 +0000 (21:41 +0000)
configure.ac
render/font.c

index 2f4c0e0a51c9c2fa68e2db9056409801e8aab745..b6c7803f61b02074705c7cfb5bbc72fe27d71d46 100644 (file)
@@ -74,7 +74,7 @@ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.6.0])
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-PKG_CHECK_MODULES(PANGO, [pango >= 1.16.0 pangoxft >= 1.8.0])
+PKG_CHECK_MODULES(PANGO, [pango >= 1.8.0 pangoxft >= 1.8.0])
 AC_SUBST(PANGO_CFLAGS)
 AC_SUBST(PANGO_LIBS)
 
index 7a6338b0e9c86674c62b5a2756ff1397cb9ac8ba..166b9abb8182bafc8c782ca2f8a71931bdcff59e 100644 (file)
 static void measure_font(const RrInstance *inst, RrFont *f)
 {
     PangoFontMetrics *metrics;
+    static PangoLanguage *lang = NULL;
+
+    if (lang == NULL) {
+#if PANGO_VERSION_CHECK(1,16,0)
+        lang = pango_language_get_default();
+#else
+        gchar *locale, *p;
+        /* get the default language from the locale
+           (based on gtk_get_default_language in gtkmain.c) */
+        locale = g_strdup(setlocale(LC_CTYPE, NULL));
+        if ((p = strchr(locale, '.'))) *p = '\0'; /* strip off the . */
+        if ((p = strchr(locale, '@'))) *p = '\0'; /* strip off the @ */
+        lang = pango_language_from_string(locale);
+        g_free(locale);
+#endif
+    }
 
     /* measure the ascent and descent */
-    metrics = pango_context_get_metrics(inst->pango, f->font_desc,
-                                        pango_language_get_default());
+    metrics = pango_context_get_metrics(inst->pango, f->font_desc, lang);
     f->ascent = pango_font_metrics_get_ascent(metrics);
     f->descent = pango_font_metrics_get_descent(metrics);
     pango_font_metrics_unref(metrics);
+
 }
 
 RrFont *RrFontOpen(const RrInstance *inst, const gchar *name, gint size,
This page took 0.029731 seconds and 4 git commands to generate.