summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2023-03-11 11:26:15 +0100
committerChristian Persch <chpe@src.gnome.org>2023-03-11 11:26:15 +0100
commitd02c5fce7d828c2c543d9ec01e36f4d6f97547ce (patch)
tree8bf62dc35ce22e92973779b9edb52987dec17633
parent26c3d4a7dd9b0cdbd2ebfc4ff28b06c987cc8c29 (diff)
downloadvte-d02c5fce7d828c2c543d9ec01e36f4d6f97547ce.tar.gz
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 (cherry picked from commit 22b3a562d5c95f5911560131c9f6f2df70881e34) (cherry picked from commit 0dc3dbae6cf71ee3f0efb1f31b8fd3eda7c150dd)
-rw-r--r--src/fonts-pangocairo.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/fonts-pangocairo.cc b/src/fonts-pangocairo.cc
index 8d0cb2a3..bbd8a6df 100644
--- a/src/fonts-pangocairo.cc
+++ b/src/fonts-pangocairo.cc
@@ -453,11 +453,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;
@@ -487,10 +482,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);
+ }
#ifdef VTE_DEBUG
m_coverage_count[0]++;