summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2023-03-09 13:47:23 -0800
committerChristian Hergert <chergert@redhat.com>2023-03-09 13:47:23 -0800
commit22b3a562d5c95f5911560131c9f6f2df70881e34 (patch)
tree1461a73378afb231b494ac7e5af3ff1a86e2e9cc
parentfb3220bee959d37f58daf702165f142ef9fab9f4 (diff)
downloadvte-22b3a562d5c95f5911560131c9f6f2df70881e34.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
-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 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]++;