From a4f56b5d8b3c3009fea7dafc3804fe573045bb32 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 30 Dec 2012 20:52:10 -0600 Subject: Fix most of "failed to choose font" warnings If we are in fallback mode, with a font that has to space glyph, then looking up engine/font for any character not in the font was failing badly. In that case, if there's only one engine (which is the case these days), just choose it. --- pango/pango-context.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pango/pango-context.c b/pango/pango-context.c index b15f44d1..6c61d777 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -1155,7 +1155,7 @@ typedef struct { } GetShaperFontInfo; static gboolean -get_shaper_and_font_foreach (PangoFontset *fontset G_GNUC_UNUSED, +get_shaper_and_font_foreach (PangoFontset *fontset, PangoFont *font, gpointer data) { @@ -1180,6 +1180,15 @@ get_shaper_and_font_foreach (PangoFontset *fontset G_GNUC_UNUSED, } } + if (!fontset && info->engines && info->engines->next == NULL) + { + /* We are in no-fallback mode and there's only one engine, just + * return it. */ + info->shape_engine = (PangoEngineShape *) info->engines->data; + info->font = font; + return TRUE; + } + return FALSE; } -- cgit v1.2.1