From b054282fa39c6fc664796da72a612005332c9ce8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 3 Jul 2022 10:37:48 -0400 Subject: 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. --- pango/pango-layout.c | 28 ++++++++++++++++++++++++++-- 1 file 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 -- cgit v1.2.1