From a430f4dd60a563c1e168b0c259a7be39233d92d1 Mon Sep 17 00:00:00 2001 From: Takuji Tanaka Date: Sat, 27 Apr 2024 13:01:15 +0000 Subject: [PATCH] dvipdfm-x: Support upTeX new encoding for combining characters via virtual fonts git-svn-id: svn://tug.org/texlive/trunk/Build/source@71094 c570f23f-e606-0410-a88d-b1316a301751 --- texk/dvipdfm-x/ChangeLog | 14 + texk/dvipdfm-x/Makefile.am | 13 +- texk/dvipdfm-x/Makefile.in | 17 +- texk/dvipdfm-x/cidtype2.c | 89 +- texk/dvipdfm-x/configure | 22 +- texk/dvipdfm-x/configure.ac | 2 +- texk/dvipdfm-x/dvipdfmx-upjf2.test | 46 + texk/dvipdfm-x/tests/Makefile_upjf | 20 + texk/dvipdfm-x/tests/upjf-c.pl | 24 + texk/dvipdfm-x/tests/upjf-c.tfm | Bin 0 -> 172 bytes texk/dvipdfm-x/tests/upjf-hara.map | 20 + texk/dvipdfm-x/tests/upjf.map | 6 + texk/dvipdfm-x/tests/upjf.pl | 161 ++ texk/dvipdfm-x/tests/upjf1-r.pl | 8 +- texk/dvipdfm-x/tests/upjf1-r.tfm | Bin 432 -> 432 bytes texk/dvipdfm-x/tests/upjf2.dvi | Bin 0 -> 840 bytes texk/dvipdfm-x/tests/upjf2.tex | 22 + texk/dvipdfm-x/tests/upjf2_full.vf | Bin 0 -> 7168 bytes texk/dvipdfm-x/tests/upjf2_full.zvp0 | 2928 ++++++++++++++++++++++++++ texk/dvipdfm-x/tests/upjv-c.pl | 25 + texk/dvipdfm-x/tests/upjv-c.tfm | Bin 0 -> 172 bytes texk/dvipdfm-x/tests/upjv.pl | 134 ++ texk/dvipdfm-x/tests/upjv2_full.vf | Bin 0 -> 7168 bytes texk/dvipdfm-x/tests/upjv2_full.zvp0 | 2928 ++++++++++++++++++++++++++ texk/dvipdfm-x/tfm.c | 42 +- texk/dvipdfm-x/tfm.h | 3 + texk/dvipdfm-x/vf.c | 2 +- 27 files changed, 6426 insertions(+), 100 deletions(-) create mode 100755 texk/dvipdfm-x/dvipdfmx-upjf2.test create mode 100644 texk/dvipdfm-x/tests/upjf-c.pl create mode 100644 texk/dvipdfm-x/tests/upjf-c.tfm create mode 100644 texk/dvipdfm-x/tests/upjf-hara.map create mode 100644 texk/dvipdfm-x/tests/upjf.pl create mode 100644 texk/dvipdfm-x/tests/upjf2.dvi create mode 100644 texk/dvipdfm-x/tests/upjf2.tex create mode 100644 texk/dvipdfm-x/tests/upjf2_full.vf create mode 100644 texk/dvipdfm-x/tests/upjf2_full.zvp0 create mode 100644 texk/dvipdfm-x/tests/upjv-c.pl create mode 100644 texk/dvipdfm-x/tests/upjv-c.tfm create mode 100644 texk/dvipdfm-x/tests/upjv.pl create mode 100644 texk/dvipdfm-x/tests/upjv2_full.vf create mode 100644 texk/dvipdfm-x/tests/upjv2_full.zvp0 diff --git a/texk/dvipdfm-x/ChangeLog b/texk/dvipdfm-x/ChangeLog index ac9e5832a1..8703afe734 100644 --- a/texk/dvipdfm-x/ChangeLog +++ b/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,17 @@ +2024-04-27 TANAKA Takuji + + * tfm.{c,h}, vf.c: Support upTeX new encoding + for combining characters via virtual fonts. + * cidtype2.c: Enable to treat Combining Katakana-Hiragana + (Semi-)Voiced Sound Mark in cid_to_code(). + * dvipdfmx-upjf2.test, tests/upjf2.{tex,dvi}, tests/upj{f,v}.pl, + tests/upj{f,v}-c.{pl,tfm}, tests/upjf1-r.{pl,tfm}, + tests/upj{f,v}2_full.{vf,zvp0}, tests/upjf{,-hara}.map, + tests/Makefile_upjf, Makefile.am: Add a test for + upTeX new encoding. It requires HaranoAji fonts. + https://github.com/texjporg/tex-jp-build/issues/46 + * configure.ac: version 20240427. + 2024-04-09 TANAKA Takuji * dvipdfmx-incl.test, tests/multi_incl.{tex,dvi}, diff --git a/texk/dvipdfm-x/Makefile.am b/texk/dvipdfm-x/Makefile.am index cef7f47bfd..ac3b3c435e 100644 --- a/texk/dvipdfm-x/Makefile.am +++ b/texk/dvipdfm-x/Makefile.am @@ -249,11 +249,12 @@ 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-incl.test +TESTS += dvipdfmx-upjf.test dvipdfmx-upjf2.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-incl.log: xdvipdfmx$(EXEEXT) + dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-incl.log: \ + xdvipdfmx$(EXEEXT) EXTRA_DIST = $(TESTS) ## xdvipdfmx.test EXTRA_DIST += tests/dvipdfmx.cfg tests/psfonts.map @@ -307,7 +308,13 @@ EXTRA_DIST += tests/upjv-r00.opl tests/upjv-r00.ofm EXTRA_DIST += tests/upjf1-r.pl tests/upjf1-r.tfm EXTRA_DIST += tests/upjf1_full.zvp0 tests/upjf1_full.vf EXTRA_DIST += tests/upjf1_omit.zvp0 tests/upjf1_omit.vf -DISTCLEANFILES += upjf.vf upjv.vf upjf-*.ofm upjv-*.ofm upjf-*.tfm upjf*.pdf +DISTCLEANFILES += upjf.vf upjv.vf upjf-*.ofm upjv-*.ofm upjf-*.tfm upjf_*.pdf upjf1_*.pdf +## dvipdfmx-upjf2.test +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 +DISTCLEANFILES += upjf2_*.pdf ## dvipdfmx-incl.test EXTRA_DIST += tests/multi_incl.dvi tests/multi_incl.tex tests/sue-mp.pdf DISTCLEANFILES += multi_incl.pdf diff --git a/texk/dvipdfm-x/Makefile.in b/texk/dvipdfm-x/Makefile.in index 44bcb99279..773ca4b98f 100644 --- a/texk/dvipdfm-x/Makefile.in +++ b/texk/dvipdfm-x/Makefile.in @@ -822,11 +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 multi_incl.pdf + upjf_*.pdf upjf1_*.pdf upjf2_*.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-incl.test + xdvipdfm-ttc.test dvipdfmx-upjf.test dvipdfmx-upjf2.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 \ @@ -852,9 +853,12 @@ EXTRA_DIST = $(TESTS) tests/dvipdfmx.cfg tests/psfonts.map \ tests/upjv-g00.ofm tests/upjf-r00.opl tests/upjf-r00.ofm \ tests/upjv-r00.opl tests/upjv-r00.ofm tests/upjf1-r.pl \ tests/upjf1-r.tfm tests/upjf1_full.zvp0 tests/upjf1_full.vf \ - tests/upjf1_omit.zvp0 tests/upjf1_omit.vf tests/multi_incl.dvi \ - tests/multi_incl.tex tests/sue-mp.pdf tests/fullmap.dvi \ - tests/fullmap.tex + tests/upjf1_omit.zvp0 tests/upjf1_omit.vf \ + 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 all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -2026,7 +2030,8 @@ 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-incl.log: xdvipdfmx$(EXEEXT) + dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-incl.log: \ + xdvipdfmx$(EXEEXT) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/texk/dvipdfm-x/cidtype2.c b/texk/dvipdfm-x/cidtype2.c index 6d801bc561..54873627b5 100644 --- a/texk/dvipdfm-x/cidtype2.c +++ b/texk/dvipdfm-x/cidtype2.c @@ -463,73 +463,38 @@ cid_to_code (CMap *cmap, CID cid, int unicode_cmap, int32_t *puvs) return (int32_t) outbuf[0]; else if (outbytesleft == 30) return (int32_t) (outbuf[0] << 8|outbuf[1]); - else if (outbytesleft == 28) { - if (unicode_cmap) { - /* We assume the output encoding is UTF-16. */ - int32_t uc, uvs; - const unsigned char *endptr; - - p = outbuf; - endptr = p + 4; - uc = UC_UTF16BE_decode_char(&p, endptr); - if (p == endptr) - return uc; /* single Unicode characters */ - /* Check following Variation Selectors */ - uvs = UC_UTF16BE_decode_char(&p, endptr); - if (p == endptr && uvs >= 0xfe00 && uvs <= 0xfe0f) { + else if (outbytesleft == 28 && !unicode_cmap) + return (int32_t) (outbuf[0] << 24)|(outbuf[1] << 16)|(outbuf[2] << 8)|outbuf[3]; + else if ((outbytesleft == 28 || outbytesleft == 26 || outbytesleft == 24) + && unicode_cmap) { + /* We assume the output encoding is UTF-16. */ + int32_t uc, uvs; + const unsigned char *endptr; + + p = outbuf; + endptr = p + 32 - outbytesleft; + uc = UC_UTF16BE_decode_char(&p, endptr); + if (p == endptr) + return uc; /* single Unicode characters */ + /* Check following Variation Selectors */ + uvs = UC_UTF16BE_decode_char(&p, endptr); + if (p == endptr) { + if (uvs >= 0xfe00 && uvs <= 0xfe0f) { /* Standardized Variation Sequence */ *puvs = uvs; return uc; + } else if (uvs >= 0xe0100 && uvs <= 0xe01ef) { + /* Ideographic Variation Sequence */ + *puvs = uvs; + return uc; + } else if (uvs == 0x3099 || uvs == 0x309a) { + /* Combining Katakana-Hiragana (Semi-)Voiced Sound Mark */ + *puvs = uvs; + return uc; } - WARN("CID=%u mapped to non-single Unicode characters...", cid); - return -1; - } else { - return (outbuf[0] << 24)|(outbuf[1] << 16)|(outbuf[2] << 8)|outbuf[3]; - } - } else if (outbytesleft == 26) { /* 6 bytes sequence */ - if (unicode_cmap) { - /* We assume the output encoding is UTF-16. */ - int32_t uc, uvs; - const unsigned char *endptr; - - p = outbuf; - endptr = p + 6; - uc = UC_UTF16BE_decode_char(&p, endptr); - uvs = UC_UTF16BE_decode_char(&p, endptr); - if (p == endptr) { - if (uvs >= 0xfe00 && uvs <= 0xfe0f) { - /* Standardized Variation Sequence */ - *puvs = uvs; - return uc; - } else if (uvs >= 0xe0100 && uvs <= 0xe01ef) { - /* Ideographic Variation Sequence */ - *puvs = uvs; - return uc; - } - } - WARN("CID=%u mapped to non-single Unicode characters...", cid); - return -1; } - } else if (outbytesleft == 24) { /* 8 bytes sequence */ - if (unicode_cmap) { - /* We assume the output encoding is UTF-16. */ - int32_t uc, uvs; - const unsigned char *endptr; - - p = outbuf; - endptr = p + 8; - uc = UC_UTF16BE_decode_char(&p, endptr); - uvs = UC_UTF16BE_decode_char(&p, endptr); - if (p == endptr) { - if (uvs >= 0xe0100 && uvs <= 0xe01ef) { - /* Ideographic Variation Sequence */ - *puvs = uvs; - return uc; - } - } - WARN("CID=%u mapped to non-single Unicode characters...", cid); - return -1; - } + WARN("CID=%u mapped to non-single Unicode characters...", cid); + return -1; } return -1; diff --git a/texk/dvipdfm-x/configure b/texk/dvipdfm-x/configure index 1982b3e84c..44bb2d0c25 100755 --- a/texk/dvipdfm-x/configure +++ b/texk/dvipdfm-x/configure @@ -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) 20240305. +# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20240427. # # Report bugs to . # @@ -614,8 +614,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvipdfm-x (TeX Live)' PACKAGE_TARNAME='dvipdfm-x--tex-live-' -PACKAGE_VERSION='20240305' -PACKAGE_STRING='dvipdfm-x (TeX Live) 20240305' +PACKAGE_VERSION='20240427' +PACKAGE_STRING='dvipdfm-x (TeX Live) 20240427' PACKAGE_BUGREPORT='dvipdfmx@tug.org' PACKAGE_URL='' @@ -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) 20240305 to adapt to many kinds of systems. +'configure' configures dvipdfm-x (TeX Live) 20240427 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -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) 20240305:";; + short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20240427:";; esac cat <<\_ACEOF @@ -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 20240305 +dvipdfm-x (TeX Live) configure 20240427 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -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 20240305, which was +It was created by dvipdfm-x (TeX Live) $as_me 20240427, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -8928,7 +8928,7 @@ fi # Define the identity of the package. PACKAGE='dvipdfm-x--tex-live-' - VERSION='20240305' + VERSION='20240427' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -15995,7 +15995,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -dvipdfm-x (TeX Live) config.lt 20240305 +dvipdfm-x (TeX Live) config.lt 20240427 configured by $0, generated by GNU Autoconf 2.72. Copyright (C) 2011 Free Software Foundation, Inc. @@ -17938,7 +17938,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 20240305, which was +This file was extended by dvipdfm-x (TeX Live) $as_me 20240427, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18010,7 +18010,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 20240305 +dvipdfm-x (TeX Live) config.status 20240427 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/texk/dvipdfm-x/configure.ac b/texk/dvipdfm-x/configure.ac index faf55681f3..87ddbc11db 100644 --- a/texk/dvipdfm-x/configure.ac +++ b/texk/dvipdfm-x/configure.ac @@ -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)], [20240407], [dvipdfmx@tug.org]) +AC_INIT([dvipdfm-x (TeX Live)], [20240427], [dvipdfmx@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([agl.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/texk/dvipdfm-x/dvipdfmx-upjf2.test b/texk/dvipdfm-x/dvipdfmx-upjf2.test new file mode 100755 index 0000000000..7d76f47886 --- /dev/null +++ b/texk/dvipdfm-x/dvipdfmx-upjf2.test @@ -0,0 +1,46 @@ +#! /bin/sh -vx +# $Id$ +# Copyright 2020-2024 Japanese TeX Development Community +# 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= + +rm -f upjf.vf upjv.vf upjf-g.ofm upjv-g.ofm upjf-r.ofm upjv-r.ofm upjf-r.tfm + +##### following tests require HaranoAji fonts ##### + +$_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 + + +echo "*** dvipdfmx: test for upjf2_full-hara.pdf" && echo \ + && cp $srcdir/tests/upjf2_full.vf ./upjf.vf \ + && cp $srcdir/tests/upjv2_full.vf ./upjv.vf \ + && $_xdvipdfmx --dvipdfmx -vv --pdfm-str-utf8 -f upjf-hara.map -o upjf2.pdf $srcdir/tests/upjf2.dvi \ + && mv ./upjf2.pdf ./upjf2_full-hara.pdf \ + && echo && echo "dvipdfmx-upjf2-vf_full-hara tests OK" && echo \ + || failed="$failed dvipdfmx-upjf2-vf_full-hara" + + +test -z "$failed" && exit 0 +echo +echo "failed tests:$failed" +exit 1 diff --git a/texk/dvipdfm-x/tests/Makefile_upjf b/texk/dvipdfm-x/tests/Makefile_upjf index 2542406174..3f33d1d82a 100644 --- a/texk/dvipdfm-x/tests/Makefile_upjf +++ b/texk/dvipdfm-x/tests/Makefile_upjf @@ -47,6 +47,18 @@ upjf1_full.vf: upjf1_omit.vf: jfmutil zvp02vf upjf1_omit.zvp0 +upjf2_full.vf: + jfmutil zvp02vf upjf2_full.zvp0 + +upjv2_full.vf: + jfmutil zvp02vf upjv2_full.zvp0 + +upjf-c.tfm: + uppltotf upjf-c.pl + +upjv-c.tfm: + uppltotf upjv-c.pl + upjf.dvi: upjf.tex uplatex upjf.tex dvispc -a upjf.dvi upjf.dvitxt @@ -55,3 +67,11 @@ upjf.dvi: upjf.tex dvispc -x upjf.dvitxt upjf.dvi rm upjf.dvitxt +upjf2.dvi: upjf2.tex + uplatex upjf2.tex + dvispc -a upjf2.dvi upjf2.dvitxt + sed -i '/xxx/d' upjf2.dvitxt + sed -i -e "4i xxx1 176 'pdf:docinfo<>'" upjf2.dvitxt + dvispc -x upjf2.dvitxt upjf2.dvi + rm upjf2.dvitxt + diff --git a/texk/dvipdfm-x/tests/upjf-c.pl b/texk/dvipdfm-x/tests/upjf-c.pl new file mode 100644 index 0000000000..e76699f7a0 --- /dev/null +++ b/texk/dvipdfm-x/tests/upjf-c.pl @@ -0,0 +1,24 @@ +(COMMENT THIS IS A KANJI FORMAT FILE) +(FAMILY UPJIS KANJI) +(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) + ) +(TYPE O 0 + (CHARWD R 1.0) + (CHARHT R 0.88) + (CHARDP R 0.12) + ) diff --git a/texk/dvipdfm-x/tests/upjf-c.tfm b/texk/dvipdfm-x/tests/upjf-c.tfm new file mode 100644 index 0000000000000000000000000000000000000000..9a525bb5a8af787c1d71dd6f390f4ff5caaf896f GIT binary patch literal 172 zcmZSJW?*E{W)NZk0VXhH1hW|!IKlJ+1_r(m*9Zk~M?Wu51t2Q~Dve2ThX#0g218WB rWE-FiMnNb;07~!KF!AsmUc8Z@TBa zojyZT-?=C?u_V7p!zU5sjPlHq426u!g4Cj-)HF?f$I_AvpxmPw%?giZG-&Dv6y>Ls zCZ`r@q?Ba>Ez8x^_fD-W&o4?T)_Ae4^<{s@v%aO)3XhxnA2%&|+&uAd^Pb1es~$IR ze%!R)TH)=~8E@updE2|^_43BIjcYXR?0WkaFs)!<=w0x)f`MTHQx=%H+t{cV2qwDE z_n801*rbzzAuWy3@bbI)0{bTSwlDxmkVxzl-A$gTu;a^JkPG`MeovV98}rH^if`E|j+S3mB7 zr5OayoLRsq!LHQX0wN*4{R<46-iaK*VEXs=$G!iIpY<_3U3LqPr^)x_e5OZ#kv%n0 zfPn$-Fu0#Ujt2RuZ@wG@LtoDipzE}dQ#mM}8C!v(Tnt# literal 0 HcmV?d00001 diff --git a/texk/dvipdfm-x/tests/upjf2.tex b/texk/dvipdfm-x/tests/upjf2.tex new file mode 100644 index 0000000000..3c88836286 --- /dev/null +++ b/texk/dvipdfm-x/tests/upjf2.tex @@ -0,0 +1,22 @@ +% 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} +\prebreakpenalty`ㇷ=0 +\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} + diff --git a/texk/dvipdfm-x/tests/upjf2_full.vf b/texk/dvipdfm-x/tests/upjf2_full.vf new file mode 100644 index 0000000000000000000000000000000000000000..fd29f21d56ce888fad5f82271ed14d902fb6168f GIT binary patch literal 7168 zcmZwLRd5t&7C_-9kl^m_!J$J44#C}nI|Kp*5AJku_uw)vfpK>i#@*eSVWw(%m^^G% zZ+GXM-JYt=L*%P-|4veWrEll&tAW_tr9j|D;b#>hA0l4`l2$Ft&T5l$qezVZsq=0m z{2$HyR|Ja%0?C0uB)=R=4hThoqCk)$Xb~(DC=neA7O_YG5(Lf&{`ZVxg@*=4t14Jkq^c-X;>W2ZR0b-0PL;TGs#sO!oT^sU;;L#^)v2mm)rhNVSkqhBTGeB$o=_jCFErqs20}xiq0k6uBs2yZ3r&C~LQ|lrkPIXX z&46Y?bD+7<0%#$$1X>EMfL20lptaBjXd|=*+6wJ}c0v#c3MoK}&>mdp zqk+-F7+{Q$0b~ecfw96kV4N@>7%xl!CI}OOiNYjck}w&VEKC8W2vdQn!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z)yE1Dk~{z!qUEuvORwY!kA9Y#{`Mgzdm~VF$27$N_SMoxo0E7qCm%4eS=pI_`-J_#e&GOcKsX2-6b=E0gu}pL;RtXYUTPB;&o7cKx7gp0sMAR~5R@L0+NJeAXz8|6pKP+=?%xNzTx6ltiItA zLP^F-3Z;NjLTv559152f%21RMVk>W?C@YksC?})+` zPz9(WR0XOE)qrY3b)b3_qTjW`_4eP+6x_k4njwuqtFTHByVbHoUYN=h0ip@U9Gw?)=lUhts+;eyU>H8htLz~Df9w*3B7^dLLZ=y&==?{^aJ_{ z{ek|%0APSH5Ev-1;)VwathnL9!VpG=2t$FP0xNEKm@u4TxWI}V9wCgR7%7YbMhT;V z(ZU#DjF16j2xEb1sBw&)jiW{CBh3Flb5_d@fGlA?Fke^zED#m~ z3x!3%B4IJGSXcrq5taf=g=N4pVL7l|SOKgMRst)9Rlq7?HQ-z-8eIa7DNW zxJS4bxL3FjxKFqrxLcu9B}cv*M_ctv;>cvW}} zcuja6cwM*(Tov8`-Vojd-W1*f-V)vh-WJ{g-Vxpf-WA>h-V@#j-WNUqJ`g?xJ`_Fz zJ`z3#J{CR!J`p|zJ{3L#J`+9%J{P_Kz7W0yz7)O!z7oC$z81a#z7f6!z7@U$z7xI& zz88J~eh_{HeiVKJeiD8LeinWKei42JeieQLeiN<%*M#4J--SPbKZNVRb>UCoPvI}% zuP7u15=&i-LjLy1J4iw7sY*l&+7=F_24f5Il~B*oK 0x10FFFFUL ? 0x110000UL : i)) +#define CHARACTER_INDEX(i) ((i > UCS_LASTCHAR ? UCS_LASTCHAR+1 : i)) #else #define CHARACTER_INDEX(i) ((i)) #endif @@ -164,6 +164,9 @@ struct coverage { int first_char; int num_chars; +#ifndef WITHOUT_ASCII_PTEX + int last_char; +#endif }; /* @@ -214,8 +217,13 @@ lookup_char (const struct char_map *map, int charcode) if (charcode >= map->coverage.first_char && charcode <= map->coverage.first_char + map->coverage.num_chars) return map->indices[CHARACTER_INDEX(charcode - map->coverage.first_char)]; - else - return -1; + +#ifndef WITHOUT_ASCII_PTEX + if (charcode <= map->coverage.last_char) + return map->indices[0]; +#endif + + return -1; } static int @@ -229,6 +237,10 @@ lookup_range (const struct range_map *map, int charcode) map->coverages[idx].first_char + map->coverages[idx].num_chars) return map->indices[CHARACTER_INDEX(idx)]; } +#ifndef WITHOUT_ASCII_PTEX + if (charcode <= JFM_LASTCHAR) + return map->indices[0]; +#endif return -1; } @@ -464,15 +476,19 @@ jfm_do_char_type_array (FILE *tfm_file, struct tfm_font *tfm) unsigned short chartype; unsigned int i; - tfm->chartypes = NEW(1114112, unsigned int); - for (i = 0; i < 1114112; i++) { + tfm->chartypes = NEW(UCS_LASTCHAR + 1, unsigned int); + for (i = 0; i < (UCS_LASTCHAR + 1); i++) { tfm->chartypes[i] = 0; } for (i = 0; i < tfm->nt; i++) { /* support new JFM spec by texjporg */ charcode = get_unsigned_triple_kanji(tfm_file); chartype = get_unsigned_byte(tfm_file); - tfm->chartypes[charcode] = chartype; + if (charcode < (UCS_LASTCHAR + 1)) + tfm->chartypes[charcode] = chartype; + else { + /* Invalid charcode */ + } } } @@ -487,10 +503,11 @@ jfm_make_charmap (struct font_metric *fm, struct tfm_font *tfm) fm->charmap.data = map = NEW(1, struct char_map); map->coverage.first_char = 0; #ifndef WITHOUT_ASCII_PTEX - map->coverage.num_chars = 0x10FFFFL; - map->indices = NEW(0x110001L, unsigned int); - map->indices[0x110000L] = tfm->chartypes[0]; - for (code = 0; code <= 0x10FFFFU; code++) { + map->coverage.num_chars = UCS_LASTCHAR; + map->coverage.last_char = JFM_LASTCHAR; + map->indices = NEW(UCS_LASTCHAR + 2, unsigned int); + map->indices[UCS_LASTCHAR + 1] = tfm->chartypes[0]; + for (code = 0; code <= UCS_LASTCHAR; code++) { #else map->coverage.num_chars = 0xFFFFL; map->indices = NEW(0x10000L, unsigned short); @@ -507,7 +524,8 @@ jfm_make_charmap (struct font_metric *fm, struct tfm_font *tfm) map->coverages = NEW(map->num_coverages, struct coverage); map->coverages[0].first_char = 0; #ifndef WITHOUT_ASCII_PTEX - map->coverages[0].num_chars = 0x10FFFFL; + map->coverages[0].num_chars = UCS_LASTCHAR; + map->coverages[0].last_char = JFM_LASTCHAR; #else map->coverages[0].num_chars = 0xFFFFL; #endif @@ -812,7 +830,7 @@ read_tfm (struct font_metric *fm, FILE *tfm_file, off_t tfm_file_size) jfm_do_char_type_array(tfm_file, &tfm); jfm_make_charmap(fm, &tfm); fm->firstchar = 0; - fm->lastchar = 0x10FFFFL; + fm->lastchar = JFM_LASTCHAR; fm->fontdir = (tfm.id == JFMV_ID) ? FONT_DIR_VERT : FONT_DIR_HORIZ; fm->source = SOURCE_TYPE_JFM; } diff --git a/texk/dvipdfm-x/tfm.h b/texk/dvipdfm-x/tfm.h index 1081c0f140..b569cbcbbd 100644 --- a/texk/dvipdfm-x/tfm.h +++ b/texk/dvipdfm-x/tfm.h @@ -25,6 +25,9 @@ #include "numbers.h" +#define UCS_LASTCHAR 0x10FFFFUL +#define JFM_LASTCHAR 0xFFFFFFUL + extern int tfm_open (const char * tex_name, int must_exist); extern void tfm_close_all (void); diff --git a/texk/dvipdfm-x/vf.c b/texk/dvipdfm-x/vf.c index 79fe93b3ee..4f20af2276 100644 --- a/texk/dvipdfm-x/vf.c +++ b/texk/dvipdfm-x/vf.c @@ -416,7 +416,7 @@ void vf_set_char(int32_t ch, int vf_font) !(start = (vf_fonts[vf_font].ch_pkt)[ch])) { int is_jfm = tfm_is_jfm(vf_fonts[vf_font].dev_fonts[0].tfm_id); if (is_jfm && - ch < 0x1000000 && dpx_conf.compat_mode != dpx_mode_xdv_mode) { + ch <= JFM_LASTCHAR && dpx_conf.compat_mode != dpx_mode_xdv_mode) { /* fallback multibyte character for (u)pTeX */ if (dpx_conf.verbose_level == 1) if (vf_fonts[vf_font].message_flag == 0) {