Skip to content

Commit

Permalink
dvips: VF fallback to OFM for (u)pTeX
Browse files Browse the repository at this point in the history
The rule for virtual fonts (VF) fallback is extended:
If a VF has no entry of a codepoint and the first
MAPFONT designates an OFM for (u)pTeX, then we designate the
glyph (usually with a fullwidth metric) of the same codepoint
with the same metrics of the codepoint in the OFM.

git-svn-id: svn://tug.org/texlive/trunk/Build/source@66966 c570f23f-e606-0410-a88d-b1316a301751
  • Loading branch information
t-tk committed Apr 29, 2023
1 parent eb706d4 commit 7a91b32
Show file tree
Hide file tree
Showing 21 changed files with 5,939 additions and 28 deletions.
18 changes: 18 additions & 0 deletions texk/dvipsk/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
2023-04-29 TANAKA Takuji <ttk@t-lab.opal.ne.jp>

* {virtualfont,pprescan,scanpage,dopage,tfmload}.c, dvips.h:
Fallback multibyte characters in virtual fonts to
OFM fonts for (u)pTeX.
https://github.com/texjporg/tex-jp-build/issues/99
* tfmload.c: Accept maximum EC 0x10FFFF for OFM level 1.
* uptex-vf.test, Makefile_upjf, testdata/upjf-r00.{ofm,opl},
testdata/upjv-r00.{ofm,opl}, testdata/upjf1-r.{tfm,pl},
testdata/upjf1_{full,omit}.{vf,zvp0}, Makefile.am:
Add new tests for fallback virtual font to OFM.

The rule for virtual fonts (VF) fallback is extended:
If a VF has no entry of a codepoint and the first
MAPFONT designates an OFM for (u)pTeX, then we designate the
glyph (usually with a fullwidth metric) of the same codepoint
with the same metrics of the codepoint in the OFM.

2023-03-09 Karl Berry <karl@tug.org>

* TL'23 release.
Expand Down
7 changes: 6 additions & 1 deletion texk/dvipsk/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ EXTRA_DIST += testdata/Makefile_upjf testdata/upjf.tex testdata/upjf.dvi testdat
testdata/upjv_full.vf testdata/upjv_omit.vf \
testdata/upjf-g00.opl testdata/upjf-g00.ofm \
testdata/upjv-g00.opl testdata/upjv-g00.ofm \
testdata/upjf-r00.opl testdata/upjf-r00.ofm \
testdata/upjv-r00.opl testdata/upjv-r00.ofm \
testdata/upjf1-r.pl testdata/upjf1-r.tfm \
testdata/upjf1_full.zvp0 testdata/upjf1_full.vf \
testdata/upjf1_omit.zvp0 testdata/upjf1_omit.vf \
testdata/upjf_full.cnf testdata/upjf_omit.cnf
DISTCLEANFILES += upjf.vf upjv.vf upjf-g.ofm upjv-g.ofm upjf_full.ps upjf_omit.ps
DISTCLEANFILES += upjf.vf upjv.vf upjf-*.ofm upjv-*.ofm upjf-*.tfm upjf*_full.ps upjf*_omit*.ps

