[pango/kill-ft-face: 4/10] fc: Use harfbuzz for glyph lookup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/kill-ft-face: 4/10] fc: Use harfbuzz for glyph lookup
- Date: Fri, 12 Jul 2019 13:05:41 +0000 (UTC)
commit f5e3a25a863aa4411c5b57ac45d93585e253f6fb
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 24 16:25:03 2019 +0000
fc: 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 698a0eef..8ecd7574 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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]