Skip to content

Commit

Permalink
[euptex] improve \Uchar, \Ucharcat (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-tk committed Jun 29, 2024
1 parent 664e90c commit 254f9cf
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 11 deletions.
4 changes: 2 additions & 2 deletions source/texk/web2c/euptexdir/pdfutils.ch
Original file line number Diff line number Diff line change
Expand Up @@ -1201,9 +1201,9 @@ pdf_strcmp_code: print_int(cur_val);
uniform_deviate_code: print_int(unif_rand(cur_val));
normal_deviate_code: print_int(norm_rand);
Uchar_convert_code:
if is_char_ascii(cur_val) then print_char(cur_val) else print_kanji(cur_val);
if check_echar_range(cur_val)>1 then print_char(cur_val) else print_kanji(cur_val);
Ucharcat_convert_code:
if cat<kanji then print_char(cur_val) else print_kanji(cur_val);
if (cat<kanji)and(check_echar_range(cur_val)>1) then print_char(cur_val) else print_kanji(cur_val);
@z
@x e-pTeX: if primitives - leave room for \ifincsname
Expand Down
12 changes: 11 additions & 1 deletion source/texk/web2c/euptexdir/tests/eup-ofm.log
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,15 @@ entering extended mode
l.43 \showbox0


> \box0=
\hbox(0.0+0.0)x10.49997, yoko direction
.\displace 0.0
.\uctt ^^c6
.\uctt ^^a1

! OK.
l.54 \showbox0


We have "2010. We do not have "2014. [1] )
Output written on eup-ofm.dvi (1 page, 528 bytes).
Output written on eup-ofm.dvi (1 page, 560 bytes).
20 changes: 16 additions & 4 deletions source/texk/web2c/euptexdir/tests/eup-ofm.tex
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,45 @@
\catcode"C6=11 \catcode"D8=11 \catcode"DF=11
\catcode"E6=11 \catcode"F8=11

\char"C6\char"D8\char"DF^^e6^^^^00f8
\char"C6\Uchar"D8\Ucharcat"DF"B^^e6^^^^00f8

ÆØßæø

\setbox0\hbox{【Æ】}
\showbox0

\kcatcode"A1=15 % not_cjk: not cjk in legacy encoding
\kcatcode"1A1=15

\char"C6\Uchar"A1^^c6\Ucharcat"BF"B

ơ% U+01A1 :: UTF-8 0xC6 0xA1
ƿ% U+01BF :: UTF-8 0xC6 0xBF

\setbox0\hbox{【ơ】}
\showbox0

\kcatcode"A1=14
\kcatcode"123=14
\catcode"123=11 \catcode"131=11 \catcode"152=11
\catcode"153=11

\char"123\char"131\char"152\char"153
\char"123\char"131\Uchar"152^^^^0153

ģıŒœ

\kcatcode`Γ=14 % Γ: U+0393
\catcode"393=11 \catcode"394=11 \catcode"398=11
\catcode"39B=11 \catcode"39E=11

\char"393\char"394\char\char"39B^^^^039e
\char"393\Uchar"394\char\Ucharcat"39B"B^^^^039e

ΓΔΘΛΞ

\kcatcode"2010=14
\catcode"2010=11 \catcode"2018=11 \catcode"2019=11

\char"2010\char"2018^^^^2019
\char"2010\Uchar"2018^^^^2019

‐‘’

Expand Down
12 changes: 11 additions & 1 deletion source/texk/web2c/uptexdir/tests/up-ofm.log
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@
l.43 \showbox0


> \box0=
\hbox(0.0+0.0)x10.49997, yoko direction
.\displace 0.0
.\uctt ^^c6
.\uctt ^^a1

! OK.
l.54 \showbox0


[1] )
Output written on up-ofm.dvi (1 page, 528 bytes).
Output written on up-ofm.dvi (1 page, 560 bytes).
12 changes: 12 additions & 0 deletions source/texk/web2c/uptexdir/tests/up-ofm.tex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
\setbox0\hbox{【Æ】}
\showbox0

\kcatcode"A1=15 % not_cjk: not cjk in legacy encoding
\kcatcode"1A1=15

\char"C6\char"A1^^c6\char"BF

ơ% U+01A1 :: UTF-8 0xC6 0xA1
ƿ% U+01BF :: UTF-8 0xC6 0xBF

\setbox0\hbox{【ơ】}
\showbox0

\kcatcode"A1=14
\kcatcode"123=14
\catcode"123=11 \catcode"131=11 \catcode"152=11
\catcode"153=11
Expand Down
6 changes: 3 additions & 3 deletions source/texk/web2c/uptexdir/uptex-m.ch
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ left_brace,right_brace,math_shift,tab_mark,sup_mark,sub_mark,spacer,
case m of
kanji,kana,other_kchar,hangul,modifier: print_kanji(KANJI(c));
left_brace,right_brace,math_shift,tab_mark,sup_mark,sub_mark,spacer,
letter,other_char: if (check_echar_range(c)=2) then print_kanji(KANJI(c)) else print(c);
letter,other_char: if (check_echar_range(c)=1) then print_kanji(KANJI(c)) else print(c);
@z

@x
Expand Down Expand Up @@ -2254,8 +2254,8 @@ end;
function check_echar_range(@!c:integer):integer;
begin
if (c>127)and(c<max_latin_val)and(kcat_code(kcatcodekey(c))=latin_ucs)then
check_echar_range:=2
else if (c>=0)and(c<256)then
check_echar_range:=1
else if (c>=0)and(c<256)then
check_echar_range:=2
else check_echar_range:=0;
@z

0 comments on commit 254f9cf

Please sign in to comment.