Skip to content

Instantly share code, notes, and snippets.

@aminophen
Last active October 17, 2022 15:10
Show Gist options
  • Save aminophen/6715ae7fce5e03ddecccf06e7569682a to your computer and use it in GitHub Desktop.
Save aminophen/6715ae7fce5e03ddecccf06e7569682a to your computer and use it in GitHub Desktop.
[pTeX] New feature candidates for JIS-encoded or UCS-encoded TFM
%#!ptex, uptex, eptex, euptex
\nonstopmode
\tracingonline1
\tracingoutput1
\showboxdepth10000
\showboxbreadth10000
\newlinechar10
\font\x=zpl-Regular-tlf-t1
\font\y=zpl-Italic-tlf-t1 scaled 2
\font\z=zpl-Bold-tlf-t1 at 5pt
\font in jis \w=zpl-BoldItalic-tlf-t1
\font in ucs \v=zpl-Slanted-tlf-t1
\font\ja=jis
\font in jis\jb=jisg
\font in ucs\jc=upjisr-h
\font in ucs\jd=upjisg-h at 7pt
\font\je=jis-v
\font in jis\jf=jisg-v
\font in ucs\jg=upjisr-v
\font in ucs\jh=upjisg-v scaled 2
\def\FONTNAME#1{\ifx#1\relax\else\write16{#1:\fontname#1}\expandafter\FONTNAME\fi}
\FONTNAME\x\y\z\w\v\ja\jb\jc\jd\je\jf\jg\jh\relax
\ifx\ptexfontname\undefined \expandafter\end \fi
\show\ptexfontname
\show\ptexrevision
\show\uptexrevision
\def\FONTNAME#1{\ifx#1\relax\else\write16{#1:\ptexfontname#1}\expandafter\FONTNAME\fi}
\FONTNAME\x\y\z\w\v\ja\jb\jc\jd\je\jf\jg\jh\relax
\end
%#!ptex, uptex, eptex, euptex
\nonstopmode
\tracingonline1
\tracingoutput1
\showboxdepth10000
\showboxbreadth10000
\edef\TRACINGFONTS{%
\ifx\tracingfonts\undefined\else
\tracingfonts % luatex
\fi
\ifx\pdftracingfonts\undefined\else
\pdftracingfonts % pdftex
\fi
\ifx\ptextracingfonts\undefined\else
\ptextracingfonts % (e)(u)ptex development
\fi
\ifx\XeTeXtracingfonts\undefined\else
\XeTeXtracingfonts % xetex
\fi}
\expandafter\let\expandafter\TracingFonts\TRACINGFONTS
\show\TracingFonts
\font\x=zpl-Regular-tlf-t1
\font\y=zpl-Italic-tlf-t1 scaled 2
\font\z=zpl-Bold-tlf-t1 at 5pt
\font in jis \w=zpl-BoldItalic-tlf-t1
\font in ucs \v=zpl-Slanted-tlf-t1
\font\ja=jis
\font in jis\jb=jisg
\font in ucs\jc=upjisr-h
\font in ucs\jd=upjisg-h at 7pt
\font\je=jis-v
\font in jis\jf=jisg-v
\font in ucs\jg=upjisr-v
\font in ucs\jh=upjisg-v scaled 2
\def\TEST{\showthe\TracingFonts
\x R \y I \z B \w BI \v SL
\hbox{\yoko\ja 漢 \jb 漢 \jc 漢 \jd 漢}
\hbox{\tate\je 漢 \jf 漢 \jg 漢 \jh 漢}
}
% default: 0
\shipout\vbox{\TEST}
% set 1
\TracingFonts1
\shipout\vbox{\TEST}
% set 2; only for (e)(u)ptex development
\TracingFonts2
\shipout\vbox{\TEST}
\end
%#!e(u)ptex -ini -etex
\let\dump\relax
\input plain
\newlinechar=`^^J
\show\toucs
\show\tojis
\show\ptexrevision
\show\uptexrevision
\show\jobname
\newcount\tempcnta
\newcount\CharCount
\xdef\KINTERNAL{%
\ifnum\ucs"3000="3000 \string\ucs
\else\ifnum\euc"A1A1="A1A1 \string\euc
\else\ifnum\sjis"8140="8140 \string\sjis
\fi\fi\fi}
{\escapechar-1 \xdef\CHAR{\string\char}\xdef\OMCHAR{\string\omathchar}}
\def\CC#1{\expandafter\StripChar#1}
\expandafter\def\expandafter\StripChar\expandafter#\expandafter1\CHAR#2{#2}
\def\OC#1{\expandafter\StripOChar#1}
\expandafter\def\expandafter\StripOChar\expandafter#\expandafter1\OMCHAR#2{#2}
\CharCount=0\relax
\tempcnta=0\relax
\loop\ifnum\tempcnta<"110000\relax
%\iffontchar\jfont\tempcnta\relax
\ifnum\jis\tojis\tempcnta=\tempcnta\relax
\advance\CharCount by 1\relax
\ifx\omathchardef\undefined %%%%%
\message{^^J\KINTERNAL\the\tempcnta\space
= \string\jis\tojis\tempcnta}
\else %%%%%
\chardef\KnjInternal=\tempcnta\relax
\omathchardef\KnjJIS=\tojis\tempcnta\relax
\message{^^J\KINTERNAL\CC{\meaning\KnjInternal}
= \string\jis\OC{\meaning\KnjJIS} (\Uchar\tempcnta)}
\fi %%%%%
\fi
%\fi
\advance\tempcnta by 1\relax
\repeat
\message{^^JNumber of valid characters: \the\CharCount^^J}
% => for pTeX, should be 8836 (= 94 x 94)
% => for upTeX, should be 6879 (JIS X 0208)
\end
%#!uptex, euptex
\ifnum\jis"2121="3000 \else \expandafter\end \fi
\kcatcode"D8=16\relax
\font in jis\x=jis \x
\font\y=cmtt10 \y
\newlinechar`^^J
\shipout\vbox{}
\def\TEST{\message{^^J\string\tracinglostchars=\the\tracinglostchars}\shipout\vbox{ó \char"A1}}
\TEST
\tracinglostchars0 \TEST
\tracinglostchars1 \TEST
\tracinglostchars2 \TEST
\tracinglostchars3 \TEST
\tracingonline1
\tracinglostchars0 \TEST
\tracinglostchars1 \TEST
\tracinglostchars2 \TEST
\tracinglostchars3 \TEST
\end
@aminophen
Copy link
Author

aminophen commented Oct 16, 2022

texjporg/tex-jp-build#149 と関連: texjporg/tex-jp-build@00263d7 をビルドして実行。

\ptextracingfonts = 2 における情報表示例(ptextracingfonts.log から情報表示行だけ抜粋):

..\x (zpl-Regular-tlf-t1) R
..\y (zpl-Italic-tlf-t1@0.01999pt) I
..\z (zpl-Bold-tlf-t1@5.0pt) B
..\w (zpl-BoldItalic-tlf-t1) B
..\w (zpl-BoldItalic-tlf-t1) I
..\v (zpl-Slanted-tlf-t1) S
..\v (zpl-Slanted-tlf-t1) L
...\ja (jis/YOKO) 漢
...\jb (jisg/YOKO+JIS) 漢
...\jc (upjisr-h/YOKO+Unicode) 漢
...\jd (upjisg-h@7.0pt/YOKO+Unicode) 漢
....\je (jis-v/TATE) 漢
....\jf (jisg-v/TATE+JIS) 漢
....\jg (upjisr-v/TATE+Unicode) 漢
....\jh (upjisg-v@0.01999pt/TATE+Unicode) 漢

@aminophen
Copy link
Author

補足

  • \tracinglostchars: 欧文フォントの Missing character は「ノード生成時に警告発生・ノードを破棄」するのに対し,和文フォントの非 JIS の方は「\shipout でノードの DVI 出力時に警告発生・ノードを破棄せず .notdef (set2 0) を出力」する。したがって,後者の非 JIS の警告は「\shipout 時点での \tracinglostchars の値」に依る。
  • \ptextracingfonts: \tracingoutput=1 のときに意味を持ち,これは元来 \shipout 時にログに出るものであるから「\shipout 時点での \ptextracingfonts の値」に依る。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment