Skip to content

Commit

Permalink
dvipdfm-x: Ensure enc_name "UTF16" prior to encoding conversion
Browse files Browse the repository at this point in the history
git-svn-id: svn://tug.org/texlive/trunk/Build/source@71232 c570f23f-e606-0410-a88d-b1316a301751
  • Loading branch information
t-tk committed May 11, 2024
1 parent de8947d commit e47512f
Show file tree
Hide file tree
Showing 19 changed files with 6,130 additions and 27 deletions.
12 changes: 12 additions & 0 deletions texk/dvipdfm-x/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2024-05-11 TANAKA Takuji <ttk@t-lab.opal.ne.jp>

* dvi.c: Ensure enc_name "UTF16" prior to encoding conversion
from UTF32 to UTF16.
* dvipdfmx-upjf3.test, tests/upjf3.{tex,dvi},
tests/upj{f,v}-h{u,i}.tfm,
tests/upj{f,v}3_full.{vf,zvp0}, tests/upjf-noto.map,
tests/Makefile_upjf, Makefile.am: Add a test for
upTeX new encoding. It requires Noto Hentaigana fonts.
https://github.com/texjporg/tex-jp-build/issues/46
* configure.ac: version 20240511.

2024-04-29 TANAKA Takuji <ttk@t-lab.opal.ne.jp>

* tfm.c: Fix segfaults.
Expand Down
12 changes: 10 additions & 2 deletions texk/dvipdfm-x/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ DISTCLEANFILES = config.force
TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bad.test xdvipdfm-bb.test
TESTS += xdvipdfm-bkm.test xdvipdfm-psz.test xdvipdfm-ptx.test xdvipdfm-res.test
TESTS += xdvipdfm-rev.test xdvipdfm-ttc.test
TESTS += dvipdfmx-upjf.test dvipdfmx-upjf2.test dvipdfmx-incl.test
TESTS += dvipdfmx-upjf.test dvipdfmx-upjf2.test dvipdfmx-upjf3.test dvipdfmx-incl.test
xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bad.log xdvipdfm-bb.log \
xdvipdfm-bkm.log xdvipdfm-psz.log xdvipdfm-ptx.log xdvipdfm-res.log \
xdvipdfm-rev.log xdvipdfm-ttc.log \
dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-incl.log: \
dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-upjf3.log dvipdfmx-incl.log: \
xdvipdfmx$(EXEEXT)
EXTRA_DIST = $(TESTS)
## xdvipdfmx.test
Expand Down Expand Up @@ -314,7 +314,15 @@ EXTRA_DIST += tests/upjf2_full.zvp0 tests/upjf2_full.vf
EXTRA_DIST += tests/upjv2_full.zvp0 tests/upjv2_full.vf
EXTRA_DIST += tests/upjf-c.pl tests/upjf-c.tfm
EXTRA_DIST += tests/upjv-c.pl tests/upjv-c.tfm
EXTRA_DIST += tests/upjf-hara.map
DISTCLEANFILES += upjf2_*.pdf
## dvipdfmx-upjf3.test
EXTRA_DIST += tests/upjf3_full.zvp0 tests/upjf3_full.vf
EXTRA_DIST += tests/upjv3_full.zvp0 tests/upjv3_full.vf
EXTRA_DIST += tests/upjf-hu.tfm tests/upjf-hi.tfm
EXTRA_DIST += tests/upjv-hu.tfm tests/upjv-hi.tfm
EXTRA_DIST += tests/upjf-noto.map
DISTCLEANFILES += upjf3_*.pdf
## dvipdfmx-incl.test
EXTRA_DIST += tests/multi_incl.dvi tests/multi_incl.tex tests/sue-mp.pdf
DISTCLEANFILES += multi_incl.pdf
Expand Down
13 changes: 8 additions & 5 deletions texk/dvipdfm-x/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -822,12 +822,12 @@ dist_cmapdata_DATA = data/EUC-UCS2
DISTCLEANFILES = config.force image*.pdf xbmc*.pdf annot*.pdf pic*.* \
bookm*.pdf paper*.pdf ptex*.pdf resrc*.pdf reverse.pdf \
ttc*.pdf upjf.vf upjv.vf upjf-*.ofm upjv-*.ofm upjf-*.tfm \
upjf_*.pdf upjf1_*.pdf upjf2_*.pdf multi_incl.pdf
upjf_*.pdf upjf1_*.pdf upjf2_*.pdf upjf3_*.pdf multi_incl.pdf
TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bad.test \
xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-psz.test \
xdvipdfm-ptx.test xdvipdfm-res.test xdvipdfm-rev.test \
xdvipdfm-ttc.test dvipdfmx-upjf.test dvipdfmx-upjf2.test \
dvipdfmx-incl.test
dvipdfmx-upjf3.test dvipdfmx-incl.test
EXTRA_DIST = $(TESTS) tests/dvipdfmx.cfg tests/psfonts.map \
tests/cmr10.pfb tests/cmr10.tfm tests/image.dvi \
tests/image.tex tests/xbmc.dvi tests/xbmc.tex \
Expand Down Expand Up @@ -857,8 +857,11 @@ EXTRA_DIST = $(TESTS) tests/dvipdfmx.cfg tests/psfonts.map \
tests/upjf2_full.zvp0 tests/upjf2_full.vf \
tests/upjv2_full.zvp0 tests/upjv2_full.vf tests/upjf-c.pl \
tests/upjf-c.tfm tests/upjv-c.pl tests/upjv-c.tfm \
tests/multi_incl.dvi tests/multi_incl.tex tests/sue-mp.pdf \
tests/fullmap.dvi tests/fullmap.tex
tests/upjf-hara.map tests/upjf3_full.zvp0 tests/upjf3_full.vf \
tests/upjv3_full.zvp0 tests/upjv3_full.vf tests/upjf-hu.tfm \
tests/upjf-hi.tfm tests/upjv-hu.tfm tests/upjv-hi.tfm \
tests/upjf-noto.map tests/multi_incl.dvi tests/multi_incl.tex \
tests/sue-mp.pdf tests/fullmap.dvi tests/fullmap.tex
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am

