Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppltotf, makejvf, ptex: (GLUEKERN) support SKIP property and rearrangement #47

Merged
merged 14 commits into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/texk/makejvf/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2018-02-02 Hironobu Yamashita <[email protected]>

* tfmread.c: Support SKIP property in GLUEKERN table.
* write.c: Remove warning message on enhanced mode (hoping
well-tested).
* version.h: Bump version.
* tests/{gkhugeok,skipjfmp}.{tfm,vf}: New test files.
* Makefile.am, makejvf.test: Add new tests.

2018-01-27 Hironobu Yamashita <[email protected]>

* tfmread.c: Support new JFM spec (3-byte characters in TYPE > 0).
Expand Down
11 changes: 8 additions & 3 deletions source/texk/makejvf/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ EXTRA_DIST += \
tests/tmin10.tfm \
tests/tmin10.vf \
tests/testnewu.tfm \
tests/testnewu.vf

DISTCLEANFILES = min10.vf rml.tfm rmlv.tfm tmin10.vf testnewu.vf urml.tfm
tests/testnewu.vf \
tests/gkhugeok.tfm \
tests/gkhugeok.vf \
tests/skipjfmp.tfm \
tests/skipjfmp.vf

DISTCLEANFILES = min10.vf rml.tfm rmlv.tfm tmin10.vf testnewu.vf \
gkhugeok.vf skipjfmp.vf urml.tfm

7 changes: 5 additions & 2 deletions source/texk/makejvf/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,14 @@ LDADD = $(PTEXENC_LIBS) $(KPATHSEA_LIBS)
EXTRA_DIST = COPYRIGHT COPYRIGHT.jis Changes.txt README.txt \
tests/min10.tfm tests/min10.vf tests/rml.tfm tests/rmlv.tfm \
tests/tmin10.tfm tests/tmin10.vf tests/testnewu.tfm \
tests/testnewu.vf
tests/testnewu.vf tests/gkhugeok.tfm tests/gkhugeok.vf \
tests/skipjfmp.tfm tests/skipjfmp.vf
dist_check_SCRIPTS = makejvf.test
TESTS = makejvf.test
dist_man1_MANS = makejvf.1
DISTCLEANFILES = min10.vf rml.tfm rmlv.tfm tmin10.vf testnewu.vf urml.tfm
DISTCLEANFILES = min10.vf rml.tfm rmlv.tfm tmin10.vf testnewu.vf \
gkhugeok.vf skipjfmp.vf urml.tfm

all: c-auto.h
$(MAKE) $(AM_MAKEFLAGS) all-am

Expand Down
11 changes: 10 additions & 1 deletion source/texk/makejvf/makejvf.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@
cmp $srcdir/tests/tmin10.vf tmin10.vf && \
cmp $srcdir/tests/rmlv.tfm rmlv.tfm || exit 1

./makejvf -e -i -u custom -t $srcdir/tests/uni10.cnf -m $srcdir/tests/testnewu urml && \
# followings are supported in texjporg version
./makejvf -e -i -u custom -t $srcdir/tests/uni10.cnf $srcdir/tests/testnewu urml && \
cmp $srcdir/tests/testnewu.vf testnewu.vf && \
cmp $srcdir/tests/rml.tfm urml.tfm || exit 1

./makejvf -e -i -u custom -t $srcdir/tests/uni10.cnf $srcdir/tests/gkhugeok urml && \
cmp $srcdir/tests/gkhugeok.vf gkhugeok.vf && \
cmp $srcdir/tests/rml.tfm urml.tfm || exit 1

./makejvf -e $srcdir/tests/skipjfmp rml && \
cmp $srcdir/tests/skipjfmp.vf skipjfmp.vf && \
cmp $srcdir/tests/rml.tfm rml.tfm || exit 1

TEXMFCNF=$srcdir/../kpathsea \
./makejvf -k0 -a abc && exit 1

