+
+ if (FcPatternGetInteger(match, "pixelsize", 0, &tmp_int) !=
+ FcResultTypeMismatch) {
+ pango_font_description_set_absolute_size(out->pango_font_description,
+ tmp_int*PANGO_SCALE);
+ }
+
+ /* based on gtkmain.c gtk_get_default_language() */
+ 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,
+ 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);
+
+ return out;
+}
+
+RrFont *RrFontOpen(const RrInstance *inst, gchar *fontstring)
+{
+ RrFont *out;
+
+ if (!started) {
+ font_startup();
+ started = TRUE;
+ }
+
+ if ((out = openfont(inst, fontstring)))
+ return out;