From 258c05b0e7f7a5a5e390dfdb0b715584581159bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= Date: Sun, 8 Jan 2023 00:01:38 +0000 Subject: 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 --- libgd/gd-two-lines-renderer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; } -- cgit v1.2.1