summaryrefslogtreecommitdiff
path: root/pango/break.c
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-08-16 14:18:20 +0800
committerPeng Wu <alexepico@gmail.com>2018-11-20 10:00:59 +0800
commitf1d3992379134812d81930c526ff1021d36ea7a5 (patch)
tree42cb88d746ce4faf48e7e4b370e952aa7dd4b497 /pango/break.c
parent1ad4ac6065a405d0c6033633fd1b9ee019745d1c (diff)
downloadpango-f1d3992379134812d81930c526ff1021d36ea7a5.tar.gz
Update Word Boundary to Unicode 11
Diffstat (limited to 'pango/break.c')
-rw-r--r--pango/break.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/pango/break.c b/pango/break.c
index c50c18eb..136d5006 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -218,6 +218,7 @@ pango_default_break (const gchar *text,
WB_ExtendNumLet,
WB_RI_Odd,
WB_RI_Even,
+ WB_WSegSpace,
} WordBreakType;
WordBreakType prev_prev_WB_type = WB_Other, prev_WB_type = WB_Other;
gint prev_WB_i = -1;
@@ -660,7 +661,14 @@ pango_default_break (const gchar *text,
break;
}
- /* Grapheme Cluster Boundary Rules */
+ if (WB_type == WB_Other)
+ {
+ if (type == G_UNICODE_SPACE_SEPARATOR &&
+ break_type != G_UNICODE_BREAK_NON_BREAKING_GLUE)
+ WB_type = WB_WSegSpace;
+ }
+
+ /* Word Cluster Boundary Rules */
/* We apply Rules WB1 and WB2 at the end of the function */
@@ -676,6 +684,11 @@ pango_default_break (const gchar *text,
}
else if (WB_type == WB_NewlineCRLF)
is_word_boundary = TRUE; /* Rule WB3b */
+ else if (prev_wc == 0x200D && is_Extended_Pictographic)
+ is_word_boundary = FALSE; /* Rule WB3c */
+ else if (prev_WB_type == WB_WSegSpace &&
+ WB_type == WB_WSegSpace && prev_WB_i + 1 == i)
+ is_word_boundary = FALSE; /* Rule WB3d */
else if (WB_type == WB_ExtendFormat)
is_word_boundary = FALSE; /* Rules WB4? */
else if ((prev_WB_type == WB_ALetter ||