summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-12 13:52:15 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-12 18:41:15 -0500
commita4fb00b9d290cec81b51ba38bd3bbc7f5ae62b93 (patch)
tree81d4f9629cf59f6f02139df0f15a5a46182253c4 /pango/pango-layout.c
parente2a297b31f440c75675680ae5cc8e611718ed0e0 (diff)
downloadpango-a4fb00b9d290cec81b51ba38bd3bbc7f5ae62b93.tar.gz
Simplify find_break_extra_width
We can use the log_widths that we already have.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index bf7c5fc5..ebc9ce67 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3737,23 +3737,6 @@ find_hyphen_width (PangoItem *item)
return 0;
}
-static int
-find_char_width (PangoItem *item,
- gunichar wc)
-{
- hb_font_t *hb_font;
- hb_codepoint_t glyph;
-
- if (!item->analysis.font)
- return 0;
-
- hb_font = pango_font_get_hb_font (item->analysis.font);
- if (hb_font_get_nominal_glyph (hb_font, wc, &glyph))
- return hb_font_get_glyph_h_advance (hb_font, glyph);
-
- return 0;
-}
-
static inline void
ensure_hyphen_width (ParaBreakState *state)
{
@@ -3775,14 +3758,7 @@ find_break_extra_width (PangoLayout *layout,
ensure_hyphen_width (state);
if (layout->log_attrs[state->start_offset + pos].break_removes_preceding)
- {
- PangoItem *item = state->items->data;
- gunichar wc;
-
- wc = g_utf8_get_char (g_utf8_offset_to_pointer (layout->text, state->start_offset + pos - 1));
-
- return state->hyphen_width - find_char_width (item, wc);
- }
+ return state->hyphen_width - state->log_widths[state->log_widths_offset + pos - 1];
else
return state->hyphen_width;
}