[vte/vte-next] CJK: Fix width of Box Drawing and Block Elements characters
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next] CJK: Fix width of Box Drawing and Block Elements characters
- Date: Sat, 25 Aug 2012 19:36:15 +0000 (UTC)
commit 50e6a2ae619fb712babd340939e7706d893f9bb5
Author: Christian Persch <chpe gnome org>
Date: Sat Aug 25 21:32:41 2012 +0200
CJK: Fix width of Box Drawing and Block Elements characters
U+254C..U+254F and U+2574..U+257F have East Asian Width property
N (neutral) while all the other line drawing characters are
A (ambigous). This makes those characters not match up with those
other line drawing characters from the Box Drawing (U+2500..U+257F)
block when using VTE_CJK_WIDTH=wide; so we forcibly treat them as
ambigous too.
And we also do the same for the Terminal Graphic Characters
(U+2596..U+259F) as well as U+2590 and U+2591 from the Block Elements
(U+2580..U+259F) block.
The reasons *why* these characters are N instead of A is not clear.
It certainly looks like a bug in Unicode, but these characters are there
since Unicode 1.1, and even the first version of UAX#11
(DTR#11, http://www.unicode.org/reports/dtr11.html) has them as N.
src/iso2022.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/iso2022.c b/src/iso2022.c
index d69f51b..180cfa7 100644
--- a/src/iso2022.c
+++ b/src/iso2022.c
@@ -347,6 +347,22 @@ _vte_iso2022_ambiguous_width(struct _vte_iso2022_state *state)
return 1;
}
+static gboolean
+_vte_unichar_iswide_cjk(gunichar c)
+{
+ /* U+254C..U+254F and U+2574..U+257F have East Asian Width property
+ * N (neutral) while all the other line drawing characters are
+ * A (ambigous). This makes those characters not match up with those
+ * other line drawing characters from the Box Drawing (U+2500..U+257F)
+ * block; so we treat them as ambigous too.
+ *
+ * And we also do the same for the Terminal Graphic Characters
+ * (U+2596..U+259F) as well as U+2590 and U+2591 from the Block Elements
+ * (U+2580..U+259F) block.
+ */
+ return G_UNLIKELY(c >= 0x2500 && c <= 0x259f);
+}
+
static inline gboolean
_vte_iso2022_is_ambiguous(gunichar c)
{
@@ -354,7 +370,7 @@ _vte_iso2022_is_ambiguous(gunichar c)
return FALSE;
if (G_UNLIKELY (g_unichar_iszerowidth (c)))
return FALSE;
- return G_UNLIKELY (!g_unichar_iswide (c) && g_unichar_iswide_cjk (c));
+ return G_UNLIKELY (!g_unichar_iswide (c) && (g_unichar_iswide_cjk (c) || _vte_unichar_iswide_cjk (c)));
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]