Expand Down
Binary file added source/texk/makejvf/tests/gkhugeok.tfm
Binary file not shown.
Binary file added source/texk/makejvf/tests/gkhugeok.vf
Binary file not shown.
Binary file added source/texk/makejvf/tests/skipjfmp.tfm
Binary file not shown.
Binary file added source/texk/makejvf/tests/skipjfmp.vf
Binary file not shown.
18 changes: 13 additions & 5 deletions source/texk/makejvf/tfmread.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ int jfmread(int kcode)
rightamount = 0;
if (w != zw && ctype > 0) {
/* get natural length of JFM glue between <type0> and <type of kcode> */
tag = char_info[ctype*4+2] % 4;
tag = char_info[0*4+2] % 4;
if (tag == 1) {
gk_ind = char_info[0*4+3]; /* remainder for <type0> */
if (glue_kern[gk_ind*4] == 254) /* support for large gluekern table */
if (glue_kern[gk_ind*4] > 128) /* huge gluekern table rearranged */
gk_ind = upair(&glue_kern[gk_ind*4+2]);
for (i = 0 ; i < nl-gk_ind ; i++) {
/* if rearrangement already handled ... */
if (glue_kern[gk_ind*4] > 128) break; /* ... skip loop */
if (glue_kern[(gk_ind+i)*4+1] == ctype) {
if (glue_kern[(gk_ind+i)*4+2] >= 128) {
gk2_ind = glue_kern[(gk_ind+i)*4+3];
Expand All @@ -45,17 +47,21 @@ int jfmread(int kcode)
}
break;
}
if (glue_kern[(gk_ind+i)*4] >= 128)
if (glue_kern[(gk_ind+i)*4] >= 128) /* end of program */
break;
else /* SKIP */
i += glue_kern[(gk_ind+i)*4];
}
}
/* get natural length of JFM glue between <type of kcode> and <type0> */
tag = char_info[ctype*4+2] % 4;
if (tag == 1) {
gk_ind = char_info[ctype*4+3]; /* remainder for <type of kcode> */
if (glue_kern[gk_ind*4] == 254) /* support for large gluekern table */
if (glue_kern[gk_ind*4] > 128) /* huge gluekern table rearranged */
gk_ind = upair(&glue_kern[gk_ind*4+2]);
for (i = 0 ; i < nl-gk_ind ; i++) {
/* if rearrangement already handled ... */
if (glue_kern[gk_ind*4] > 128) break; /* ... skip loop */
if (glue_kern[(gk_ind+i)*4+1] == 0) {
if (glue_kern[(gk_ind+i)*4+2] >= 128) {
gk2_ind = glue_kern[(gk_ind+i)*4+3];
Expand All @@ -67,8 +73,10 @@ int jfmread(int kcode)
}
break;
}
if (glue_kern[(gk_ind+i)*4] >= 128)
if (glue_kern[(gk_ind+i)*4] >= 128) /* end of program */
break;
else /* SKIP */
i += glue_kern[(gk_ind+i)*4];
}
}
if (abs(zw - ll - w - rr) <= 1) /* allow round-off error */
Expand Down
2 changes: 1 addition & 1 deletion source/texk/makejvf/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define VERSION "20180127"
#define VERSION "20180202"
#define BUG_ADDRESS "[email protected]"
32 changes: 20 additions & 12 deletions source/texk/makejvf/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,16 @@ void writevf(int code, FILE *fp)
goto outputj;
}
}
if (skip != -rightamount && enhanced) {
fprintf(stderr,
"[Warning] Conflicting MOVERIGHT value for code %x,\n"
"[Warning] makejvf default: %08x\n"
"[Warning] suggested from JFM: %08x <= I'll use this ...\n",
code, skip, -rightamount);
if (enhanced) {
#ifdef DEBUG
if (skip != -rightamount) {
fprintf(stderr,
"[DEBUG] Conflicting MOVERIGHT value for code %x,\n"
"[DEBUG] makejvf default: %08x\n"
"[DEBUG] suggested from JFM: %08x <= I'll use this ...\n",
code, skip, -rightamount);
}
#endif
skip=-rightamount;
}

Expand Down Expand Up @@ -722,12 +726,16 @@ void writevfu(int code, FILE *fp)
goto outputu;
}
}
if (skip != -rightamount && enhanced) {
fprintf(stderr,
"[Warning] Conflicting MOVERIGHT value for code %x,\n"
"[Warning] makejvf default: %08x\n"
"[Warning] suggested from JFM: %08x <= I'll use this ...\n",
code, skip, -rightamount);
if (enhanced) {
#ifdef DEBUG
if (skip != -rightamount) {
fprintf(stderr,
"[DEBUG] Conflicting MOVERIGHT value for code %x,\n"
"[DEBUG] makejvf default: %08x\n"
"[DEBUG] suggested from JFM: %08x <= I'll use this ...\n",
code, skip, -rightamount);
}
#endif
skip=-rightamount;
}

Expand Down
36 changes: 23 additions & 13 deletions source/texk/web2c/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,7 @@ EXTRA_DIST = PROJECTS cftests cpascal.h help.h w2c/config.h \
ptexdir/tests/goth10.tfm ptexdir/tests/sample.dvi \
ptexdir/tests/min10.pl ptexdir/tests/min10.tfm \
ptexdir/tests/tmin10.pl ptexdir/tests/tmin10.tfm \
ptexdir/tests/skipjfmp.pl ptexdir/tests/skipjfmp.tfm \
ptexdir/ptrip/ptrip.diffs ptexdir/ptrip/texmf.cnf \
$(eptex_web_srcs) $(eptex_ch_srcs) eptexdir/eptex.defines \
eptexdir/ChangeLog eptexdir/Changes.txt eptexdir/README.txt \
Expand All @@ -2404,6 +2405,8 @@ EXTRA_DIST = PROJECTS cftests cpascal.h help.h w2c/config.h \
uptexdir/tests/umin10.pl uptexdir/tests/umin10.tfm \
uptexdir/tests/utmin10.pl uptexdir/tests/utmin10.tfm \
uptexdir/tests/testnewu.pl uptexdir/tests/testnewu.tfm \
uptexdir/tests/uparse.pl uptexdir/tests/uparse.tfm \
uptexdir/tests/gkhugeok.tfm uptexdir/tests/gkhugeng.tfm \
uptexdir/uptrip/uptrip.diffs uptexdir/uptrip/texmf.cnf \
$(euptex_web_srcs) $(euptex_ch_srcs) euptexdir/euptex.defines \
euptexdir/COPYRIGHT euptexdir/COPYRIGHT.jis \
Expand Down Expand Up @@ -2685,22 +2688,23 @@ DISTCLEANFILES = CXXLD.sh tangle.c tangle.h tangle.p tangle-web2c \
ptests/xexampl.blg ptests/memtest.bib ptests/memtest?.* \
ptests/xstory.dvityp ptests/xpagenum.typ ptests/xcmr10.tfm \
ptests/xcmr10.pl ptests/xsample.typ ptests/x*min10.* \
ptrip.diffs $(nodist_eptex_SOURCES) eptex.web eptex.ch \
eptex-web2c eptex.p eptex.pool eptex-tangle eptrip.diffs \
pdfprimitive-eptex.* $(nodist_uptex_SOURCES) uptex.web \
uptex.ch uptex-web2c uptex.p uptex.pool uptex-tangle \
ptests/xskipjfmp.* ptrip.diffs $(nodist_eptex_SOURCES) \
eptex.web eptex.ch eptex-web2c eptex.p eptex.pool eptex-tangle \
eptrip.diffs pdfprimitive-eptex.* $(nodist_uptex_SOURCES) \
uptex.web uptex.ch uptex-web2c uptex.p uptex.pool uptex-tangle \
$(upweb_programs:=.c) $(upweb_programs:=.h) \
$(upweb_programs:=.p) $(upweb_programs:=-web2c) \
$(upweb_programs:=.web) uptests/xexampl.aux \
uptests/xexampl.bbl uptests/xexampl.blg uptests/xstory.dvityp \
uptests/xpagenum.typ uptests/xcmr10.tfm uptests/xcmr10.pl \
uptests/x*min10.* uptests/xtestnewu.* uptrip.diffs \
$(nodist_euptex_SOURCES) euptex.web euptex.ch euptex-web2c \
euptex.p euptex.pool euptex-tangle euptrip.diffs \
pdfprimitive-euptex.* $(nodist_pdftex_SOURCES) pdftex.ch \
pdftex-web2c pdftex.p pdftex.pool pdftex-tangle pwprob.log \
pwprob.tex pdfimage.fmt pdfimage.log pdfimage.pdf postV3.afm \
postV7.afm test-13.pdf test-13.xref test-15.pdf test-15.xref \
uptests/x*min10.* uptests/xtestnewu.* uptests/*uparse.* \
uptests/*gkhuge*.* uptrip.diffs $(nodist_euptex_SOURCES) \
euptex.web euptex.ch euptex-web2c euptex.p euptex.pool \
euptex-tangle euptrip.diffs pdfprimitive-euptex.* \
$(nodist_pdftex_SOURCES) pdftex.ch pdftex-web2c pdftex.p \
pdftex.pool pdftex-tangle pwprob.log pwprob.tex pdfimage.fmt \
pdfimage.log pdfimage.pdf postV3.afm postV7.afm test-13.pdf \
test-13.xref test-15.pdf test-15.xref \
$(nodist_libluatex_sources) luaimage.* luajitimage.* \
$(nodist_xetex_SOURCES) xetex.web xetex.ch xetex-web2c xetex.p \
xetex.pool xetex-tangle bug73.fmt bug73.log bug73.out \
Expand Down Expand Up @@ -3150,7 +3154,8 @@ pweb_tests = ptexdir/pbibtex.test ptexdir/pdvitype.test \
ptexdir/ppltotf.test ptexdir/ptftopl.test \
ptexdir/pbibtex-openout-test.pl \
ptexdir/pbibtex-longline-test.pl ptexdir/pbibtex-mem.test \
ptexdir/nissya.test ptexdir/sample.test ptexdir/yokotate.test
ptexdir/nissya.test ptexdir/sample.test ptexdir/yokotate.test \
ptexdir/skipjfmp.test
eptex_CPPFLAGS = $(PTEXENC_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/libmd5 \
$(am__append_135)

Expand Down Expand Up @@ -3251,7 +3256,9 @@ upweb_tests = \
uptexdir/uppltotf.test \
uptexdir/uptftopl.test \
uptexdir/yokotate.test \
uptexdir/newjfm.test
uptexdir/newjfm.test \
uptexdir/uparse.test \
uptexdir/gkhuge.test

euptex_CPPFLAGS = $(PTEXENC_INCLUDES) $(AM_CPPFLAGS) \
-I$(srcdir)/libmd5 $(am__append_139)
Expand Down Expand Up @@ -17448,6 +17455,7 @@ 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)
ptrip.diffs: ptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
$(triptrap_diffs) $@
.PHONY: ptrip-clean
Expand Down Expand Up @@ -17555,6 +17563,8 @@ uptexdir/uppltotf.log: uppltotf$(EXEEXT)
uptexdir/uptftopl.log: uptftopl$(EXEEXT)
uptexdir/yokotate.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
uptexdir/newjfm.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
uptexdir/uparse.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
uptexdir/gkhuge.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
uptrip.diffs: uptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
$(triptrap_diffs) $@
.PHONY: uptrip-clean
Expand Down
13 changes: 13 additions & 0 deletions source/texk/web2c/ptexdir/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2018-02-02 Hironobu Yamashita <[email protected]>

* 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 <[email protected]>

* ptex-base.ch: Fix issue GitHub:texjporg/tex-jp-build#40
Expand Down
6 changes: 6 additions & 0 deletions source/texk/web2c/ptexdir/am/ptex.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## texk/web2c/ptexdir/am/ptex.am: Makefile fragment for pTeX.
##
## Copyright (C) 2016-2018 Karl Berry <[email protected]>
## Copyright (C) 2010-2015 Peter Breitenlohner <[email protected]>
## You may freely use, modify and/or distribute this file.

Expand Down Expand Up @@ -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) \
Expand Down Expand Up @@ -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)
Expand Down
26 changes: 20 additions & 6 deletions source/texk/web2c/ptexdir/ppltotf.ch
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ incr(current_option);
We need to include some routines for handling kanji characters.

@<Constants...@>=
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}

Expand Down Expand Up @@ -439,6 +440,7 @@ if cur_code=comment_code then skip_to_end_of_item
else begin case cur_code of
label_code:@<Read a glue label step@>;
stop_code:@<Read a stop step@>;
skip_code:@<Read a skip step@>;
krn_code:@<Read a (glue) kerning step@>;
glue_code:@<Read a glue step@>;
others:
Expand Down Expand Up @@ -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}
@<Scan a Kanji hexadecimal 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');
Expand All @@ -702,5 +702,19 @@ else jis_code:=-1;
get_kanji:=jis_code;
end;

@ @<Scan a Kanji hex...@>=
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
Loading