Skip to content

Commit 6398f91

Browse files
committed
chkdvifont: Allow Unicode characters in file names & terminal (Windows only)
git-svn-id: svn://tug.org/texlive/trunk/Build/source@77635 c570f23f-e606-0410-a88d-b1316a301751
1 parent 8c16b2e commit 6398f91

File tree

18 files changed

+108
-10
lines changed

18 files changed

+108
-10
lines changed

texk/dviout-util/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2026-02-07 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
2+
3+
* chkdvifont.c, dd.h:
4+
Allow Unicode characters in file names and
5+
STDOUT/STDERR output to terminal (Windows only).
6+
* dvispc.test, tests/spc000_{es,ue,es}.{tex,dvi,spc},
7+
chkdvifont.test, Makefile.am: Add new tests.
8+
19
2026-02-03 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
210

311
* dvispc.c:

texk/dviout-util/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ EXTRA_DIST += tests/oldindep.spc \
5353
tests/put.dump.dvi tests/put.txt \
5454
tests/spc000_es.tex tests/spc000_es.dvi tests/spc000_es.spc \
5555
tests/spc000_ue.tex tests/spc000_ue.dvi tests/spc000_ue.spc \
56+
tests/spc000_us.tex tests/spc000_us.dvi tests/spc000_us.spc \
5657
tests/fntdef0.tex \
5758
tests/fntdef0.dvi tests/fntdef0.txt \
5859
tests/fntdef1.dvi tests/fntdef1.txt \

texk/dviout-util/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ EXTRA_DIST = $(TESTS) tests/oldindep.spc tests/oldindep.tex \
590590
tests/putj.txt tests/put.dump.dvi tests/put.txt \
591591
tests/spc000_es.tex tests/spc000_es.dvi tests/spc000_es.spc \
592592
tests/spc000_ue.tex tests/spc000_ue.dvi tests/spc000_ue.spc \
593+
tests/spc000_us.tex tests/spc000_us.dvi tests/spc000_us.spc \
593594
tests/fntdef0.tex tests/fntdef0.dvi tests/fntdef0.txt \
594595
tests/fntdef1.dvi tests/fntdef1.txt tests/fntdef2.dvi \
595596
tests/fntdef2.txt tests/fntdef3.dvi tests/fntdef3.txt \

texk/dviout-util/chkdvifont.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,23 @@
6666
#endif
6767

6868
#include <config.h>
69+
#ifdef KPATHSEA
70+
#include <kpathsea/config.h>
71+
#if defined(WIN32)
72+
#include <kpathsea/variable.h>
73+
#endif
74+
#endif
6975

7076
#include "dd.h"
7177
#include "common.h"
7278

79+
#if defined(WIN32) && defined(KPATHSEA)
80+
#undef fopen
81+
#undef fprintf
82+
#define fopen fsyscp_fopen
83+
#define fprintf win32_fprintf
84+
#endif
85+
7386
#define ID 2
7487
#define ID_PTEX 3
7588
#define END_DVI 223
@@ -289,6 +302,19 @@ int main(int argc, char **argv)
289302

