summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Benítez León <nbenitezl@gmail.com>2023-01-10 22:53:30 +0000
committerNelson Benítez León <nbenitezl@gmail.com>2023-01-10 22:53:30 +0000
commit9995d0c7b075d533a7962d592acb3121ab6a9fb7 (patch)
treeba2d82ef321e44b01cae80b918ed91235dfaff23
parenta5198dd935a2d3cfa3a15365ebb33db1526d0266 (diff)
downloadgtk+-fix_gtklayout_pango_regression.tar.gz
Fix GtkTextView regression with Pango >= 1.44fix_gtklayout_pango_regression
Pango 1.44 started adding hyphens automatically when line breaking at character boundaries. A new pango attribute was added to control this new default behaviour, that's what this patch uses to keep GtkTextView/GtkTextlayout existing behaviour from changing (i.e. avoid a regression). Closes #2530 #2384 and gedit#365
-rw-r--r--gtk/gtktextlayout.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 31dbff6343..4795436e85 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1661,6 +1661,14 @@ add_text_attrs (GtkTextLayout *layout,
pango_attr_list_insert (attrs, attr);
+#if PANGO_VERSION_CHECK (1, 44, 0)
+ attr = pango_attr_insert_hyphens_new (FALSE);
+ attr->start_index = start;
+ attr->end_index = start + byte_count;
+
+ pango_attr_list_insert (attrs, attr);
+#endif
+
if (style->font_scale != 1.0)
{
attr = pango_attr_scale_new (style->font_scale);