From 9f7307579d809c7eca4c350e128045715a77303c Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Fri, 2 Feb 2018 13:13:02 +0000 Subject: ptexdir, uptexdir: support SKIP property in GLUEKERN and rearrangement git-svn-id: svn://tug.org/texlive/trunk@46518 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ptexdir/ChangeLog | 13 ++ Build/source/texk/web2c/ptexdir/am/ptex.am | 6 + Build/source/texk/web2c/ptexdir/ppltotf.ch | 26 +++- Build/source/texk/web2c/ptexdir/ptex-base.ch | 37 +++-- Build/source/texk/web2c/ptexdir/ptftopl.ch | 2 +- Build/source/texk/web2c/ptexdir/skipjfmp.test | 22 +++ Build/source/texk/web2c/ptexdir/tests/skipjfmp.pl | 159 +++++++++++++++++++++ Build/source/texk/web2c/ptexdir/tests/skipjfmp.tex | 33 +++++ Build/source/texk/web2c/ptexdir/tests/skipjfmp.tfm | Bin 0 -> 632 bytes 9 files changed, 281 insertions(+), 17 deletions(-) create mode 100755 Build/source/texk/web2c/ptexdir/skipjfmp.test create mode 100644 Build/source/texk/web2c/ptexdir/tests/skipjfmp.pl create mode 100644 Build/source/texk/web2c/ptexdir/tests/skipjfmp.tex create mode 100644 Build/source/texk/web2c/ptexdir/tests/skipjfmp.tfm (limited to 'Build/source/texk/web2c/ptexdir') diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index c9232f0c909..74db42062c7 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,3 +1,16 @@ +2018-02-02 Hironobu Yamashita + + * ppltotf.ch: Fix issues GitHub:texjporg/tex-jp-build#47, #48 + - Support SKIP property in GLUEKERN table. + - Improve hex charcode parsing. + * ptftopl.ch: Fix issue GitHub:texjporg/tex-jp-build#48 + - Print ASCII characters always in hex charcode (for upTFtoPL). + * ptex-base.ch: Fix issue GitHub:texjporg/tex-jp-build#47 + - Support SKIP property in GLUEKERN table. + - Support huge GLUEKERN table with rearrangement. + * am/ptex.am: Add new tests. + * skipjfm.test, tests/skipjfm.{tex,pl,tfm}: New test files. + 2018-01-31 Hironori Kitagawa * ptex-base.ch: Fix issue GitHub:texjporg/tex-jp-build#40 diff --git a/Build/source/texk/web2c/ptexdir/am/ptex.am b/Build/source/texk/web2c/ptexdir/am/ptex.am index 77864e61c02..eccef3f920c 100644 --- a/Build/source/texk/web2c/ptexdir/am/ptex.am +++ b/Build/source/texk/web2c/ptexdir/am/ptex.am @@ -1,5 +1,6 @@ ## texk/web2c/ptexdir/am/ptex.am: Makefile fragment for pTeX. ## +## Copyright (C) 2016-2018 Karl Berry ## Copyright (C) 2010-2015 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. @@ -177,12 +178,14 @@ pweb_tests += ptexdir/pbibtex-openout-test.pl ptexdir/pbibtex-longline-test.pl pweb_tests += ptexdir/pbibtex-mem.test ptexdir/nissya.test pweb_tests += ptexdir/sample.test pweb_tests += ptexdir/yokotate.test +pweb_tests += ptexdir/skipjfmp.test ptexdir/pbibtex.log ptexdir/pbibtex-openout-test.log ptexdir/pbibtex-longline-test.log \ ptexdir/pbibtex-mem.log ptexdir/nissya.log: pbibtex$(EXEEXT) ptexdir/pdvitype.log ptexdir/sample.log: pdvitype$(EXEEXT) ptexdir/ppltotf.log: ppltotf$(EXEEXT) ptexdir/ptftopl.log: ptftopl$(EXEEXT) ptexdir/yokotate.log: ppltotf$(EXEEXT) ptftopl$(EXEEXT) +ptexdir/skipjfmp.log: ppltotf$(EXEEXT) ptftopl$(EXEEXT) EXTRA_DIST += $(ptex_tests) $(pweb_tests) DISTCLEANFILES += $(pweb_programs:=.c) $(pweb_programs:=.h) \ @@ -220,6 +223,9 @@ DISTCLEANFILES += ptests/xsample.typ EXTRA_DIST += ptexdir/tests/min10.pl ptexdir/tests/min10.tfm EXTRA_DIST += ptexdir/tests/tmin10.pl ptexdir/tests/tmin10.tfm DISTCLEANFILES += ptests/x*min10.* +## ptexdir/skipjfmp.test +EXTRA_DIST += ptexdir/tests/skipjfmp.pl ptexdir/tests/skipjfmp.tfm +DISTCLEANFILES += ptests/xskipjfmp.* ## ptexdir/ptriptest EXTRA_DIST += ptexdir/ptrip/ptrip.diffs ptexdir/ptrip/texmf.cnf ptrip.diffs: ptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT) diff --git a/Build/source/texk/web2c/ptexdir/ppltotf.ch b/Build/source/texk/web2c/ptexdir/ppltotf.ch index cb2d61ac258..edb61d7efa2 100644 --- a/Build/source/texk/web2c/ptexdir/ppltotf.ch +++ b/Build/source/texk/web2c/ptexdir/ppltotf.ch @@ -375,7 +375,8 @@ incr(current_option); We need to include some routines for handling kanji characters. @= -max_kanji=7237; { maximam number of 2byte characters } +max_kanji=7237; { maximum number of 2byte characters } +max_kanji_code=@"7E7E; { maximum jis code } yoko_id_number=11; { is identifier for YOKO-kumi font} tate_id_number=9; { is identifier for TATE-kumi font} @@ -439,6 +440,7 @@ if cur_code=comment_code then skip_to_end_of_item else begin case cur_code of label_code:@; stop_code:@; + skip_code:@; krn_code:@; glue_code:@; others: @@ -683,11 +685,9 @@ if ch=')' then begin decr(loc); jis_code:=0; end else if (ch='J')or(ch='j') then - begin repeat ch:=get_next_raw; until ch<>' '; - cx:=todig(xord[ch])*@"1000; - incr(loc); ch:=xord[buffer[loc]]; cx:=cx+todig(ch)*@"100; - incr(loc); ch:=xord[buffer[loc]]; cx:=cx+todig(ch)*@"10; - incr(loc); ch:=xord[buffer[loc]]; cx:=cx+todig(ch); + begin repeat ch:=get_next_raw; + until ch<>' '; {skip the blanks after the type code} + @; jis_code:=toDVI(fromJIS(cx)); cur_char:=ch; if not valid_jis_code(jis_code) then err_print('jis code ', jis_code:1, ' is invalid'); @@ -702,5 +702,19 @@ else jis_code:=-1; get_kanji:=jis_code; end; +@ @= +begin cx:=todig(xord[ch]); + incr(loc); ch:=xord[buffer[loc]]; + while ((ch>="0")and(ch<="9"))or((ch>="A")and(ch<="F")) do + begin cx:=cx*16+todig(ch); {overflow might happen, but rare...} + incr(loc); ch:=xord[buffer[loc]]; + end; + decr(loc); ch:=xord[buffer[loc]]; + if cx>max_kanji_code then + begin skip_error('This value shouldn''t exceed jis code'); + cx:=0; ch:=" "; + end; +end + @* Index. @z diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch index 38b3b57e529..17e55d7065a 100644 --- a/Build/source/texk/web2c/ptexdir/ptex-base.ch +++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch @@ -2708,10 +2708,15 @@ in the |glue_kern| array. And a \.{JFM} does not use |tag=2| and |tag=3|. @x [30.557] l.11413 - pTeX: glue_kern_start @d lig_kern_start(#)==lig_kern_base[#]+rem_byte {beginning of lig/kern program} +@d lig_kern_restart_end(#)==256*op_byte(#)+rem_byte(#)+32768-kern_base_offset +@d lig_kern_restart(#)==lig_kern_base[#]+lig_kern_restart_end @y @d lig_kern_start(#)==lig_kern_base[#]+rem_byte {beginning of lig/kern program} -@d glue_kern_start(#)==lig_kern_base[#]+rem_byte - {beginning of glue/kern program} +@d lig_kern_restart_end(#)==256*op_byte(#)+rem_byte(#)+32768-kern_base_offset +@d lig_kern_restart(#)==lig_kern_base[#]+lig_kern_restart_end +@d glue_kern_start(#)==lig_kern_base[#]+rem_byte {beginning of glue/kern program} +@d glue_kern_restart_end(#)==256*op_byte(#)+rem_byte(#)+32768-kern_base_offset +@d glue_kern_restart(#)==lig_kern_base[#]+glue_kern_restart_end @z @x [30.560] l.11457 - pTeX: jfm_flag, jfm_id, nt, cx @@ -3928,9 +3933,13 @@ if (math_type(subscr(q))=empty)and(math_type(supscr(q))=empty)and@| begin cur_c:=a; a:=glue_kern_start(cur_f)(cur_i); {|cur_c|:=qi(|get_jfm_pos|(|math_kcode|(p), |fam_fnt|(fam(nucleus(p))+|cur_size|)));} - repeat cur_i:=font_info[a].qqqq; - if next_char(cur_i)=cur_c then + if skip_byte(cur_i)>stop_flag then {huge glue/kern table rearranged} + begin a:=glue_kern_restart(cur_f)(cur_i); + cur_i:=font_info[a].qqqq; + end; + loop@+ begin + if next_char(cur_i)=cur_c then if skip_byte(cur_i)<=stop_flag then if op_byte(cur_i)null then begin @@ -3953,8 +3962,10 @@ if (math_type(subscr(q))=empty)and(math_type(supscr(q))=empty)and@| else begin p:=new_kern(char_kern(cur_f)(cur_i)); link(p):=link(q); link(q):=p; return; end; - incr(a); - until skip_byte(cur_i)>=stop_flag; + if skip_byte(cur_i)>=stop_flag then return; + a:=a+qo(skip_byte(cur_i))+1; {SKIP property} + cur_i:=font_info[a].qqqq; + end; end; end; end; @@ -7223,8 +7234,12 @@ if inhibit_glue_flag<>true then goto skip_loop else begin if char_tag(main_i)=gk_tag then begin main_k:=glue_kern_start(main_f)(main_i); - repeat main_j:=font_info[main_k].qqqq; - if next_char(main_j)=cur_l then + main_j:=font_info[main_k].qqqq; + if skip_byte(main_j)>stop_flag then {huge glue/kern table rearranged} + begin main_k:=glue_kern_restart(main_f)(main_j); + main_j:=font_info[main_k].qqqq; + end; + loop@+begin if next_char(main_j)=cur_l then if skip_byte(main_j)<=stop_flag then begin if op_byte(main_j)null then @@ -7253,8 +7268,10 @@ if inhibit_glue_flag<>true then goto skip_loop; end; end; - incr(main_k); - until skip_byte(main_j)>=stop_flag; + if skip_byte(main_j)>=stop_flag then goto skip_loop; + main_k:=main_k+qo(skip_byte(main_j))+1; {SKIP property} + main_j:=font_info[main_k].qqqq; + end; end; end; end; diff --git a/Build/source/texk/web2c/ptexdir/ptftopl.ch b/Build/source/texk/web2c/ptexdir/ptftopl.ch index 97e670d78db..0aeb371f5a5 100644 --- a/Build/source/texk/web2c/ptexdir/ptftopl.ch +++ b/Build/source/texk/web2c/ptexdir/ptftopl.ch @@ -495,7 +495,7 @@ procedure out_kanji(jis_code:integer); { prints a kanji character } var @!cx:integer; {KANJI code} i:0..3; {index of array} begin@/ -if charcode_format=charcode_octal then +if (charcode_format=charcode_octal)or(jis_code<128) then begin cx:=jis_code; out('J '); {specify jiscode format} dig[0]:=Hi(cx) div 16; dig[1]:=Hi(cx) mod 16; dig[2]:=Lo(cx) div 16; dig[3]:=Lo(cx) mod 16; diff --git a/Build/source/texk/web2c/ptexdir/skipjfmp.test b/Build/source/texk/web2c/ptexdir/skipjfmp.test new file mode 100755 index 00000000000..3b2e3ec7e0b --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/skipjfmp.test @@ -0,0 +1,22 @@ +#! /bin/sh -vx +# $Id$ +# Copyright 2018 Karl Berry +# You may freely use, modify and/or distribute this file. + +test -d ptests || mkdir -p ptests + +# Test inputs +testdir=$srcdir/ptexdir/tests + +# Testing pPLtoTF/pTFtoPL for SKIP property in GLUEKERN. +for font in skipjfmp; do + + ./ppltotf -verbose $testdir/$font.pl ptests/x$font.tfm && \ + cmp $testdir/$font.tfm ptests/x$font.tfm && echo || exit 1 + + TEXMFCNF=$srcdir/../kpathsea \ + ./ptftopl -charcode-format octal -verbose $testdir/$font.tfm ptests/x$font.pl && \ + diff $testdir/$font.pl ptests/x$font.pl && echo || exit 1 + +done + diff --git a/Build/source/texk/web2c/ptexdir/tests/skipjfmp.pl b/Build/source/texk/web2c/ptexdir/tests/skipjfmp.pl new file mode 100644 index 00000000000..3d5f0bff790 --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/tests/skipjfmp.pl @@ -0,0 +1,159 @@ +(COMMENT THIS IS A KANJI FORMAT FILE) +(FAMILY JFM SKIP) +(FACE F MRR) +(CODINGSCHEME TEX KANJI TEXT) +(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.1) + (SHRINK R 0.0) + (XHEIGHT R 1.0) + (QUAD R 1.0) + (EXTRASPACE R 0.25) + (EXTRASTRETCH R 0.2) + (EXTRASHRINK R 0.125) + ) +(GLUEKERN + (LABEL O 0) + (GLUE O 1 R 0.5 R 0.0 R 0.0) + (GLUE O 2 R 0.5 R 0.0 R 0.01) + (GLUE O 6 R 0.5 R 0.0 R 0.02) + (GLUE O 3 R 0.25 R 0.0 R 0.03) + (GLUE O 4 R 0.25 R 0.0 R 0.04) + (STOP) + (LABEL O 1) + (GLUE O 4 R 0.25 R 0.0 R 0.05) + (SKIP D 19) + (LABEL O 2) + (GLUE O 3 R 0.25 R 0.0 R 0.06) + (SKIP D 16) + (LABEL O 3) + (GLUE O 1 R 0.25 R 0.0 R 0.07) + (GLUE O 2 R 0.25 R 0.0 R 0.08) + (GLUE O 6 R 0.25 R 0.0 R 0.09) + (GLUE O 0 R 0.25 R 0.0 R 0.1) + (SKIP D 4) + (LABEL O 4) + (GLUE O 0 R 0.25 R 0.0 R 0.11) + (GLUE O 1 R 0.25 R 0.0 R 0.12) + (GLUE O 2 R 0.25 R 0.0 R 0.13) + (GLUE O 6 R 0.25 R 0.0 R 0.14) + (GLUE O 3 R 0.5 R 0.0 R 0.15) + (GLUE O 4 R 0.5 R 0.0 R 0.16) + (GLUE O 5 R 0.25 R 0.0 R 0.17) + (STOP) + (LABEL O 5) + (KRN O 5 R 0.0) + (GLUE O 1 R 0.5 R 0.0 R 0.18) + (GLUE O 2 R 0.5 R 0.0 R 0.19) + (GLUE O 6 R 0.5 R 0.0 R 0.2) + (GLUE O 3 R 0.25 R 0.0 R 0.21) + (GLUE O 4 R 0.25 R 0.0 R 0.22) + (STOP) + (LABEL O 6) + (GLUE O 4 R 0.25 R 0.0 R 0.23) + (GLUE O 3 R 0.25 R 0.0 R 0.24) + (STOP) + ) +(CHARSINTYPE O 1 + J 214A + ) +(CHARSINTYPE O 2 + J 2156 + ) +(CHARSINTYPE O 3 + J 2127 + ) +(CHARSINTYPE O 4 + J 2128 + ) +(CHARSINTYPE O 5 + J 2144 + ) +(CHARSINTYPE O 6 + J 215A + ) +(TYPE O 0 + (CHARWD R 1.0) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (GLUE O 1 R 0.5 R 0.0 R 0.0) + (GLUE O 2 R 0.5 R 0.0 R 0.01) + (GLUE O 6 R 0.5 R 0.0 R 0.02) + (GLUE O 3 R 0.25 R 0.0 R 0.03) + (GLUE O 4 R 0.25 R 0.0 R 0.04) + ) + ) +(TYPE O 1 + (CHARWD R 0.5) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (GLUE O 4 R 0.25 R 0.0 R 0.05) + (GLUE O 3 R 0.25 R 0.0 R 0.24) + ) + ) +(TYPE O 2 + (CHARWD R 0.5) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (GLUE O 3 R 0.25 R 0.0 R 0.06) + (GLUE O 4 R 0.25 R 0.0 R 0.22) + ) + ) +(TYPE O 3 + (CHARWD R 0.5) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (GLUE O 1 R 0.25 R 0.0 R 0.07) + (GLUE O 2 R 0.25 R 0.0 R 0.08) + (GLUE O 6 R 0.25 R 0.0 R 0.09) + (GLUE O 0 R 0.25 R 0.0 R 0.1) + (GLUE O 3 R 0.5 R 0.0 R 0.15) + (GLUE O 4 R 0.5 R 0.0 R 0.16) + (GLUE O 5 R 0.25 R 0.0 R 0.17) + ) + ) +(TYPE O 4 + (CHARWD R 0.5) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (GLUE O 0 R 0.25 R 0.0 R 0.11) + (GLUE O 1 R 0.25 R 0.0 R 0.12) + (GLUE O 2 R 0.25 R 0.0 R 0.13) + (GLUE O 6 R 0.25 R 0.0 R 0.14) + (GLUE O 3 R 0.5 R 0.0 R 0.15) + (GLUE O 4 R 0.5 R 0.0 R 0.16) + (GLUE O 5 R 0.25 R 0.0 R 0.17) + ) + ) +(TYPE O 5 + (CHARWD R 1.0) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (KRN O 5 R 0.0) + (GLUE O 1 R 0.5 R 0.0 R 0.18) + (GLUE O 2 R 0.5 R 0.0 R 0.19) + (GLUE O 6 R 0.5 R 0.0 R 0.2) + (GLUE O 3 R 0.25 R 0.0 R 0.21) + (GLUE O 4 R 0.25 R 0.0 R 0.22) + ) + ) +(TYPE O 6 + (CHARWD R 0.5) + (CHARHT R 0.88) + (CHARDP R 0.12) + (COMMENT + (GLUE O 4 R 0.25 R 0.0 R 0.23) + (GLUE O 3 R 0.25 R 0.0 R 0.24) + ) + ) diff --git a/Build/source/texk/web2c/ptexdir/tests/skipjfmp.tex b/Build/source/texk/web2c/ptexdir/tests/skipjfmp.tex new file mode 100644 index 00000000000..274c5729bc9 --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/tests/skipjfmp.tex @@ -0,0 +1,33 @@ +\prebreakpenalty`…=0 +\postbreakpenalty`「=0 +\postbreakpenalty`【=0 +\postbreakpenalty`(=0 +\postbreakpenalty`:=0 +\postbreakpenalty`;=0 + +\tracingonline1 +\showboxdepth10000 +\showboxbreadth10000 + +\font\x=jis\x +\setbox0=\hbox{あ…あ「あ【あ(あ:あ;あ}\showbox0 +\box0 + +\font\y=skipjfmp at 9.62216pt\y +\setbox2=\hbox{あ…あ「あ【あ(あ:あ;あ}\showbox2 +\box2 + +\newfam\mx +\newfam\my +\textfont\mx=\x \scriptfont\mx=\x \scriptscriptfont\mx=\x +\textfont\my=\y \scriptfont\my=\y \scriptscriptfont\my=\y + +\jfam\mx +\setbox4=\hbox{$あ…あ「あ【あ(あ:あ;あ$}\showbox4 +\box4 + +\jfam\my +\setbox6=\hbox{$あ…あ「あ【あ(あ:あ;あ$}\showbox6 +\box6 + +\bye diff --git a/Build/source/texk/web2c/ptexdir/tests/skipjfmp.tfm b/Build/source/texk/web2c/ptexdir/tests/skipjfmp.tfm new file mode 100644 index 00000000000..1b6c4f18d07 Binary files /dev/null and b/Build/source/texk/web2c/ptexdir/tests/skipjfmp.tfm differ -- cgit v1.2.3