[gucharmap] unicode: Generate names for CJK compatibility ideographs programmatically
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gucharmap] unicode: Generate names for CJK compatibility ideographs programmatically
- Date: Thu, 3 Mar 2016 18:02:01 +0000 (UTC)
commit d715c95d2558a861559129ac6f82d36457732ae6
Author: Christian Persch <chpe gnome org>
Date: Thu Mar 3 19:01:01 2016 +0100
unicode: Generate names for CJK compatibility ideographs programmatically
Instead of bloating the binary with this data, generate the
names programmatically in gucharmap-unicode-info.c.
gucharmap/gen-guch-unicode-tables.pl | 4 ++++
gucharmap/gucharmap-unicode-info.c | 9 +++++----
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gucharmap/gen-guch-unicode-tables.pl b/gucharmap/gen-guch-unicode-tables.pl
index 88e7594..af355a6 100755
--- a/gucharmap/gen-guch-unicode-tables.pl
+++ b/gucharmap/gen-guch-unicode-tables.pl
@@ -118,6 +118,10 @@ sub process_unicode_data_txt
my $hex = $1;
my $name = $2;
+ # Skip items where we can easily reconstruct the name programmatically
+ next if ($name =~ /^CJK UNIFIED IDEOGRAPH-[0-9A-F]{4,6}$/);
+ next if ($name =~ /^CJK COMPATIBILITY IDEOGRAPH-[0-9A-F]{4,6}$/);
+
# Skip unwanted items
next if ($name =~ /^<.+, (First|Last)>$/);
diff --git a/gucharmap/gucharmap-unicode-info.c b/gucharmap/gucharmap-unicode-info.c
index c6eafa5..2906f04 100644
--- a/gucharmap/gucharmap-unicode-info.c
+++ b/gucharmap/gucharmap-unicode-info.c
@@ -77,10 +77,11 @@ gucharmap_get_unicode_name (gunichar wc)
g_snprintf (buf, sizeof (buf), "CJK UNIFIED IDEOGRAPH-%04X", wc);
return buf;
}
- /* FIXME: handle U+F900..U+FAFF CJK COMPATIBILITY IDEOGRAPH U+%04X and
- * U+2F800..U+2FA1D CJK COMPATIBILITY IDEOGRAPH U+%04X here,
- * instead of via gucharmap_get_unicode_data_name below, to save some space?
- */
+ else if ((wc >= 0xf900 && wc <= 0xfaff) ||
+ (wc >= 0x2f800 && wc <= 0x2fa1d)) {
+ g_snprintf (buf, sizeof (buf), "CJK COMPATIBILITY IDEOGRAPH-%04X", wc);
+ return buf;
+ }
else if (wc >= 0xac00 && wc <= 0xd7af)
{
/* compute hangul syllable name as per UAX #15 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]