[pango/hb-getters] Use harfbuzz for glyph lookup



commit 7b6068a1eca61bc5080c5ec15bced7acaa1f851a
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 24 16:25:03 2019 +0000

    Use harfbuzz for glyph lookup
    
    We don't need our own caching here.

 pango/pangofc-font.c | 46 ++++------------------------------------------
 1 file changed, 4 insertions(+), 42 deletions(-)
---
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 65b6cb73..70e68e1f 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -639,50 +639,12 @@ static guint
 pango_fc_font_real_get_glyph (PangoFcFont *font,
                              gunichar     wc)
 {
-  PangoFcFontPrivate *priv = font->priv;
-  FT_Face face;
-  FT_UInt index;
-
-  guint idx;
-  PangoFcCmapCacheEntry *entry;
-
-
-  if (G_UNLIKELY (priv->cmap_cache == NULL))
-    {
-      PangoFcFontMap *fontmap = g_weak_ref_get ((GWeakRef *) &font->fontmap);
-      if (G_UNLIKELY (!fontmap))
-        return 0;
-
-      priv->cmap_cache = _pango_fc_font_map_get_cmap_cache (fontmap, font);
-
-      g_object_unref (fontmap);
+  hb_font_t *hb_font = pango_font_get_hb_font (font);
+  hb_codepoint_t glyph = PANGO_GET_UNKNOWN_GLYPH (wc);
 
-      if (G_UNLIKELY (!priv->cmap_cache))
-       return 0;
-    }
-
-  idx = wc & CMAP_CACHE_MASK;
-  entry = priv->cmap_cache->entries + idx;
-
-  if (entry->ch != wc)
-    {
-      face = PANGO_FC_FONT_LOCK_FACE (font);
-      if (G_LIKELY (face))
-        {
-         index = FcFreeTypeCharIndex (face, wc);
-         if (index > (FT_UInt)face->num_glyphs)
-           index = 0;
-
-         PANGO_FC_FONT_UNLOCK_FACE (font);
-       }
-      else
-        index = 0;
-
-      entry->ch = wc;
-      entry->glyph = index;
-    }
+  hb_font_get_nominal_glyph (hb_font, wc, &glyph);
 
-  return entry->glyph;
+  return glyph;
 }
 
 /**


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