From 1c7a2ea2686af4affe0824ee57b38ea9cdec195d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 28 Aug 2021 12:28:02 -0400 Subject: Don't compute log attrs on demand If we don't have them, just do the fallback. --- pango/glyphstring.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/pango/glyphstring.c b/pango/glyphstring.c index 282de61d..ea9a6398 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -413,8 +413,7 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs, * This variant of [method@Pango.GlyphString.index_to_x] additionally * accepts a `PangoLogAttr` array. The grapheme boundary information * in it can be used to disambiguate positioning inside some complex - * clusters. [method@Pango.GlyphString.index_to_x] will compute this - * information if it needs it. + * clusters. * * Since: 1.50 */ @@ -536,16 +535,7 @@ pango_glyph_string_index_to_x_full (PangoGlyphString *glyphs, * To come up with accurate answers here, we need to know grapheme * boundaries. */ - if (attrs == NULL && - g_utf8_next_char (text + start_index) != text + end_index) - { - int attrs_len = g_utf8_strlen (text, length) + 1; - - attrs = g_new0 (PangoLogAttr, attrs_len + 1); - pango_default_break (text, length, analysis, attrs, attrs_len); - } - - for (p = text + start_index, i = g_utf8_pointer_to_offset (text, text + start_index); + for (p = text + start_index, i = attrs ? g_utf8_pointer_to_offset (text, text + start_index) : 0; p < text + end_index; p = g_utf8_next_char (p), i++) { @@ -553,9 +543,7 @@ pango_glyph_string_index_to_x_full (PangoGlyphString *glyphs, continue; if (p < text + index) - { - cluster_offset++; - } + cluster_offset++; cluster_chars++; } -- cgit v1.2.1