290303
if (argc < 2)
291304
usage();
305+
#if defined(WIN32) && defined(KPATHSEA)
306+
{
307+
int ac;
308+
char **av, *enc;
309+
310+
kpse_set_program_name(argv[0], "chkdvifont");
311+
enc = kpse_var_value("command_line_encoding");
312+
if (get_command_line_args_utf8(enc, &ac, &av)) {
313+
argc = ac;
314+
argv = av;
315+
}
316+
}
317+
#endif
292318
for (i = 1; i < argc - 1; i++) {
293319
if (argv[i][0] != '-')
294320
usage();
@@ -497,7 +523,11 @@ void show_dvi_data(DVIFILE_INFO *dvi)
497523
int len, x, y;
498524
long s_width, s_hight;
499525

526+
#if defined(WIN32) && defined(KPATHSEA)
527+
fprintf(stdout, "dvi file name\t\t\t= %s\n", dvi->file_name);
528+
#else
500529
printf("dvi file name\t\t\t= %s\n", dvi->file_name);
530+
#endif
501531
fseek(dvi->file_ptr, 14L, SEEK_SET),
502532
len = (uchar)read_byte(dvi->file_ptr);
503533
printf("comment\t\t\t\t=%s\n", read_str(dvi->file_ptr, len));

texk/dviout-util/chkdvifont.test

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh -vx
22
# $Id$
3-
# Copyright 2018-2021 Japanese TeX Development Community <issue@texjp.org>
3+
# Copyright 2018-2026 Japanese TeX Development Community <issue@texjp.org>
44
# You may freely use, modify and/or distribute this file.
55

66
BinDir=${BinDir:-.}
@@ -18,6 +18,12 @@ CMP="cmp"
1818
$DIFF --strip-trailing-cr $0 $0 \
1919
&& DIFF="diff --strip-trailing-cr" || echo
2020

21+
TEXMFCNF=$srcdir/../kpathsea
22+
export TEXMFCNF
23+
24+
## show banner
25+
$_chkdvifont
26+
2127

2228
## DVI mode
2329

@@ -64,5 +70,24 @@ $_chkdvifont -c $testdir/upphirakakuw6-h.tfm > xupp6-h.cfn && \
6470
$DIFF $testdir/upphirakakuw6-h.cfn xupp6-h.cfn && echo || exit 9
6571

6672

73+
## Unicode filename
74+
if [ "$COMSPEC" != "" ] || [ "$ExeExt" = ".exe" ]; then
75+
echo "*** We guess OS is Windows."
76+
MyOS=Windows
77+
command_line_encoding=utf8
78+
export command_line_encoding
79+
else
80+
echo "*** We guess OS is not Windows."
81+
MyOS=nonWindows
82+
fi
83+
cp $testdir/oldindep.dvi ./oidΔДदダ打다𝕯🎉.dvi && \
84+
sed -e 's/oldindep/oidΔДदダ打다𝕯🎉/' $testdir/oldindep.cfn > oidΔДदダ打다𝕯🎉.cfn &&
85+
$_chkdvifont -c ./oidΔДदダ打다𝕯🎉.dvi > xoidΔДदダ打다𝕯🎉.cfn && \
86+
$DIFF oidΔДदダ打다𝕯🎉.cfn xoidΔДदダ打다𝕯🎉.cfn && echo || exit 51
87+
88+
# output STDOUT to terminal
89+
$_chkdvifont -c ./oidΔДदダ打다𝕯🎉.dvi
90+
91+
6792
exit 0
6893

texk/dviout-util/dd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ typedef void (*void_func_ptr) ();
8383
typedef int (*int_func_ptr) ();
8484
typedef int (* COMP)(const void *, const void *);
8585

86+
#if 0
87+
/** We do not use them in dviout-util (TeX Live) **/
8688
#ifdef FALSE
8789
#undef FALSE
8890
#endif
@@ -96,6 +98,7 @@ typedef enum{
9698
FALSE = 0,
9799
TRUE = 1
98100
} BOOL;
101+
#endif
99102

100103
#define NOTHING 0
101104
#define FAILURE (-1)

texk/dviout-util/dvispc.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,5 +269,15 @@ $_dvispc -s $testdir/spc000_ue.dvi > x1spc000_ue.spc && \
269269
# output STDOUT to terminal
270270
$_dvispc -s $testdir/spc000_ue.dvi
271271

272+
### (u)ptex, ambiguous encoding: UTF-8 or Shift_JIS
273+
$_dvispc -s $testdir/spc000_us.dvi x0spc000_us.spc && \
274+
$DIFF $testdir/spc000_us.spc x0spc000_us.spc && echo || rc=1
275+
276+
$_dvispc -s $testdir/spc000_us.dvi > x1spc000_us.spc && \
277+
$DIFF $testdir/spc000_us.spc x1spc000_us.spc && echo || rc=2
278+
279+
# output STDOUT to terminal
280+
$_dvispc -s $testdir/spc000_us.dvi
281+
272282
exit 0
273283

68 Bytes
Binary file not shown.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[1]
2-
{string: coffee ���� ����}
3-
{string: amber ���� ����}
4-
{string: konjak ���� ����}
2+
{string: coffee ���� ���� amber ���� ����}
3+
{string: konjak ���� ���� glutinous rice ���� ����}
4+
{string: konjak dotage: ���� ���� rampant: ���� ����}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
%% ptex, EUC-JP or Shift_JIS
22

33
foo
4-
\special{string: coffee àÝàê àÛàè}
4+
\special{string: coffee àÝàê àÛàè amber àèàá àæàß}
55
bar
6-
\special{string: amber àèàá àæàß}
6+
\special{string: konjak èçèê äåäè glutinous rice äùäë â÷âé}
77
baz
8-
\special{string: konjak èçèê äåäè}
8+
\special{string: dotage: æÎâñ ãÌáï rampant: àËàÕ àÉàÓ}
99
qux
1010

1111
\end

0 commit comments

Comments
 (0)