X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fmule-charset.c;h=8453ace76e22010f2574710c1b2532483dbf8b70;hb=fe69da567ca919e0d5757dd5fb1e5c8d7cb93408;hp=924536a2a46d3b89a6f31fa79bf3bc18eef262d8;hpb=c22b401ea7242f5f796759d1abe3c8c3269d27b5;p=chise%2Fxemacs-chise.git diff --git a/src/mule-charset.c b/src/mule-charset.c index 924536a..8453ace 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -386,7 +386,7 @@ Lisp_Object Qleading_byte; Lisp_Object Qshort_name, Qlong_name; #ifdef UTF2000 Lisp_Object Qmin_code, Qmax_code, Qcode_offset; -Lisp_Object Qmother, Qconversion, Q94x60; +Lisp_Object Qmother, Qconversion, Q94x60, Q94x94x60; #endif Lisp_Object Qascii, @@ -986,9 +986,51 @@ get_unallocated_leading_byte (int dimension) Emchar decode_builtin_char (Lisp_Object charset, int code_point) { + Lisp_Object mother = XCHARSET_MOTHER (charset); int final; - if (EQ (charset, Vcharset_chinese_big5)) + if ( CHARSETP (mother) ) + { + int code = code_point; + + if ( XCHARSET_CONVERSION (charset) == CONVERSION_94x60 ) + { + int row = code_point >> 8; + int cell = code_point & 255; + + if (row < 16 + 32) + return -1; + else if (row < 16 + 32 + 30) + code = (row - (16 + 32)) * 94 + cell - 33; + else if (row < 18 + 32 + 30) + return -1; + else if (row < 18 + 32 + 60) + code = (row - (18 + 32)) * 94 + cell - 33; + } + else if ( XCHARSET_CONVERSION (charset) == CONVERSION_94x94x60 ) + { + int plane = code_point >> 16; + int row = (code_point >> 8) & 255; + int cell = code_point & 255; + + if (row < 16 + 32) + return -1; + else if (row < 16 + 32 + 30) + code + = (plane - 33) * 94 * 60 + + (row - (16 + 32)) * 94 + + cell - 33; + else if (row < 18 + 32 + 30) + return -1; + else if (row < 18 + 32 + 60) + code + = (plane - 33) * 94 * 60 + + (row - (18 + 32)) * 94 + + cell - 33; + } + return DECODE_CHAR (mother, code + XCHARSET_CODE_OFFSET(charset)); + } + else if (EQ (charset, Vcharset_chinese_big5)) { int c1 = code_point >> 8; int c2 = code_point & 0xFF; @@ -1094,11 +1136,12 @@ charset_code_point (Lisp_Object charset, Emchar ch) code = ch; if ( (min <= code) && (code <= max) ) { + int d = code - XCHARSET_CODE_OFFSET (charset); + if ( XCHARSET_CONVERSION (charset) == CONVERSION_94x60 ) { - int m = code - min; - int row = m / 94; - int cell = m % 94 + 33; + int row = d / 94; + int cell = d % 94 + 33; if (row < 30) row += 16 + 32; @@ -1106,10 +1149,20 @@ charset_code_point (Lisp_Object charset, Emchar ch) row += 18 + 32; return (row << 8) | cell; } - else if (XCHARSET_CHARS (charset) == 94) + else if ( XCHARSET_CONVERSION (charset) == CONVERSION_94x94x60 ) { - int d =code - XCHARSET_CODE_OFFSET (charset); + int plane = d / (94 * 60) + 33; + int row = (d % (94 * 60)) / 94; + int cell = d % 94 + 33; + if (row < 30) + row += 16 + 32; + else + row += 18 + 32; + return (plane << 16) | (row << 8) | cell; + } + else if (XCHARSET_CHARS (charset) == 94) + { if (XCHARSET_DIMENSION (charset) == 1) return d + 33; else if (XCHARSET_DIMENSION (charset) == 2) @@ -1128,8 +1181,6 @@ charset_code_point (Lisp_Object charset, Emchar ch) } else if (XCHARSET_CHARS (charset) == 96) { - int d =code - XCHARSET_CODE_OFFSET (charset); - if (XCHARSET_DIMENSION (charset) == 1) return d + 32; else if (XCHARSET_DIMENSION (charset) == 2) @@ -1442,6 +1493,7 @@ character set. Recognized properties are: this character set. 'dimension Number of octets used to index a character in this charset. Either 1 or 2. Defaults to 1. + If UTF-2000 feature is enabled, 3 or 4 are also available. 'columns Number of columns used to display a character in this charset. Only used in TTY mode. (Under X, the actual width of a character can be derived from the font used to display the @@ -1450,6 +1502,7 @@ character set. Recognized properties are: 'chars Number of characters in each dimension (94 or 96). Defaults to 94. Note that if the dimension is 2, the character set thus described is 94x94 or 96x96. + If UTF-2000 feature is enabled, 128 or 256 are also available. 'final Final byte of ISO 2022 escape sequence. Must be supplied. Each combination of (DIMENSION, CHARS) defines a separate namespace for final bytes. Note that ISO @@ -1474,6 +1527,13 @@ character set. Recognized properties are: is passed the octets of the character, with the high bit cleared and set depending upon whether the value of the 'graphic property is 0 or 1. +'mother [UTF-2000 only] Base coded-charset. +'code-min [UTF-2000 only] Minimum code-point of a base coded-charset. +'code-max [UTF-2000 only] Maximum code-point of a base coded-charset. +'code-offset [UTF-2000 only] Offset for a code-point of a base + coded-charset. +'conversion [UTF-2000 only] Conversion for a code-point of a base + coded-charset (94x60 or 94x94x60). */ (name, doc_string, props)) { @@ -1611,6 +1671,10 @@ character set. Recognized properties are: { if (EQ (value, Q94x60)) conversion = CONVERSION_94x60; + else if (EQ (value, Q94x94x60)) + conversion = CONVERSION_94x94x60; + else + signal_simple_error ("Unrecognized conversion", value); } #endif @@ -2402,6 +2466,7 @@ syms_of_mule_charset (void) defsymbol (&Qcode_offset, "code-offset"); defsymbol (&Qconversion, "conversion"); defsymbol (&Q94x60, "94x60"); + defsymbol (&Q94x94x60, "94x94x60"); #endif defsymbol (&Ql2r, "l2r");