- /* based on gtkmain.c gtk_get_default_language() */
- PangoLanguage *ln;
- gchar *locale, *p;
- locale = g_strdup(setlocale(LC_CTYPE, NULL));
- if ((p = strchr(locale, '.')))
- *p = '\0';
- if ((p = strchr(locale, '@')))
- *p = '\0';
- 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 */
-
- if (FcPatternGetBool(match, OB_SHADOW, 0, &out->shadow) != FcResultMatch)
- out->shadow = FALSE;
-
- if (FcPatternGetInteger(match, OB_SHADOW_OFFSET, 0, &out->offset) !=
- FcResultMatch)
- out->offset = 1;
-
- if (FcPatternGetInteger(match, OB_SHADOW_ALPHA, 0, &tint) != FcResultMatch)
- tint = 25;
- if (tint > 100) tint = 100;
- else if (tint < -100) tint = -100;
- out->tint = tint;
-
- font = XftFontOpenPattern(RrDisplay(inst), match);
- if (!font) {
- FcPatternDestroy(match);
- g_free(out);
- return NULL;
- } else
- out->xftfont = font;
-
-#ifdef USE_PANGO
- /* FcPatternDestroy(match); */
-#endif /* USE_PANGO */
- measure_font(out);
+ /* setup the font */
+ pango_font_description_set_family(out->font_desc, name);
+ pango_font_description_set_weight(out->font_desc, pweight);
+ pango_font_description_set_style(out->font_desc, pstyle);
+ pango_font_description_set_size(out->font_desc, size * PANGO_SCALE);
+
+ /* setup the layout */
+ pango_layout_set_font_description(out->layout, out->font_desc);
+ pango_layout_set_single_paragraph_mode(out->layout, TRUE);
+
+ /* get the ascent and descent */
+ measure_font(inst, out);