Skip to content

Instantly share code, notes, and snippets.

@aminophen
Last active January 26, 2022 14:22
Show Gist options
  • Save aminophen/82f86c309b69f443b24d2427a0718e41 to your computer and use it in GitHub Desktop.
Save aminophen/82f86c309b69f443b24d2427a0718e41 to your computer and use it in GitHub Desktop.
e-(u)ptex: Add \fontchartype primitive
%#!eptex -ini -etex
\catcode`\{=1
\catcode`\}=2
\catcode`\^=7
\newlinechar=10
%---
\ifnum\jis"2121="3000
\font\STANDARD=upjisg-h
\font\JLREQ=ujlreq
\else
\font\STANDARD=goth10
\font\JLREQ=jlreq
\fi
% standard font: 全角空白はタイプ0のまま
\ifnum\fontchartype\STANDARD\jis"2121=0
\message{^^J\fontname\STANDARD: \the\fontchartype\STANDARD\jis"2121}
\fi
% jlreq font: 全角空白はタイプ0ではない
\unless\ifnum\fontchartype\JLREQ\jis"2121=0
\message{^^J\fontname\JLREQ: \the\fontchartype\JLREQ\jis"2121}
\fi
% 欧文フォントはエラー
\font\AFONT=ec-lmr10
\unless\ifnum\fontchartype\AFONT\jis"2121=-1
\errhelp{}\errmessage{Should not happen!}
\fi
% 不正な文字コードはエラー
\message{\the\fontchartype\STANDARD 256}% eptex: error, euptex: no error
\message{\the\fontchartype\STANDARD -16}% error
% 名称
\message{\meaning\fontchartype}
%---
% 括弧類は全て同じタイプ
\ifnum\fontchartype\STANDARD`(=\fontchartype\STANDARD`「\relax
\message{^^J(と「は同じタイプ}
\fi
\unless\ifnum\fontchartype\STANDARD`(=\fontchartype\STANDARD`)\relax
\message{^^J(と)は違うタイプ}
\fi
%---
\ifnum\jis"2121="3000
\input uptex
\else
\input ptex
\fi
\newlinechar=10
% 標準の min10/goth10 は特殊
\ifnum\fontchartype\jfont`す=0
\message{^^JThis is upTeX, \fontname\jfont^^J}
\else
\message{^^JThis is pTeX, \fontname\jfont^^J}
\fi
% 字幅には違いが表れない
\message{\the\fontcharwd\jfont`す}
\message{\the\fontcharwd\jfont`漢}
\message{\the\fontcharwd\jfont`。}
%---
\end
@aminophen
Copy link
Author

Patch to add a new \fontchartype primitive: texjporg/tex-jp-build@297e67b

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