[pango/better-ellipsize] Correctly handle font attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/better-ellipsize] Correctly handle font attributes
- Date: Thu, 22 Jul 2021 11:29:25 +0000 (UTC)
commit 9bed4e1865ffd827d862ac9543d19b9ce108152e
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 22 07:21:24 2021 -0400
Correctly handle font attributes
pango_attr_iterator_get_attributes only returns
the innermost attribute of each kind. That is correct
for attributes that supersede each other, but not for
font descriptions, which get merged. So, keep all
font attributes in the returned list.
Update affected tests.
pango/pango-attributes.c | 19 ++++++++++---------
tests/markups/valid-11.expected | 1 +
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 26d08404..cb3d917d 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -2479,15 +2479,16 @@ pango_attr_iterator_get_attrs (PangoAttrIterator *iterator)
GSList *tmp_list2;
gboolean found = FALSE;
- for (tmp_list2 = attrs; tmp_list2; tmp_list2 = tmp_list2->next)
- {
- PangoAttribute *old_attr = tmp_list2->data;
- if (attr->klass->type == old_attr->klass->type)
- {
- found = TRUE;
- break;
- }
- }
+ if (attr->klass->type != PANGO_ATTR_FONT_DESC)
+ for (tmp_list2 = attrs; tmp_list2; tmp_list2 = tmp_list2->next)
+ {
+ PangoAttribute *old_attr = tmp_list2->data;
+ if (attr->klass->type == old_attr->klass->type)
+ {
+ found = TRUE;
+ break;
+ }
+ }
if (!found)
attrs = g_slist_prepend (attrs, pango_attribute_copy (attr));
diff --git a/tests/markups/valid-11.expected b/tests/markups/valid-11.expected
index bd3f83f2..797ef399 100644
--- a/tests/markups/valid-11.expected
+++ b/tests/markups/valid-11.expected
@@ -16,6 +16,7 @@ range 0 5
[0,13]fallback=0
[0,13]language=de
range 5 7
+[0,13]font-desc=Sans Italic 12 @wdth=100,wght=200
[0,13]foreground=#0000ffff0000
[0,13]background=#f0f0f0f0f0f0
[0,13]underline=2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]