EXTRA_DIST += \
NEWS \
Expand Down
24 changes: 14 additions & 10 deletions texk/dvipsk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ DISTCLEANFILES = $(DVIS) $(PSS) beginfontk1.ps eepic-nan.ps pfbincl.ps \
*badnews* same-name.out afmtest.tfm dvipstst.ps missfont.log \
mtest.ps missing-image.ps overflow-color-push.ps \
overflow-epsfile.ps overflow-psbox.ps upjf.vf upjv.vf \
upjf-g.ofm upjv-g.ofm upjf_full.ps upjf_omit.ps
upjf-*.ofm upjv-*.ofm upjf-*.tfm upjf*_full.ps upjf*_omit*.ps
enc_DATA = dvips-all.enc
prolog_DATA = $(prologues)
dist_prologues = \
Expand Down Expand Up @@ -766,15 +766,19 @@ EXTRA_DIST = $(dist_prologues) texc.script $(TESTS) testdata/8r.enc \
testdata/upjv-r.tfm testdata/upjv_full.vf \
testdata/upjv_omit.vf testdata/upjf-g00.opl \
testdata/upjf-g00.ofm testdata/upjv-g00.opl \
testdata/upjv-g00.ofm testdata/upjf_full.cnf \
testdata/upjf_omit.cnf NEWS TODO testdata/intoverflow.dvi \
testdata/vfnameoverflow.dvi atari cmfonts.map config.ps \
contrib/afm-extra contrib/colorsep.lpro contrib/configs \
contrib/crop.lpr contrib/latex209 contrib/treen.sh \
contrib/treen2.sh contrib/volker contrib/whichinpath \
cyrfonts.map eufonts.map flib.c hps/CHANGES_HPS.txt \
hps/README_HPS.txt lafonts.map makefont.c mvs psfonts.map tex \
vmcms vms
testdata/upjv-g00.ofm testdata/upjf-r00.opl \
testdata/upjf-r00.ofm testdata/upjv-r00.opl \
testdata/upjv-r00.ofm testdata/upjf1-r.pl testdata/upjf1-r.tfm \
testdata/upjf1_full.zvp0 testdata/upjf1_full.vf \
testdata/upjf1_omit.zvp0 testdata/upjf1_omit.vf \
testdata/upjf_full.cnf testdata/upjf_omit.cnf NEWS TODO \
testdata/intoverflow.dvi testdata/vfnameoverflow.dvi atari \
cmfonts.map config.ps contrib/afm-extra contrib/colorsep.lpro \
contrib/configs contrib/crop.lpr contrib/latex209 \
contrib/treen.sh contrib/treen2.sh contrib/volker \
contrib/whichinpath cyrfonts.map eufonts.map flib.c \
hps/CHANGES_HPS.txt hps/README_HPS.txt lafonts.map makefont.c \
mvs psfonts.map tex vmcms vms
CLEANFILES = $(prologues) texc.lpro
TEST_EXTENSIONS = .pl .test
TESTS = test-afm2tfm.test beginfontk1.test eepic-nan.test pfbincl.test \
Expand Down
27 changes: 19 additions & 8 deletions texk/dvipsk/dopage.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,30 @@ case 128: cmd = dvibyte(); /* set1 command drops through to setchar */
if (!noptex && mychar<0x1000000 && curfnt->loaded == 2 && curfnt->kind == VF_PTEX) {
if (mychar>=curfnt->maxchars || !(cd->flags & EXISTS)) {
/* try fallback */
chardesctype *cd0;
cd0 = curfnt->localfonts->desc->chardesc;
int kind0 = curfnt->localfonts->desc->kind;
if (mychar<curfnt->localfonts->desc->maxchars && (cd0[mychar].flags & EXISTS)) {
#ifdef DEBUG
if (dd(D_FONTS))
fprintf_str(stderr,
"Fallback pTeX vf:%s char=%d(0x%06x) to %s\n",
curfnt->name, mychar, mychar, curfnt->localfonts->desc->name);
if (dd(D_FONTS))
fprintf_str(stderr,
"Fallback pTeX vf:%s char=%d(0x%06x) to %s:%s\n",
curfnt->name, mychar, mychar, kind0==OFM_OMEGA ? "ofm" : "tfm",
curfnt->localfonts->desc->name);
#endif /* DEBUG */
cd = curfnt->localfonts->desc->chardesc;
cd0 = &(cd0[mychar]);
} else {
fprintf_str(stderr,
"Warning: Failed to fallback pTeX vf:%s char=%d(0x%06x) to %s:%s\n",
curfnt->name, mychar, mychar, kind0==OFM_OMEGA ? "ofm" : "tfm",
curfnt->localfonts->desc->name);
}
if (charmove) {
if (!dir) {
sp->hh = hh + cd->pixelwidth;
sp->h = h + cd->TFMwidth;
sp->hh = hh + cd0->pixelwidth;
sp->h = h + cd0->TFMwidth;
} else {
sp->v = v + cd->TFMwidth;
sp->v = v + cd0->TFMwidth;
sp->vv = PixRound(sp->v);
}
} else {
Expand Down
3 changes: 3 additions & 0 deletions texk/dvipsk/dvips.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ typedef struct tfd {
#define VF_TEX (1)
#define VF_OMEGA (2)
#define VF_PTEX (3)
#define TFM_TEX (0x000)
#define OFM_OMEGA (0x100)
#define JFM_PTEX (0x200)

/* A fontmap associates a fontdesc with a font number.
*/
Expand Down
5 changes: 3 additions & 2 deletions texk/dvipsk/pprescan.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ case 128: case 133: cmd = dvibyte(); /* set1, put1 commands drops through */
#ifdef DEBUG
if (dd(D_FONTS))
fprintf_str(stderr,
"We will fallback pTeX vf:%s to %s\n",
curfnt->name, curfnt->localfonts->desc->name);
"We will fallback pTeX vf:%s to %s:%s\n",
curfnt->name, curfnt->localfonts->desc->kind==OFM_OMEGA ? "ofm" : "tfm",
curfnt->localfonts->desc->name);
#endif /* DEBUG */
} else {
fprintf(stderr, "Wrong char code: %04X\n", mychar);
Expand Down
5 changes: 3 additions & 2 deletions texk/dvipsk/scanpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ case 128: case 133: cmd = dvibyte(); /* set1, put1 commands drops through */
#ifdef DEBUG
if (dd(D_FONTS))
fprintf_str(stderr,
"We will fallback pTeX vf:%s to %s\n",
curfnt->name, curfnt->localfonts->desc->name);
"We will fallback pTeX vf:%s to %s:%s\n",
curfnt->name, curfnt->localfonts->desc->kind==OFM_OMEGA ? "ofm" : "tfm",
curfnt->localfonts->desc->name);
#endif /* DEBUG */
} else {
fprintf(stderr, "Wrong char code: %04X\n", mychar);
Expand Down
15 changes: 15 additions & 0 deletions texk/dvipsk/testdata/Makefile_upjf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ upjf-g00.ofm:
upjv-g00.ofm:
opl2ofm upjv-g00.opl

upjf-r00.ofm:
opl2ofm upjf-r00.opl

upjv-r00.ofm:
opl2ofm upjv-r00.opl

upjf1-r.tfm:
uppltotf upjf1-r.pl

upjf1_full.vf:
jfmutil zvp02vf upjf1_full.zvp0

upjf1_omit.vf:
jfmutil zvp02vf upjf1_omit.zvp0

upjf.dvi: upjf.tex
uplatex upjf.tex
dvispc -a upjf.dvi upjf.dvitxt
Expand Down
Binary file added texk/dvipsk/testdata/upjf-r00.ofm
Binary file not shown.
38 changes: 38 additions & 0 deletions texk/dvipsk/testdata/upjf-r00.opl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(OFMLEVEL H 1)
(FONTDIR TL)
(FAMILY UPJF)
(FACE F MRR)
(CODINGSCHEME UNSPECIFIED)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM H 0)
(SEVENBITSAFEFLAG FALSE)
(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)
)
(CHARACTER H 6674
(CHARWD R 1.0)
(CHARHT R 0.9)
(CHARDP R 0.1)
)
(CHARACTER H 96EA
(CHARWD R 1.0)
(CHARHT R 0.9)
(CHARDP R 0.1)
)
(CHARREPEAT H FF00 H FF
(CHARWD R 0.5)
(CHARHT R 0.9)
(CHARDP R 0.1)
)
(CHARACTER H 20B9F
(CHARWD R 1.0)
(CHARHT R 0.9)
(CHARDP R 0.1)
)
35 changes: 35 additions & 0 deletions texk/dvipsk/testdata/upjf1-r.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(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)
)
(CHARSINTYPE O 1
。 「 」 、 ・ ヲ ァ ィ ゥ ェ
ォ ャ ュ ョ ッ ー ア イ ウ エ
オ カ キ ク ケ コ サ シ ス セ
ソ タ チ ツ テ ト ナ ニ ヌ ネ
ノ ハ ヒ フ ヘ ホ マ ミ ム メ
モ ヤ ユ ヨ ラ リ ル レ ロ ワ
ン ゙ ゚
)
(TYPE O 0
(CHARWD R 1.0)
(CHARHT R 0.9)
(CHARDP R 0.1)
)
(TYPE O 1
(CHARWD R 0.5)
(CHARHT R 0.9)
(CHARDP R 0.1)
)
Binary file added texk/dvipsk/testdata/upjf1-r.tfm
Binary file not shown.
Binary file added texk/dvipsk/testdata/upjf1_full.vf
Binary file not shown.
Loading

0 comments on commit 7a91b32

Please sign in to comment.