[pango] Fix most of "failed to choose font" warnings



commit a4f56b5d8b3c3009fea7dafc3804fe573045bb32
Author: Behdad Esfahbod <behdad behdad org>
Date:   Sun Dec 30 20:52:10 2012 -0600

    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 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/pango/pango-context.c b/pango/pango-context.c
index b15f44d..6c61d77 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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]