summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-28 12:28:02 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-29 22:49:02 -0400
commit1c7a2ea2686af4affe0824ee57b38ea9cdec195d (patch)
tree76d9b65422f232aff23f40384e00038117ba04d0
parentea2c84eb7357031af60d37cb5378a254abe37ccc (diff)
downloadpango-1c7a2ea2686af4affe0824ee57b38ea9cdec195d.tar.gz
Don't compute log attrs on demand
If we don't have them, just do the fallback.
-rw-r--r--pango/glyphstring.c18
1 files 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++;
}