From 8ba5a3f89f2eb588e98f2dcf8aec12760ae44886 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 29 Aug 2011 08:56:50 +0000 Subject: ptexenc update from Takuji Tanaka git-svn-id: svn://tug.org/texlive/trunk@23744 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/ptexenc/ChangeLog | 7 +++++ Build/source/texk/ptexenc/unicode-jp.c | 47 ++++++++++++++++++++++++++-------- Build/source/texk/ptexenc/unicode.c | 5 ++-- 3 files changed, 46 insertions(+), 13 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog index 07de39fb089..8f51c5492d5 100644 --- a/Build/source/texk/ptexenc/ChangeLog +++ b/Build/source/texk/ptexenc/ChangeLog @@ -1,3 +1,10 @@ +2011-08-29 Peter Breitenlohner + + * unicode.c (UTF8length, UCStoUPTEX, UPTEXtoUCS), + * unicode-jp.c (variation, JIStoUCS2): Patches from + Takuji Tanaka , mail [ptex:00300]. + + 2011-08-22 Peter Breitenlohner More support for upTeX and e-upTeX. Updates from W32TeX. diff --git a/Build/source/texk/ptexenc/unicode-jp.c b/Build/source/texk/ptexenc/unicode-jp.c index b9374b49218..21ff28b15f8 100644 --- a/Build/source/texk/ptexenc/unicode-jp.c +++ b/Build/source/texk/ptexenc/unicode-jp.c @@ -132,21 +132,37 @@ static int UCS2toJISnative(int ucs2) */ static unsigned short int variation[] = { /* JIS X 0208, UCS-2(1), UCS-2(2), ..., 0(sentinel) */ - 0x2126 /* 1-6 */, 0x2022, 0x2219, 0x22C5, 0x30FB, 0, - 0x2131 /* 1-17 */, 0x203E, 0xFFE3, 0, - 0x213D /* 1-29 */, 0x2012, 0x2013, 0x2014, 0x2015, 0, - 0x2141 /* 1-33 */, 0x223C, 0x223E, 0x301C, 0xFF5E, 0, + 0x2126 /* 1-6 */, 0x30FB, 0x2022, 0x2219, 0x22C5, 0, + 0x2131 /* 1-17 */, 0xFFE3, 0x203E, 0, + 0x213D /* 1-29 */, 0x2015, 0x2012, 0x2013, 0x2014, 0, + 0x2141 /* 1-33 */, 0x301C, 0x223C, 0x223E, 0xFF5E, 0, 0x2142 /* 1-34 */, 0x2016, 0x2225, 0, - 0x2143 /* 1-35 */, 0x2223, 0xFF5C, 0, + 0x2143 /* 1-35 */, 0xFF5C, 0x2223, 0, 0x2144 /* 1-36 */, 0x2026, 0x22EF, 0, 0x215D /* 1-61 */, 0x2212, 0xFF0D, 0, - 0x216f /* 1-79 */, 0x00A5, 0xFFE5, 0, - 0x2171 /* 1-81 */, 0x00A2, 0xFFE0, 0, - 0x2172 /* 1-82 */, 0x00A3, 0xFFE1, 0, - 0x224C /* 2-44 */, 0x00AC, 0xFFE2, 0, - 0x227E /* 2-94 */, 0x20DD, 0x25EF, 0, + 0x216F /* 1-79 */, 0xFFE5, 0x00A5, 0, + 0x2171 /* 1-81 */, 0xFFE0, 0x00A2, 0, + 0x2172 /* 1-82 */, 0xFFE1, 0x00A3, 0, + 0x224C /* 2-44 */, 0xFFE2, 0x00AC, 0, + 0x227E /* 2-94 */, 0x25EF, 0x20DD, 0, 0 /* end */ }; +/* + if is_internalUPTEX, force JIS -> UCS2 conversion as follows: + 0x2126 ( 1-6 ) -> 0x30FB ( KATAKANA MIDDLE DOT ) + 0x2131 ( 1-17 ) -> 0xFFE3 ( FULLWIDTH MACRON ) + 0x213D ( 1-29 ) -> 0x2015 ( HORIZONTAL BAR ) + 0x2141 ( 1-33 ) -> 0x301C ( WAVE DASH ) + 0x2142 ( 1-34 ) -> 0x2016 ( DOUBLE VERTICAL LINE ) + 0x2143 ( 1-35 ) -> 0xFF5C ( FULLWIDTH VERTICAL LINE ) + 0x2144 ( 1-36 ) -> 0x2026 ( HORIZONTAL ELLIPSIS ) + 0x215D ( 1-61 ) -> 0x2212 ( MINUS SIGN ) + 0x216F ( 1-79 ) -> 0xFFE5 ( FULLWIDTH YEN SIGN ) + 0x2171 ( 1-81 ) -> 0xFFE0 ( FULLWIDTH NOT SIGN ) + 0x2172 ( 1-82 ) -> 0xFFE1 ( FULLWIDTH POUND SIGN ) + 0x224C ( 2-44 ) -> 0xFFE2 ( FULLWIDTH NOT SIGN ) + 0x227E ( 2-94 ) -> 0x25EF ( LARGE CIRCLE ) +*/ /* voiced sound of kana @@ -224,6 +240,17 @@ static unsigned short int semi_voiced_sounds[] = { /* convert a JIS X 0208 char to UCS-2 */ int JIStoUCS2(int jis) { + int i, j; + + /* first: variation table */ + if (is_internalUPTEX()) { + for (i=0; variation[i]!=0; i=j+1) { + if (variation[i] == jis) return variation[i+1]; + for (j=i+3; variation[j]!=0; j++) ; + } + } + + /* second: UnicodeTbl[][] */ return JIStoUCS2native(jis); } diff --git a/Build/source/texk/ptexenc/unicode.c b/Build/source/texk/ptexenc/unicode.c index be8768964e3..3fb90da913a 100644 --- a/Build/source/texk/ptexenc/unicode.c +++ b/Build/source/texk/ptexenc/unicode.c @@ -32,7 +32,7 @@ boolean isUTF8(int length, int nth, int c) int UTF8length(int first_byte) { - if (first_byte < 0x00) return -2; /* illegal */ + first_byte &= 0xff; if (first_byte < 0x80) return 1; if (first_byte < 0xc2) return -2; /* illegal */ if (first_byte < 0xe0) return 2; @@ -119,13 +119,12 @@ long UCStoUTF8(long ucs) /* using over U+10.FFFF Area */ long UCStoUPTEX (long ucs) { - if (0x7F < ucs && ucs < 0x1000) ucs += UCS_MAX; return ucs; } /* using over U+10.FFFF Area */ long UPTEXtoUCS (long uptex) { - if (UCS_MAX + 0x7F < uptex && uptex < UCS_MAX + 0x1000) uptex -= UCS_MAX; + if (uptex>UCS_MAX) return uptex % UCS_MAX; /* for OTF package */ return uptex; } -- cgit v1.2.3