summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-09 12:10:37 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-09 12:16:14 -0400
commitcba71eea549a65aa229559206f9204665510d0aa (patch)
tree655bdf9275c22807dc33ab0366bc8efc6d1fb6de
parent77146b66f2307180934ef8d327aaab0bfe69bb35 (diff)
downloadpango-missing-zerowidth-chars.tar.gz
Add a few missing chars to pango_is_zero_widthmissing-zerowidth-chars
The documentation for this function states that all bidi control chars are zero width, but it was missing the Isolate ones. Add them. Updated tests included.
-rw-r--r--pango/pango-utils.c16
-rw-r--r--tests/testmisc.c11
2 files changed, 22 insertions, 5 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index c90b4c86..894935e7 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -920,23 +920,29 @@ pango_is_zero_width (gunichar ch)
*
* 2028 LINE SEPARATOR
*
+ * 2060 WORD JOINER
+ * 2061 FUNCTION APPLICATION
+ * 2062 INVISIBLE TIMES
+ * 2063 INVISIBLE SEPARATOR
+ *
+ * 2066 LEFT-TO-RIGHT ISOLATE
+ * 2067 RIGHT-TO-LEFT ISOLATE
+ * 2068 FIRST STRONG ISOLATE
+ * 2069 POP DIRECTIONAL ISOLATE
+ *
* 202A LEFT-TO-RIGHT EMBEDDING
* 202B RIGHT-TO-LEFT EMBEDDING
* 202C POP DIRECTIONAL FORMATTING
* 202D LEFT-TO-RIGHT OVERRIDE
* 202E RIGHT-TO-LEFT OVERRIDE
*
- * 2060 WORD JOINER
- * 2061 FUNCTION APPLICATION
- * 2062 INVISIBLE TIMES
- * 2063 INVISIBLE SEPARATOR
- *
* FEFF ZERO WIDTH NO-BREAK SPACE
*/
return ((ch & ~(gunichar)0x007F) == 0x2000 && (
(ch >= 0x200B && ch <= 0x200F) ||
(ch >= 0x202A && ch <= 0x202E) ||
(ch >= 0x2060 && ch <= 0x2063) ||
+ (ch >= 0x2066 && ch <= 0x2069) ||
(ch == 0x2028)
)) || G_UNLIKELY (ch == 0x00AD
|| ch == 0x034F
diff --git a/tests/testmisc.c b/tests/testmisc.c
index c0f8c426..fe2e9075 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -178,6 +178,17 @@ test_is_zero_width (void)
g_assert_true (pango_is_zero_width (0x034f));
g_assert_false (pango_is_zero_width ('a'));
g_assert_false (pango_is_zero_width ('c'));
+
+ g_assert_true (pango_is_zero_width (0x2066));
+ g_assert_true (pango_is_zero_width (0x2067));
+ g_assert_true (pango_is_zero_width (0x2068));
+ g_assert_true (pango_is_zero_width (0x2069));
+
+ g_assert_true (pango_is_zero_width (0x202a));
+ g_assert_true (pango_is_zero_width (0x202b));
+ g_assert_true (pango_is_zero_width (0x202c));
+ g_assert_true (pango_is_zero_width (0x202d));
+ g_assert_true (pango_is_zero_width (0x202e));
}
static void