From 232df3cdac378951a8be002f28bd2fb8c8595487 Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Fri, 12 Jul 2019 16:08:21 +0000 Subject: eptex: version 190709 (add \ifincsname, revise \iffontchar and \fontchar?? git-svn-id: svn://tug.org/texlive/trunk@51624 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/eptexdir/ChangeLog | 14 ++++ Build/source/texk/web2c/eptexdir/eptex.ech | 72 +++++++++++----- Build/source/texk/web2c/eptexdir/eptex_version.h | 2 +- Build/source/texk/web2c/eptexdir/pdfutils.ch | 98 +++++++++++++++++++++- Build/source/texk/web2c/eptexdir/tests/fontchar.sh | 2 + .../source/texk/web2c/eptexdir/tests/fontchar.tex | 61 ++++++++++++++ .../texk/web2c/eptexdir/tests/zero_search.tex | 72 ++++++++++++++++ 7 files changed, 297 insertions(+), 24 deletions(-) create mode 100644 Build/source/texk/web2c/eptexdir/tests/fontchar.sh create mode 100644 Build/source/texk/web2c/eptexdir/tests/fontchar.tex create mode 100644 Build/source/texk/web2c/eptexdir/tests/zero_search.tex (limited to 'Build/source') diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog index a3fdd4378b8..35b6877d06a 100644 --- a/Build/source/texk/web2c/eptexdir/ChangeLog +++ b/Build/source/texk/web2c/eptexdir/ChangeLog @@ -1,3 +1,17 @@ +2019-07-09 Hironori Kitagawa + + * pdfutils.ch: Add primitive \ifincsname. + * eptex.ech: Revise \iffontchar and \fontchar?? to treat + negative value as char_type. + - \iffontchar (Japanese font f) (number c): + - c >= 0: true iff is_char_kanji(c) + - c < 0: true iff f has char_type -(c+1) + - \fontcharwd (Japanese font f) (number c): + - c >= 0: return the width of character c + - c < 0: return the width of char_type -(c+1) + * tests/fontchar.{sh,tex}, tests/zero_search.tex: Added. + * eptex.ech, eptex_version.h: e-pTeX version 190709. + 2019-05-28 Hironobu Yamashita * am/eptex.am: Add a new test. diff --git a/Build/source/texk/web2c/eptexdir/eptex.ech b/Build/source/texk/web2c/eptexdir/eptex.ech index efba7a6fa45..bd62a7ba28e 100644 --- a/Build/source/texk/web2c/eptexdir/eptex.ech +++ b/Build/source/texk/web2c/eptexdir/eptex.ech @@ -26,8 +26,8 @@ @y @d eTeX_version_string=='-2.6' {current \eTeX\ version} @# -@d epTeX_version_string=='-190131' -@d epTeX_version_number==190131 +@d epTeX_version_string=='-190709' +@d epTeX_version_number==190709 @z @x e-pTeX: banner @@ -173,14 +173,14 @@ begin if ((type(tx)=glue_node) and (subtype(tx)=jfm_skip+1)) tx:=last_jchr else if (type(tx)=kern_node) and (subtype(tx)=normal) then begin r:=head; q:=link(head); - while q<>tx do - begin r:=q; + while q<>tx do + begin r:=q; if is_char_node(q) then if font_dir[font(q)]<>dir_default then q:=link(q); q:=link(q); end; if ((type(r)=penalty_node) and (subtype(r)=kinsoku_pena)) then tx:=last_jchr else tx:=r; end; -if not is_char_node(tx) then +if not is_char_node(tx) then begin if type(tx)=ligature_node then begin r:=lig_ptr(tx); while link(r)<>null do r:=link(r); @@ -213,12 +213,12 @@ end begin cur_val_level:=int_val; cur_val:=-1; end else cur_val_level:=cur_chr; - if (cur_chr=last_node_char_code)and(is_char_node(tx))and(tx<>head) then + if (cur_chr=last_node_char_code)and(is_char_node(tx))and(tx<>head) then { |tx| might be ``second node'' of a KANJI character; so we need to look the node before |tx| } begin r:=head; q:=head; while q<>tx do begin r:=q; q:=link(q); end; { |r| is the node just before |tx| } if (r<>head)and is_char_node(r) then if font_dir[font(r)]<>dir_default then tx:=r; - find_last_char; + find_last_char; end; @z @@ -514,7 +514,9 @@ saving_hyph_codes_code:print_esc("savinghyphcodes"); saving_hyph_codes_code:print_esc("savinghyphcodes"); read_papersize_special_code:print_esc("readpapersizespecial"); @z + @x e-pTeX: font_char_{wd,ht,dp,ic}_code l.27306 +font_char_ic_code: begin scan_font_ident; q:=cur_val; scan_char_num; if (font_bc[q]<=cur_val)and(font_ec[q]>=cur_val) then begin i:=char_info(q)(qi(cur_val)); case m of @@ -527,9 +529,20 @@ read_papersize_special_code:print_esc("readpapersizespecial"); else cur_val:=0; end; @y +font_char_ic_code: begin scan_font_ident; q:=cur_val; if font_dir[q]<>dir_default then {Japanese font} - begin if is_char_kanji(cur_val) then {Japanese Character} - begin cur_val:=get_jfm_pos(KANJI(cur_val),q); + begin scan_int; + if cur_val>=0 then + begin if is_char_kanji(cur_val) then {Japanese Character} + cur_val:=get_jfm_pos(KANJI(cur_val),q) + else cur_val:=-1 + end + else begin + cur_val:=-(cur_val+1); + if (font_bc[q]>cur_val)or(font_ec[q]-1 then + begin i:=orig_char_info(q)(qi(cur_val)); case m of font_char_wd_code: cur_val:=char_width(q)(i); @@ -540,16 +553,18 @@ read_papersize_special_code:print_esc("readpapersizespecial"); end else cur_val:=0; end - else if (font_bc[q]<=cur_val)and(font_ec[q]>=cur_val) then - begin i:=orig_char_info(q)(qi(cur_val)); - case m of - font_char_wd_code: cur_val:=char_width(q)(i); - font_char_ht_code: cur_val:=char_height(q)(height_depth(i)); - font_char_dp_code: cur_val:=char_depth(q)(height_depth(i)); - font_char_ic_code: cur_val:=char_italic(q)(i); - end; {there are no other cases} + else begin scan_char_num; + if (font_bc[q]<=cur_val)and(font_ec[q]>=cur_val) then + begin i:=orig_char_info(q)(qi(cur_val)); + case m of + font_char_wd_code: cur_val:=char_width(q)(i); + font_char_ht_code: cur_val:=char_height(q)(height_depth(i)); + font_char_dp_code: cur_val:=char_depth(q)(height_depth(i)); + font_char_ic_code: cur_val:=char_italic(q)(i); + end; {there are no other cases} + end + else cur_val:=0; end - else cur_val:=0; end; @z @@ -624,9 +639,28 @@ othercases goto next_p @z @x e-pTeX: if_font_char_code l.28633 +if_font_char_code:begin scan_font_ident; n:=cur_val; scan_char_num; + if (font_bc[n]<=cur_val)and(font_ec[n]>=cur_val) then b:=char_exists(char_info(n)(qi(cur_val))) + else b:=false; + end; @y - b:=char_exists(orig_char_info(n)(qi(cur_val))) +if_font_char_code:begin scan_font_ident; n:=cur_val; + if font_dir[n]<>dir_default then + begin scan_int; + if cur_val>=0 then b:=is_char_kanji(cur_val) + { In u\pTeX, $\hbox{|is_char_kanji|} = \lambda x\mathpunct{.} x\ge 0$ } + else begin + cur_val:=-(cur_val+1); + b:=(font_bc[n]<=cur_val)and(font_ec[n]>=cur_val) + end + end + else begin scan_char_num; + if (font_bc[n]<=cur_val)and(font_ec[n]>=cur_val) then @/ + b:=char_exists(orig_char_info(n)(qi(cur_val))) + else b:=false; + end; + end; @z @x diff --git a/Build/source/texk/web2c/eptexdir/eptex_version.h b/Build/source/texk/web2c/eptexdir/eptex_version.h index cd40e324dec..6fa8a213345 100644 --- a/Build/source/texk/web2c/eptexdir/eptex_version.h +++ b/Build/source/texk/web2c/eptexdir/eptex_version.h @@ -1 +1 @@ -#define EPTEX_VERSION "190131" +#define EPTEX_VERSION "190709" diff --git a/Build/source/texk/web2c/eptexdir/pdfutils.ch b/Build/source/texk/web2c/eptexdir/pdfutils.ch index a805b730a9d..88f80935ebc 100644 --- a/Build/source/texk/web2c/eptexdir/pdfutils.ch +++ b/Build/source/texk/web2c/eptexdir/pdfutils.ch @@ -24,6 +24,9 @@ %% %% \pdfelapsedtime and \pdfresettimer %% +%% \expanded +%% +%% \ifincsname @x @* \[8] Packed data. @@ -620,6 +623,27 @@ no_expand: if chr_code=0 then print_esc("noexpand") else print_esc("pdfprimitive"); @z +@x \ifincsname +var t:halfword; {token that is being ``expanded after''} +@!p,@!q,@!r:pointer; {for list manipulation} +@y +var t:halfword; {token that is being ``expanded after''} +@!b:boolean; {keep track of nested csnames} +@!p,@!q,@!r:pointer; {for list manipulation} +@z + +@x +@ @= +@y +@ @= +@!is_in_csname: boolean; + +@ @= +is_in_csname := false; + +@ @= +@z + @x no_expand:@; @y @@ -715,6 +739,22 @@ goto restart; end @z +@x +begin r:=get_avail; p:=r; {head of the list of characters} +repeat get_x_token; +@y +begin r:=get_avail; p:=r; {head of the list of characters} +b := is_in_csname; is_in_csname := true; +repeat get_x_token; +@z + +@x +@; +@y +is_in_csname := b; +@; +@z + @x scan_keyword @!k:pool_pointer; {index into |str_pool|} begin p:=backup_head; link(p):=null; k:=str_start[s]; @@ -1032,12 +1072,13 @@ uniform_deviate_code: print_int(unif_rand(cur_val)); normal_deviate_code: print_int(norm_rand); @z -@x \[if]pdfprimitive -@d if_mbox_code=if_dbox_code+1 { `\.{\\ifmbox}' } +@x e-pTeX: if primitives - leave room for \ifincsname +@d if_tdir_code=if_case_code+4 { `\.{\\iftdir}' } @y -@d if_mbox_code=if_dbox_code+1 { `\.{\\ifmbox}' } +@d if_in_csname_code=20 { `\.{\\ifincsname}'; |if_font_char_code| + 1 } +@d if_pdfprimitive_code=21 { `\.{\\ifpdfprimitive}' } @# -@d if_pdfprimitive_code=if_mbox_code+1 { `\.{\\ifpdfprimitive}' } +@d if_tdir_code=if_pdfprimitive_code+1 { `\.{\\iftdir}' } @z @x \[if]pdfprimitive @@ -1047,6 +1088,15 @@ normal_deviate_code: print_int(norm_rand); if_pdfprimitive_code:print_esc("ifpdfprimitive"); @z +@x \ifincsname +var b:boolean; {is the condition true?} +@!r:"<"..">"; {relation to be evaluated} +@y +var b:boolean; {is the condition true?} +@!e:boolean; {keep track of nested csnames} +@!r:"<"..">"; {relation to be evaluated} +@z + @x \[if]pdfprimitive if_void_code, if_hbox_code, if_vbox_code, if_tbox_code, if_ybox_code, if_dbox_code, if_mbox_code: @; @@ -1294,6 +1344,46 @@ elapsed_time_code: cur_val := get_microinterval; random_seed_code: cur_val := random_seed; @z +@x +primitive("iffontchar",if_test,if_font_char_code); +@!@:if_font_char_}{\.{\\iffontchar} primitive@> +@y +primitive("iffontchar",if_test,if_font_char_code); +@!@:if_font_char_}{\.{\\iffontchar} primitive@> +primitive("ifincsname",if_test,if_in_csname_code); +@!@:if_in_csname_}{\.{\\ifincsname} primitive@> +@z + +@x +if_font_char_code:print_esc("iffontchar"); +@y +if_font_char_code:print_esc("iffontchar"); +if_in_csname_code:print_esc("ifincsname"); +@z + +@x +if_cs_code:begin n:=get_avail; p:=n; {head of the list of characters} + repeat get_x_token; +@y +if_cs_code:begin n:=get_avail; p:=n; {head of the list of characters} + e := is_in_csname; is_in_csname := true; + repeat get_x_token; +@z + +@x + b:=(eq_type(cur_cs)<>undefined_cs); +@y + b:=(eq_type(cur_cs)<>undefined_cs); + is_in_csname := e; +@z + +@x +if_font_char_code:begin scan_font_ident; n:=cur_val; +@y +if_in_csname_code: b := is_in_csname; +if_font_char_code:begin scan_font_ident; n:=cur_val; +@z + @x procedure print_kanji(@!s:KANJI_code); {prints a single character} begin diff --git a/Build/source/texk/web2c/eptexdir/tests/fontchar.sh b/Build/source/texk/web2c/eptexdir/tests/fontchar.sh new file mode 100644 index 00000000000..6430e83ca83 --- /dev/null +++ b/Build/source/texk/web2c/eptexdir/tests/fontchar.sh @@ -0,0 +1,2 @@ +#!/bin/sh +luatex zero_search.tex && ppltotf zero_search.pl && eptex fontchar diff --git a/Build/source/texk/web2c/eptexdir/tests/fontchar.tex b/Build/source/texk/web2c/eptexdir/tests/fontchar.tex new file mode 100644 index 00000000000..1df91d27cd1 --- /dev/null +++ b/Build/source/texk/web2c/eptexdir/tests/fontchar.tex @@ -0,0 +1,61 @@ +%#!eptex + +\catcode`\_=12 \catcode`\@=11 +\def\typeout{\immediate\write17} +\begingroup + \catcode`\P=12 \catcode`\T=12 + \lowercase{ + \gdef\rem@pt#1.#2PT{#1\ifnum#2>\z@.#2\fi} + } +\endgroup +\def\strip@pt{\expandafter\rem@pt\the} + +\def\TFC#1{\typeout{code #1: \iffontchar\jfont#1 T\else F\fi}} +\def\TFT#1#2{\typeout{type \the\numexpr-#1-1\relax: + \iffontchar#2#1 + (\strip@pt\fontcharht#2#1+\strip@pt\fontchardp#2#1)*\strip@pt\fontcharwd#2#1 + \else F\fi +}} + +\TFC{"A1A1} +\TFC{"FEFE} +\TFC{"E0A1} +\TFC{"FCFC} +\TFC{"8140} +\TFC{"9FFC} + +\typeout{TEST: \string\jfont: \fontname\sevenmin} +\sevenmin +\count@=-1 +\loop \ifnum\count@>-15 + \TFT\count@\jfont\advance\count@\m@ne +\repeat + +\typeout{TEST: \string\tfont: \fontname\tfont} +\count@=-1 +\loop \ifnum\count@>-15 + \TFT\count@\tfont\advance\count@\m@ne +\repeat + +\protected\def\NEXT{\ten=1 + \loop\ifnum\ten<95 + \ifdim\fontcharwd\zs\kuten\numexpr\ku*256+\ten=10pt + \global\count@=\kuten\numexpr\ku*256+\ten + \global\count0\ku \global\count2\ten + \global\ku=95 \ten=95 + \fi + \advance\ten1 + \repeat} +\count@=0 +\jfont\zs=zero_search +\newcount\ku +\newcount\ten +\ku=1 +\loop\ifnum\ku<95 + {\ifnum11=\ifnum\ku>8 1\else0\fi\ifnum\ku<16 1\else 0\fi\else\NEXT\fi}% + \advance\ku1 +\repeat +\kansujichar1=\count@ +\typeout{\kansuji1(internal code: \the\count@, \the\count0-ku \the\count2-ten)} + +\bye diff --git a/Build/source/texk/web2c/eptexdir/tests/zero_search.tex b/Build/source/texk/web2c/eptexdir/tests/zero_search.tex new file mode 100644 index 00000000000..02b0df3929c --- /dev/null +++ b/Build/source/texk/web2c/eptexdir/tests/zero_search.tex @@ -0,0 +1,72 @@ +%#!luatex +\input luatexja.sty + +\catcode\endlinechar=12 +\catcode`\ =12 +\catcode`\%=12 +\catcode`\#=12 +\directlua{ +local f = io.open("zero_search.pl", "w") +if f then + function OUT(s) f:write(s .. string.char(10)) end +else + function OUT(s) end +end +local jisx0208 = luatexja.base.load_cache('ltj-jisx0208', + function() return false end) +local utf = unicode.utf8 +OUT([[ +(COMMENT THIS IS A KANJI FORMAT FILE) +(DESIGNSIZE R 10.0) +(COMMENT DESIGNSIZE IS IN POINTS) +(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) +(CHECKSUM O 0) +(FONTDIMEN + (SLANT R 0.0) + (SPACE R 0.0) + (STRETCH R 0.0) + (SHRINK R 0.0) + (XHEIGHT R 1.0) + (QUAD R 1.0) + (EXTRASPACE R 0.0) + (EXTRASTRETCH R 0.0) + (EXTRASHRINK R 0.0) + )]]) +local CNT=96 +local r = {} +for i=1,94 do + for j=1,94 do + if not ((i>0x08 and i<0x10) or i>0x54) then + local t = math.random( ((i>0x40) and 0 or 1), CNT-1) + r[t] = r[t] or {} + table.insert(r[t],0x2020+i*256+j) + end + end +end +local floor = math.floor +for i=1,CNT-1 do + if #(r[i])>0 then + table.sort(r[i]) + OUT("(CHARSINTYPE D " .. tostring(i)) + local s, k = " ", 0 + for j=1,#(r[i]) do + local f = r[i][j] + k, s = k+1, s .. 'J ' .. string.format("%04X",f) + if k%10==0 then OUT(s); s = " " else s = s .. " " end + end + if k%10>0 then OUT(s) end + OUT(" )") + end +end +for i=0,CNT-1 do + if #(r[i])>0 then + OUT("(TYPE D " .. tostring(i)) + OUT(" (CHARWD R " .. tostring(1+i/100) .. ")") + OUT(" (CHARHT R 0.88)") + OUT(" (CHARDP R 0.12)") + OUT(" )") + end +end +f:close() +} +\bye -- cgit v1.2.3