summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-07-03 10:37:48 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-07-03 10:37:48 -0400
commitb054282fa39c6fc664796da72a612005332c9ce8 (patch)
tree8155e6011f10e329e467a1dc0cc599338256ae68
parent641d8a2b056621fd1f1d5d58e6a9e4dbdfe8e7ae (diff)
downloadpango-b054282fa39c6fc664796da72a612005332c9ce8.tar.gz
layout: Apply show flags to line separators
We only want line separators at the line end to be visible when the show flags say so. This was not working before, because the shaping always marks LS as unknown glyph.
-rw-r--r--pango/pango-layout.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 165c6a7f..065f85a1 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -6186,6 +6186,23 @@ add_missing_hyphen (PangoLayoutLine *line,
}
}
+static PangoShowFlags
+find_show_flags (const PangoAnalysis *analysis)
+{
+ GSList *l;
+ PangoShowFlags flags = 0;
+
+ for (l = analysis->extra_attrs; l; l = l->next)
+ {
+ PangoAttribute *attr = l->data;
+
+ if (attr->klass->type == PANGO_ATTR_SHOW)
+ flags |= ((PangoAttrInt*)attr)->value;
+ }
+
+ return flags;
+}
+
static void
zero_line_final_space (PangoLayoutLine *line,
ParaBreakState *state,
@@ -6201,8 +6218,15 @@ zero_line_final_space (PangoLayoutLine *line,
if (glyphs->glyphs[glyph].glyph == PANGO_GET_UNKNOWN_GLYPH (0x2028))
{
- DEBUG1 ("zero final space: visible space");
- return; /* this LS is visible */
+ PangoShowFlags show_flags;
+
+ show_flags = find_show_flags (&item->analysis);
+
+ if ((show_flags & PANGO_SHOW_LINE_BREAKS) != 0)
+ {
+ DEBUG1 ("zero final space: visible space");
+ return; /* this LS is visible */
+ }
}
/* if the final char of line forms a cluster, and it's