From 22b3a562d5c95f5911560131c9f6f2df70881e34 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 9 Mar 2023 13:47:23 -0800 Subject: fonts: keep layout text available for cairo When a cairo recording surface is used, it will memcpy() the text and therefore expects the layout's text to be complete enough to contain each glyph item's offset from base pointer. This keeps that text around long enough to satisfy that requirement. It will be reset on the next operation/call to get_unistr_info(). Fixes #2620 --- src/fonts-pangocairo.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/fonts-pangocairo.cc b/src/fonts-pangocairo.cc index 803a9438..15b77599 100644 --- a/src/fonts-pangocairo.cc +++ b/src/fonts-pangocairo.cc @@ -495,11 +495,6 @@ FontInfo::get_unistr_info(vteunistr c) uinfo->set_coverage(UnistrInfo::Coverage::USE_PANGO_LAYOUT_LINE); ufi->using_pango_layout_line.line = pango_layout_line_ref (line); - /* we hold a manual reference on layout. pango currently - * doesn't work if line->layout is NULL. ugh! */ - pango_layout_set_text(m_layout.get(), "", -1); /* make layout disassociate from the line */ - ufi->using_pango_layout_line.line->layout = (PangoLayout *)g_object_ref(m_layout.get()); - } else { PangoGlyphItem *glyph_item = (PangoGlyphItem *)line->runs->data; PangoFont *pango_font = glyph_item->item->analysis.font; @@ -529,10 +524,10 @@ FontInfo::get_unistr_info(vteunistr c) ufi->using_pango_glyph_string.font = pango_font ? (PangoFont *)g_object_ref (pango_font) : NULL; ufi->using_pango_glyph_string.glyph_string = pango_glyph_string_copy (glyph_string); } - } - /* release internal layout resources */ - pango_layout_set_text(m_layout.get(), "", -1); + /* release internal layout resources */ + pango_layout_set_text(m_layout.get(), "", -1); + } #if VTE_DEBUG m_coverage_count[0]++; -- cgit v1.2.1