diff options
| author | Mikael Magnusson <mikachu@comhem.se> | 2005-07-16 20:16:55 +0000 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@comhem.se> | 2005-07-16 20:16:55 +0000 |
| commit | b1a1ad5d0616a6278ec6b8ca56a4088fc1a77638 (patch) | |
| tree | 280ba5deb2fb161e5dce69d37a66dcecba05194b | |
| parent | 2fb7b70ccbba394e2bfff3b4f67fa4e5ea456981 (diff) | |
fix the PangoLanguage thing to get from locale
| -rw-r--r-- | render/font.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/render/font.c b/render/font.c index 6ddd3b89..6bb00c1b 100644 --- a/render/font.c +++ b/render/font.c @@ -124,10 +124,19 @@ static RrFont *openfont(const RrInstance *inst, gchar *fontstring) pango_font_description_set_size(out->pango_font_description, tmp_int*PANGO_SCALE); } + /* based on gtkmain.c gtk_get_default_language() */ PangoLanguage *ln; - PangoFontMetrics *metrics = pango_context_get_metrics(context, out->pango_font_description, ln = pango_language_from_string("en_US")); + gchar *locale, *p; + locale = g_strdup(setlocale(LC_CTYPE, NULL)); + if ((p = strchr(locale, '.'))) + *p = '\0'; + if ((p = strchr(locale, '@'))) + *p = '\0'; + printf("%s\n", locale); + PangoFontMetrics *metrics = pango_context_get_metrics(context, out->pango_font_description, ln = pango_language_from_string(locale)); out->pango_ascent = pango_font_metrics_get_ascent(metrics); out->pango_descent = pango_font_metrics_get_descent(metrics); + g_free(locale); pango_font_metrics_unref(metrics); #endif /* USE_PANGO */ |