Expand Down Expand Up @@ -2030,7 +2033,7 @@ config.force: $(ZLIB_DEPEND) $(LIBPNG_DEPEND) $(KPATHSEA_DEPEND) $(LIBPAPER_DEPE
xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bad.log xdvipdfm-bb.log \
xdvipdfm-bkm.log xdvipdfm-psz.log xdvipdfm-ptx.log xdvipdfm-res.log \
xdvipdfm-rev.log xdvipdfm-ttc.log \
dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-incl.log: \
dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-upjf3.log dvipdfmx-incl.log: \
xdvipdfmx$(EXEEXT)

# Tell versions [3.59,3.63) of GNU make to not export all variables.
Expand Down
22 changes: 11 additions & 11 deletions texk/dvipdfm-x/configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20240429.
# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20240511.
#
# Report bugs to <dvipdfmx@tug.org>.
#
Expand Down Expand Up @@ -614,8 +614,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dvipdfm-x (TeX Live)'
PACKAGE_TARNAME='dvipdfm-x--tex-live-'
PACKAGE_VERSION='20240429'
PACKAGE_STRING='dvipdfm-x (TeX Live) 20240429'
PACKAGE_VERSION='20240511'
PACKAGE_STRING='dvipdfm-x (TeX Live) 20240511'
PACKAGE_BUGREPORT='dvipdfmx@tug.org'
PACKAGE_URL=''

Expand Down Expand Up @@ -1383,7 +1383,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures dvipdfm-x (TeX Live) 20240429 to adapt to many kinds of systems.
'configure' configures dvipdfm-x (TeX Live) 20240511 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1455,7 +1455,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20240429:";;
short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20240511:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1586,7 +1586,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
dvipdfm-x (TeX Live) configure 20240429
dvipdfm-x (TeX Live) configure 20240511
generated by GNU Autoconf 2.72

Copyright (C) 2023 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2367,7 +2367,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by dvipdfm-x (TeX Live) $as_me 20240429, which was
It was created by dvipdfm-x (TeX Live) $as_me 20240511, which was
generated by GNU Autoconf 2.72. Invocation command line was

$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -9080,7 +9080,7 @@ fi

# Define the identity of the package.
PACKAGE='dvipdfm-x--tex-live-'
VERSION='20240429'
VERSION='20240511'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -16159,7 +16159,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."

lt_cl_version="\
dvipdfm-x (TeX Live) config.lt 20240429
dvipdfm-x (TeX Live) config.lt 20240511
configured by $0, generated by GNU Autoconf 2.72.

Copyright (C) 2011 Free Software Foundation, Inc.
Expand Down Expand Up @@ -18102,7 +18102,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by dvipdfm-x (TeX Live) $as_me 20240429, which was
This file was extended by dvipdfm-x (TeX Live) $as_me 20240511, which was
generated by GNU Autoconf 2.72. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -18174,7 +18174,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
dvipdfm-x (TeX Live) config.status 20240429
dvipdfm-x (TeX Live) config.status 20240511
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion texk/dvipdfm-x/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
AC_INIT([dvipdfm-x (TeX Live)], [20240429], [dvipdfmx@tug.org])
AC_INIT([dvipdfm-x (TeX Live)], [20240511], [dvipdfmx@tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([agl.c])
AC_CONFIG_AUX_DIR([../../build-aux])
Expand Down
13 changes: 9 additions & 4 deletions texk/dvipdfm-x/dvi.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ static unsigned lr_width_stack_depth = 0;
#define DVI 1
#define VF 2

#define ENC_UNICODE 1
#define ENC_UTF16 2

struct gm {
spt_t advance, ascent, descent;
};
Expand Down Expand Up @@ -1142,14 +1145,16 @@ dvi_locate_font (const char *tfm_name, spt_t ptsize)
memset(loaded_fonts[cur_id].padbytes, 0, 4);
if (mrec) {
if (mrec->opt.mapc >= 0) {
loaded_fonts[cur_id].padbytes[2] = (mrec->opt.mapc >> 8) & 0xff;
loaded_fonts[cur_id].padbytes[2] = (mrec->opt.mapc >> 8) & 0xff;
}
if (mrec->enc_name && !strcmp(mrec->enc_name, "unicode")) {
loaded_fonts[cur_id].is_unicode = 1;
loaded_fonts[cur_id].is_unicode = ENC_UNICODE;
if (mrec->opt.mapc >= 0) {
loaded_fonts[cur_id].padbytes[0] = (mrec->opt.mapc >> 24) & 0xff;
loaded_fonts[cur_id].padbytes[1] = (mrec->opt.mapc >> 16) & 0xff;
}
} else if (mrec->enc_name && strstr(mrec->enc_name, "UTF16") != NULL) {
loaded_fonts[cur_id].is_unicode = ENC_UTF16;
}
}
loaded_fonts[cur_id].minbytes = pdf_dev_font_minbytes(font_id);
Expand Down Expand Up @@ -1473,7 +1478,7 @@ dvi_set (int32_t ch)
case PHYSICAL:
if (ch > 65535) {
/* FIXME: uptex specific undocumented */
if (!font->is_unicode && tfm_is_jfm(font->tfm_id)) {
if (font->is_unicode == ENC_UTF16 && tfm_is_jfm(font->tfm_id)) {
wbuf[0] = (UTF32toUTF16HS(ch) >> 8) & 0xff;
wbuf[1] = UTF32toUTF16HS(ch) & 0xff;
wbuf[2] = (UTF32toUTF16LS(ch) >> 8) & 0xff;
Expand Down Expand Up @@ -1564,7 +1569,7 @@ dvi_put (int32_t ch)
*/
if (ch > 65535) {
/* FIXME: uptex specific undocumented */
if (!font->is_unicode && tfm_is_jfm(font->tfm_id)) {
if (font->is_unicode == ENC_UTF16 && tfm_is_jfm(font->tfm_id)) {
wbuf[0] = (UTF32toUTF16HS(ch) >> 8) & 0xff;
wbuf[1] = UTF32toUTF16HS(ch) & 0xff;
wbuf[2] = (UTF32toUTF16LS(ch) >> 8) & 0xff;
Expand Down
50 changes: 50 additions & 0 deletions texk/dvipdfm-x/dvipdfmx-upjf3.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#! /bin/sh -vx
# $Id$
# Copyright 2020-2024 Japanese TeX Development Community <issue@texjp.org>
# You may freely use, modify and/or distribute this file.

KpsDir=${KpsDir:-../kpathsea}
BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_kpsewhich=$KpsDir/kpsewhich$ExeExt
_xdvipdfmx=$BinDir/xdvipdfmx$ExeExt

TEXMFCNF=$srcdir/../kpathsea
TFMFONTS=".;$srcdir/tests;$srcdir/data"
T1FONTS="$srcdir/tests;$srcdir/data"
TEXFONTMAPS="$srcdir/tests;$srcdir/data"
DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
TEXPICTS=$srcdir/tests
TEXFONTS=".;$srcdir/tests"
SOURCE_DATE_EPOCH=1588474800
export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS TEXFONTS SOURCE_DATE_EPOCH

failed=

##### following tests require HaranoAji fonts and Noto Hentaigana font #####

$_kpsewhich HaranoAjiMincho-Regular.otf
otfpath=`$_kpsewhich HaranoAjiMincho-Regular.otf` || exit 77
OPENTYPEFONTS=`echo $otfpath | sed -e 's,HaranoAjiMincho-Regular\.otf,,' -e 's,/fonts/opentype/.*$,/fonts/opentype//,'`
export OPENTYPEFONTS

$_kpsewhich NotoSerifHentaigana-Regular.ttf
ttfpath=`$_kpsewhich NotoSerifHentaigana-Regular.ttf` || exit 77
TTFONTS=`echo $ttfpath | sed -e 's,NotoSerifHentaigana-Regular\.ttf,,' -e 's,/fonts/truetype/.*$,/fonts/truetype//,'`
export TTFONTS

rm -f upjf.vf upjv.vf upjf-r.ofm upjv-r.ofm upjf-g.ofm upjv-g.ofm

echo "*** dvipdfmx: test for upjf3_full-noto.pdf" && echo \
&& cp $srcdir/tests/upjf3_full.vf ./upjf.vf \
&& cp $srcdir/tests/upjv3_full.vf ./upjv.vf \
&& $_xdvipdfmx --dvipdfmx -vv --pdfm-str-utf8 -f upjf-noto.map -o upjf3.pdf $srcdir/tests/upjf3.dvi \
&& mv ./upjf3.pdf ./upjf3_full-noto.pdf \
&& echo && echo "dvipdfmx-upjf3-vf_full-noto tests OK" && echo \
|| failed="$failed dvipdfmx-upjf3-vf_full-noto"


test -z "$failed" && exit 0
echo
echo "failed tests:$failed"
exit 1
22 changes: 18 additions & 4 deletions texk/dvipdfm-x/tests/Makefile_upjf
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,24 @@ upjv-r00.ofm:
upjf1-r.tfm:
uppltotf upjf1-r.pl

upjf1_full.vf:
upjf1_full.vf: upjf1_full.zvp0
jfmutil zvp02vf upjf1_full.zvp0

upjf1_omit.vf:
upjf1_omit.vf: upjf1_omit.zvp0
jfmutil zvp02vf upjf1_omit.zvp0

upjf2_full.vf:
upjf2_full.vf: upjf2_full.zvp0
jfmutil zvp02vf upjf2_full.zvp0

upjv2_full.vf:
upjv2_full.vf: upjv2_full.zvp0
jfmutil zvp02vf upjv2_full.zvp0

upjf3_full.vf: upjf3_full.zvp0
jfmutil zvp02vf upjf3_full.zvp0

upjv3_full.vf: upjv3_full.zvp0
jfmutil zvp02vf upjv3_full.zvp0

upjf-c.tfm:
uppltotf upjf-c.pl

Expand All @@ -75,3 +81,11 @@ upjf2.dvi: upjf2.tex
dvispc -x upjf2.dvitxt upjf2.dvi
rm upjf2.dvitxt

upjf3.dvi: upjf3.tex
uplatex upjf3.tex
dvispc -a upjf3.dvi upjf3.dvitxt
sed -i '/xxx/d' upjf3.dvitxt
sed -i -e "4i xxx1 176 'pdf:docinfo<</Title(upTeXを試す)/Subject(시험)/Creator(LaTeX with hyperref)/Author(☃ ☀)/Producer(dvipdfm)/Keywords(超鏈接; ハイパーリンク; 하이퍼링크)>>'" upjf3.dvitxt
dvispc -x upjf3.dvitxt upjf3.dvi
rm upjf3.dvitxt

Binary file added texk/dvipdfm-x/tests/upjf-hi.tfm
Binary file not shown.
Binary file added texk/dvipdfm-x/tests/upjf-hu.tfm
Binary file not shown.
12 changes: 12 additions & 0 deletions texk/dvipdfm-x/tests/upjf-noto.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
upjf-r unicode HaranoAjiMincho-Regular.otf
upjf-g unicode HaranoAjiGothic-Regular.otf
upjf-c Identity-H HaranoAjiMincho-Regular.otf
upjf-hu unicode NotoSerifHentaigana-Regular.ttf
upjf-hi Identity-H NotoSerifHentaigana-Regular.ttf
upjv-r unicode HaranoAjiMincho-Regular.otf -w 1
upjv-g unicode HaranoAjiGothic-Regular.otf -w 1
upjv-c Identity-V HaranoAjiMincho-Regular.otf
upjv-hu unicode NotoSerifHentaigana-Regular.ttf -w 1
upjv-hi Identity-V NotoSerifHentaigana-Regular.ttf

ptmr8r 8r Times-Roman
Binary file added texk/dvipdfm-x/tests/upjf3.dvi
Binary file not shown.
21 changes: 21 additions & 0 deletions texk/dvipdfm-x/tests/upjf3.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
% Copyright (C) 2020-2024 Japanese TeX Development Community
% You may freely use, modify and/or distribute this file.

\documentclass{ujarticle}
%\usepackage[T1]{fontenc}
%\usepackage{mathptmx}

\begin{document}
\pagestyle{empty}
\font\upjf=upjf at 10pt
\fbox{\hbox{\yoko
\upjf あいうえおアイウエオ、☃~雪晴☀𠮟。生𛁛𛂦゙、う𛂁ぎ,𛂦𛂦゙𛂦゚.ABC xyz.
}}

\tbaselineshift0.3zh
\font\upjv=upjv at 10pt
\fbox{\hbox{\tate
\upjv あいうえお、☃~雪晴☀𠮟。生𛁛𛂦゙、う𛂁ぎ,𛂦𛂦゙𛂦゚.ABC xyz.
}}
\end{document}

Binary file added texk/dvipdfm-x/tests/upjf3_full.vf
Binary file not shown.

0 comments on commit e47512f

Please sign in to comment.