summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-21 23:12:45 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-23 20:43:49 -0400
commit6bf91907514a3730ca0622adb72df94910f0f9fa (patch)
tree2becc126be7834e2a344140bfb999f2226309f2a /pango/pango-layout.c
parentc407656eab8777cfdbdf7f5109dba72795f7e996 (diff)
downloadpango-6bf91907514a3730ca0622adb72df94910f0f9fa.tar.gz
break: Add pango_attr_break api
So far, we've been applying attribute-based customization while doing per-item tailoring. But this is suboptimal, since it means we don't have a full view of the log attrs, and can't do invariant fixes that cross item boundaries. Therefore, add a separate pango_attr_break api that applies attributes to to the whole paragraph, and make PangoLayout use it.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index f78d7daf..b6e0c217 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -4214,12 +4214,13 @@ process_line (PangoLayout *layout,
}
static void
-get_items_log_attrs (const char *text,
- int start,
- int length,
- GList *items,
- PangoLogAttr *log_attrs,
- int log_attrs_len)
+get_items_log_attrs (const char *text,
+ int start,
+ int length,
+ GList *items,
+ PangoAttrList *attrs,
+ PangoLogAttr *log_attrs,
+ int log_attrs_len)
{
int offset = 0;
GList *l;
@@ -4235,12 +4236,18 @@ get_items_log_attrs (const char *text,
pango_tailor_break (text + item->offset,
item->length,
&item->analysis,
- item->offset,
+ -1,
log_attrs + offset,
item->num_chars + 1);
offset += item->num_chars;
}
+
+ if (attrs && items)
+ {
+ PangoItem *item = items->data;
+ pango_attr_break (text + start, length, attrs, item->offset, log_attrs, log_attrs_len);
+ }
}
static PangoAttrList *
@@ -4517,6 +4524,7 @@ pango_layout_check_lines (PangoLayout *layout)
start - layout->text,
delimiter_index + delim_len,
state.items,
+ shape_attrs,
layout->log_attrs + start_offset,
layout->n_chars + 1 - start_offset);