[pango/pango2: 112/201] itemize: Use pango_fontset_get_char




commit be07c5f9e557b1bff35f93433643a956f4c54cca
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 1 09:08:55 2022 -0500

    itemize: Use pango_fontset_get_char
    
    This is the right api to use here.

 pango/itemize.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)
---
diff --git a/pango/itemize.c b/pango/itemize.c
index efc45d56..619cc658 100644
--- a/pango/itemize.c
+++ b/pango/itemize.c
@@ -720,8 +720,6 @@ itemize_state_add_character (ItemizeState *state,
 }
 
 typedef struct {
-  PangoLanguage *lang;
-  gunichar wc;
   PangoFont *font;
   int position;
 } GetFontInfo;
@@ -733,20 +731,8 @@ get_font_foreach (PangoFontset *fontset,
 {
   GetFontInfo *info = data;
 
-  if (G_UNLIKELY (!font))
-    return FALSE;
-
-  if (pango_font_has_char (font, info->wc))
-    {
-      info->font = font;
-      return TRUE;
-    }
-
-  if (!fontset)
-    {
-      info->font = font;
-      return TRUE;
-    }
+  if (font == info->font)
+    return TRUE;
 
   info->position++;
 
@@ -777,13 +763,16 @@ get_font (ItemizeState  *state,
   if (state->enable_fallback && font_cache_get (state->cache, wc, font, position))
     return TRUE;
 
-  info.lang = state->derived_lang;
-  info.wc = wc;
   info.font = NULL;
   info.position = 0;
 
   if (state->enable_fallback)
-    pango_fontset_foreach (state->current_fonts, get_font_foreach, &info);
+    {
+      info.font = pango_fontset_get_font (state->current_fonts, wc);
+      if (info.font)
+        g_object_unref (info.font);
+      pango_fontset_foreach (state->current_fonts, get_font_foreach, &info);
+    }
 
   if (!info.font)
     info.font = get_base_font (state);


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