Skip to content

Instantly share code, notes, and snippets.

@aminophen
Last active February 14, 2022 13:20
Show Gist options
  • Save aminophen/70f55a916b27deb27d41c8bbfe558c19 to your computer and use it in GitHub Desktop.
Save aminophen/70f55a916b27deb27d41c8bbfe558c19 to your computer and use it in GitHub Desktop.
e-(u)ptex: Add \lastnodefont primitive
%#!eptex
\catcode`\{=1
\catcode`\}=2
\hsize=300pt
\def\LNC{%
\ifnum\lastnodechar=-1 \message{LNC: -1}\else
\message{LNC: \the\lastnodechar}\fi}
\def\LNF{%
\ifjfont\lastnodefont \message{LNF: J:\fontname\lastnodefont}\else
\iftfont\lastnodefont \message{LNF: T:\fontname\lastnodefont}\else
\message{LNF: A:\fontname\lastnodefont}\fi\fi
\showthe\fontcharwd\lastnodefont\lastnodechar}
\def\TEST{%
\showthe\lastnodetype
\showthe\lastnodesubtype
\showthe\lastnodechar
\showthe\lastnodefont
\LNC \LNF}
\font\x=ec-lmr10 \x
\ifnum\jis"2121="3000
\font\y=upjisg-h \y
\font\z=upjisg-v \z
\font\k=upjisr-h
\else
\font\y=jisg \y
\font\z=jisg-v \z
\font\k=jis
\fi
% 名称
\show\lastnodetype
\show\lastnodesubtype
\show\lastnodechar
\show\lastnodefont
\show\inputlineno
% \lastnodefont:
% * 初期値は \nullfont
% * 最後が文字ノードとリガチャの場合はそのフォント
% * 禁則ペナルティとメトリック由来の空白は無視(\lastnodechar と同じ)
\TEST
あ)\TEST
あ(\TEST
f{}{}i\TEST
fi\TEST
{\k あ}\TEST
あ\kern-1pt\TEST
あ\hskip1pt\TEST
あ\/\TEST
% 垂直モードや水平モードでは禁止
\lastnodefont あ\lastnodefont\relax
\end
@aminophen
Copy link
Author

Added \lastnodefont in e-pTeX 220214 (r62017).

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