diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
commit | 051d521f6e20761ba6831cecd91883da960fa931 (patch) | |
tree | b28abba7818115d2fed80eb360a79a0f9183948e /nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c | |
parent | 6dce607bad8711dd06a5a7b69ad1930386b4123b (diff) | |
parent | b8de7bf654929c823080b211aeac56cd213f5a32 (diff) | |
download | nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.gz nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.bz2 nx-libs-051d521f6e20761ba6831cecd91883da960fa931.zip |
Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x
Attributes GH PR #214: https://github.com/ArcticaProject/nx-libs/pull/214
Fixes ArcticaProject/nx-libs#157.
Diffstat (limited to 'nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c')
-rw-r--r-- | nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c b/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c index f3cc1e0e4..6934789cf 100644 --- a/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c +++ b/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /* * Generates a CJK character set table from a .TXT table as found on @@ -18,6 +17,8 @@ * ./cjk_tab_to_h BIG5 big5 > big5.h < BIG5.TXT * * ./cjk_tab_to_h JOHAB johab > johab.h < JOHAB.TXT + * + * ./cjk_tab_to_h BIG5HKSCS-0 big5hkscs >big5hkscs.h < BIG5HKSCS.TXT */ #include <stdio.h> @@ -892,6 +893,49 @@ static void do_big5 (const char* name) invert(&enc); output_uni2charset_sparse(name,&enc); } +/* Big5-HKSCS specifics */ + +static int row_byte_big5hkscs (int row) { + return 0x81+row; +} +static int col_byte_big5hkscs (int col) { + return (col >= 0x3f ? 0x62 : 0x40) + col; +} +static int byte_row_big5hkscs (int byte) { + if (byte >= 0x81 && byte < 0xff) + return byte-0x81; + else + return -1; +} +static int byte_col_big5hkscs (int byte) { + if (byte >= 0x40 && byte < 0x7f) + return byte-0x40; + else if (byte >= 0xa1 && byte < 0xff) + return byte-0x62; + else + return -1; +} + +static void do_big5hkscs (const char* name) +{ + Encoding enc; + + enc.rows = 126; + enc.cols = 157; + enc.row_byte = row_byte_big5hkscs; + enc.col_byte = col_byte_big5hkscs; + enc.byte_row = byte_row_big5hkscs; + enc.byte_col = byte_col_big5hkscs; + enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; + enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0xa1 && %1$s < 0xff)"; + enc.byte_row_expr = "%1$s - 0x81"; + enc.byte_col_expr = "%1$s - (%1$s >= 0xa1 ? 0x62 : 0x40)"; + + read_table(&enc); + output_charset2uni(name,&enc); + invert(&enc); output_uni2charset_sparse(name,&enc); +} + /* Johab Hangul specifics */ static int row_byte_johab_hangul (int row) { @@ -1014,6 +1058,8 @@ int main (int argc, char *argv[]) do_ksc5601(name); else if (!strcmp(name,"big5") || !strcmp(name,"cp950ext")) do_big5(name); + else if (!strcmp(name,"big5hkscs")) + do_big5hkscs(name); else if (!strcmp(name,"johab_hangul")) do_johab_hangul(name); else if (!strcmp(name,"cp932ext")) |