summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Benítez León <nbenitezl@gmail.com>2023-01-08 00:01:38 +0000
committerNelson Benítez León <nbenitezl@gmail.com>2023-01-08 00:01:38 +0000
commit258c05b0e7f7a5a5e390dfdb0b715584581159bb (patch)
tree27819a3ef17a6b3b2ee99a2d0bde0b1265085c9f
parentc7c7ff4e05d3fe82854219091cf116cce6b19de0 (diff)
downloadlibgd-258c05b0e7f7a5a5e390dfdb0b715584581159bb.tar.gz
Pango 1.44 got the ability to automatically hyphenate on line breaks,
which is enabled by default, but can be set off by a new attribute. As a result, GdTwoLinesRenderer is now showing a hyphen in some cases at end of first line, which is bad for filenames (like Totem or Evince recent files view) because a filename may already include hyphens so showing an extra hyphen which is not part of the filename is confusing. This is a regression that Pango devs are not going to fix but instead provided a new attribute to set this off. So to fix this regression, let's restore previous behaviour when using Pango >= 1.44 Fixes evince#1242 Fixes totem#349
-rw-r--r--libgd/gd-two-lines-renderer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libgd/gd-two-lines-renderer.c b/libgd/gd-two-lines-renderer.c
index f5e1ce5..57cb1ec 100644
--- a/libgd/gd-two-lines-renderer.c
+++ b/libgd/gd-two-lines-renderer.c
@@ -80,6 +80,17 @@ create_layout_with_attrs (GtkWidget *widget,
pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
}
+#if PANGO_VERSION_CHECK (1, 44, 0)
+ {
+ PangoAttrList *attr_list = pango_attr_list_new ();
+
+ pango_attr_list_insert (attr_list, pango_attr_insert_hyphens_new (FALSE));
+ pango_layout_set_attributes (layout, attr_list);
+
+ pango_attr_list_unref (attr_list);
+ }
+#endif
+
return layout;
}