summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-07 20:31:54 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-07 20:42:29 -0400
commit21a90c02c40889e619c11101442d33ccf6f91e9a (patch)
treedba40945c71b083a96f23eaa3665020c11ecf452
parentcb409bc6a52bd30845bbef10e35aefa6e1d32a0d (diff)
downloadpango-tests-and-fixes.tar.gz
break: Fix handling of tag sequencestests-and-fixes
Correctly classify tag characters as Grapheme_Extend, so that we don't end up putting grapheme boundaries in the middle of tag sequences. Includes a test.
-rw-r--r--pango/break.c7
-rw-r--r--tests/breaks/eleven.break2
-rw-r--r--tests/breaks/eleven.expected6
-rw-r--r--tests/layouts/valid-19.expected2
4 files changed, 16 insertions, 1 deletions
diff --git a/pango/break.c b/pango/break.c
index 7d204fa3..58e039e5 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -409,6 +409,12 @@ pango_default_break (const gchar *text,
GB_type = GB_Prepend;
break;
}
+ /* Tag chars */
+ if (wc >= 0xE0020 && wc <= 0xE00FF)
+ {
+ GB_type = GB_Extend;
+ break;
+ }
G_GNUC_FALLTHROUGH;
case G_UNICODE_CONTROL:
case G_UNICODE_LINE_SEPARATOR:
@@ -473,6 +479,7 @@ pango_default_break (const gchar *text,
break;
case G_UNICODE_MODIFIER_SYMBOL:
+ /* Fitzpatrick modifiers */
if (wc >= 0x1F3FB && wc <= 0x1F3FF)
GB_type = GB_Extend;
break;
diff --git a/tests/breaks/eleven.break b/tests/breaks/eleven.break
new file mode 100644
index 00000000..d674e3df
--- /dev/null
+++ b/tests/breaks/eleven.break
@@ -0,0 +1,2 @@
+# Various Emoji sequences
+β€οΈοΈŽοΈŽπŸ‘¨β€πŸ¦°πŸ‘¨πŸΏβ€πŸ¦±0οΈβƒ£πŸ΄σ ΅σ ³σ £σ ‘σ ΏπŸ‡©πŸ‡ͺ️
diff --git a/tests/breaks/eleven.expected b/tests/breaks/eleven.expected
new file mode 100644
index 00000000..533c9c14
--- /dev/null
+++ b/tests/breaks/eleven.expected
@@ -0,0 +1,6 @@
+Text: ❀️︎︎ πŸ‘¨[0x200d]🦰 πŸ‘¨πŸΏ[0x200d]🦱 0️⃣ 🏴[0xe0075][0xe0073][0xe0063][0xe0061][0xe007f] πŸ‡©πŸ‡ͺ️ [0x0a]
+Breaks: c lc lc lc lc lc c c
+Whitespace: w w
+Words: b b b bs be b b b
+Sentences: bs e b
+Graphemes: b b b b b b b b
diff --git a/tests/layouts/valid-19.expected b/tests/layouts/valid-19.expected
index cf7f3820..1efc1d54 100644
--- a/tests/layouts/valid-19.expected
+++ b/tests/layouts/valid-19.expected
@@ -16,7 +16,7 @@ range 0 2147483647
--- cursor positions
-0(0) 1(0) 5(0) 6(0) 13(0) 14(0) 21(0) 22(0) 30(0) 31(0) 34(0) 35(0) 42(0) 43(0) 44(0) 45(0) 46(0) 47(0) 51(0) 55(0) 59(0) 63(0) 67(0) 71(0) 72(0) 72(1) 75(0)
+0(0) 1(0) 5(0) 6(0) 13(0) 14(0) 21(0) 22(0) 30(0) 31(0) 34(0) 35(0) 42(0) 43(0) 44(0) 45(0) 46(0) 47(0) 71(0) 72(0) 72(1) 75(0)
--- lines