diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-05-24 16:25:03 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-07-18 12:47:53 -0700 |
commit | 9b91930793610304632d887f032d02e058db8259 (patch) | |
tree | ad5e39a080899840ecd80728e0b6d626c8af92c7 /pango/pangofc-font.c | |
parent | 1e76cb0d0e002cfaa2472983f912fad9f1ab0fee (diff) | |
download | pango-9b91930793610304632d887f032d02e058db8259.tar.gz |
fc: Use harfbuzz for glyph lookup
We don't need our own caching here.
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r-- | pango/pangofc-font.c | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 43588889..c43781fa 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -664,50 +664,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 (PANGO_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; } /** |