summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-07-03 10:44:19 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-07-04 11:24:16 -0400
commite87e5ce9505a996528c632ac082f84601f53a8a1 (patch)
treeeb43538450b9b448d98dc38ae3e1f8e2855595db
parent0e95c6dca2839a8728def3b2131edcf2ad18087d (diff)
downloadpango-e87e5ce9505a996528c632ac082f84601f53a8a1.tar.gz
linebreaker: 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--pango2/pango-line-breaker.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/pango2/pango-line-breaker.c b/pango2/pango-line-breaker.c
index 6f068a9f..cd17968e 100644
--- a/pango2/pango-line-breaker.c
+++ b/pango2/pango-line-breaker.c
@@ -16,7 +16,7 @@
#include <hb-ot.h>
-#if 0
+#if 1
# define DEBUG1(...) g_debug (__VA_ARGS__)
#else
# define DEBUG1(...) do { } while (0)
@@ -1700,6 +1700,23 @@ add_missing_hyphen (Pango2LineBreaker *self,
line->hyphenated = (item->analysis.flags & PANGO2_ANALYSIS_FLAG_NEED_HYPHEN) != 0;
}
+static Pango2ShowFlags
+find_show_flags (const Pango2Analysis *analysis)
+{
+ GSList *l;
+ Pango2ShowFlags flags = 0;
+
+ for (l = analysis->extra_attrs; l; l = l->next)
+ {
+ Pango2Attribute *attr = l->data;
+
+ if (attr->type == PANGO2_ATTR_SHOW)
+ flags |= attr->int_value;
+ }
+
+ return flags;
+}
+
static void
zero_line_final_space (Pango2LineBreaker *self,
Pango2Line *line)
@@ -1720,8 +1737,13 @@ zero_line_final_space (Pango2LineBreaker *self,
if (glyphs->glyphs[glyph].glyph == PANGO2_GET_UNKNOWN_GLYPH (0x2028))
{
- DEBUG1 ("zero final space: visible space");
- return; /* this LS is visible */
+ Pango2ShowFlags show_flags = find_show_flags (&item->analysis);
+
+ if ((show_flags & PANGO2_SHOW_LINE_BREAKS) != 0)
+ {
+ DEBUG1 ("zero final space: visible LS");
+ return; /* this LS is visible */
+ }
}
/* if the final char of line forms a cluster, and it's