diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-01 09:08:55 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-28 09:03:03 -0500 |
commit | 39a1a509dd8073b6c7a998b5b1bc2316ae4ae408 (patch) | |
tree | 71b2766385029d27bcd285b4ed021e473f89c486 | |
parent | 391ab359be56a707f114afd0b937ee7e5b43ac9c (diff) | |
download | pango-39a1a509dd8073b6c7a998b5b1bc2316ae4ae408.tar.gz |
itemize: Use pango_fontset_get_char
This is the right api to use here.
-rw-r--r-- | pango/itemize.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/pango/itemize.c b/pango/itemize.c index 01399b7e..935a3250 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); |