summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-07-21 22:31:14 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-07-21 22:31:14 +0000
commit01f83485d0ba2cdb5d1b92eb1dc3ed546b133f8e (patch)
tree7f149708cdb59630d0bd14d654d7513fec5b4f96 /pango
parentff1cb17695f26ec4a03cfb2afd36ad199925655d (diff)
downloadpango-01f83485d0ba2cdb5d1b92eb1dc3ed546b133f8e.tar.gz
Load a fontset and return the first font to take advantage of existing
2005-07-21 Owen Taylor <otaylor@redhat.com> * pango/pangofc-fontmap.c (pango_fc_font_map_load_font): Load a fontset and return the first font to take advantage of existing caching.
Diffstat (limited to 'pango')
-rw-r--r--pango/pangofc-fontmap.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index a6436f49..d614e4e7 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1141,22 +1141,43 @@ pango_fc_font_map_get_patterns (PangoFontMap *fontmap,
return patterns;
}
+static gboolean
+get_first_font (PangoFontset *fontset,
+ PangoFont *font,
+ gpointer data)
+{
+ *(PangoFont **)data = font;
+
+ return TRUE;
+}
+
static PangoFont *
pango_fc_font_map_load_font (PangoFontMap *fontmap,
PangoContext *context,
const PangoFontDescription *description)
{
- PangoFcPatternSet *patterns = pango_fc_font_map_get_patterns (fontmap, context, description, NULL);
- if (!patterns)
- return NULL;
+ PangoLanguage *language;
+ PangoFontset *fontset;
+ PangoFont *font = NULL;
+
+ if (context)
+ language = pango_context_get_language (context);
+ else
+ language = NULL;
- if (patterns->n_patterns > 0)
+ fontset = pango_font_map_load_fontset (fontmap, context, description, language);
+
+ if (fontset)
{
- return pango_fc_font_map_new_font (fontmap, context, description,
- patterns->patterns[0]);
+ pango_fontset_foreach (fontset, get_first_font, &font);
+
+ if (font)
+ g_object_ref (font);
+
+ g_object_unref (fontset);
}
- return NULL;
+ return font;
}
static void