%% %% This is file 'pxchfon.sty'. %% %% Copyright (c) 2009-2021 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% %% This package is distributed under the MIT License. %% %% package declaration \NeedsTeXFormat{pLaTeX2e} \ProvidesPackage{pxchfon}[2021/05/30 v1.9] \def\pxcz@pkgname{pxchfon} %--------------------------------------- general %% variables \newif\ifpxcz@ok \newif\ifpxcz@utf \let\pxcz@pre\relax \let\pxcz@post\relax %% unique tokens \def\pxcz@end{\pxcz@end@} \def\pxcz@mt{\pxcz@mt@} %% \pxcz@csletcs{}{} \def\pxcz@csletcs#1#2{% \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname} %% \pxcz@cond\ifXXX...\fi{}{} \@gobbletwo\if\if \def\pxcz@cond#1\fi{% #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} %% \pxcz@onlypreamble@csdef{} \def\pxcz@onlypreamble@csdef#1{% \expandafter\pxcz@onlypreamble@def\csname#1\endcsname} %% \pxcz@onlypreamble@def\CS \def\pxcz@onlypreamble@def#1{% \@onlypreamble#1\def#1} %% \pxcz@onlypreamble@let\CS \def\pxcz@onlypreamble@let#1{% \@onlypreamble#1\let#1} %% \pxcz@csuse@or{}{} \def\pxcz@csuse@or#1#2{% \expandafter\ifx\csname#1\endcsname\relax \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi{#2}{\csname#1\endcsname}} %% \pxcz@lower\CS \def\pxcz@lower#1{% \expandafter\pxcz@lower@a#1\pxcz@end#1} \def\pxcz@lower@a#1\pxcz@end#2{% \lowercase{\def#2{#1}}} %% \pxcz@split{}{} \def\pxcz@split#1#2{% \edef\pxcz@tmpx{{#1}{#2}}% \expandafter\pxcz@split@a\pxcz@tmpx} \def\pxcz@split@a#1#2{% \def\pxcz@tmpx##1#1##2\pxcz@end{\pxcz@split@b{##1}{##2}}% \pxcz@tmpx#2\pxcz@mt#1\pxcz@end} \def\pxcz@split@b#1#2{% \let\pxcz@pre\relax \let\pxcz@post\relax \ifx\pxcz@end#2\pxcz@end\else \pxcz@split@c#2\pxcz@end{#1}% \fi} \def\pxcz@split@c#1\pxcz@mt#2\pxcz@end#3{% \def\pxcz@pre{#3}\def\pxcz@post{#1}} %--------------------------------------- environment check %% check for 'pxjafont' package % if old version of pxjafont is loaded (probably this package is % required from pxjafont), then I abort here with an error message. \@ifpackageloaded{pxjafont}{% \ifx\pxAliasedPxjafont\@undefined \PackageError\pxcz@pkgname {FATAL: Old 'pxjafont' is loaded}{\@ehc} \expandafter\@@end\fi}{} %% \ifpxcz@uptex \newif\ifpxcz@uptex \pxcz@uptexfalse \edef\pxcz@tmpa{\string\ucs}\edef\pxcz@tmpb{\meaning\ucs} \ifx\pxcz@tmpa\pxcz@tmpb \pxcz@uptextrue \fi %% \pxcz@JYn \edef\pxcz@JYn{% \ifpxcz@uptex JY2\else JY1\fi} %% \ifpxcz@otf@deluxe \newif\ifpxcz@otf@deluxe \pxcz@otf@deluxefalse \@ifpackagewith{otf}{deluxe}{\pxcz@otf@deluxetrue}{} \@ifpackagewith{pxotf}{deluxe}{\pxcz@otf@deluxetrue}{} %% \ifpxcz@otf@multi \newif\ifpxcz@otf@multi \pxcz@otf@multifalse \@ifpackagewith{otf}{multi}{\pxcz@otf@multitrue}{} %% \ifpxcz@otf@expert \newif\ifpxcz@otf@expert \pxcz@otf@expertfalse \@ifpackagewith{otf}{expert}{\pxcz@otf@experttrue}{} %% \pxcz@pxufont@avail \IfFileExists{pxufont-ruby.sty}{\chardef\pxcz@pxufont@avail=2 }{% \IfFileExists{pxufont.sty}{\chardef\pxcz@pxufont@avail=1 }{% \chardef\pxcz@pxufont@avail=0 }} %% \pxcz@pxufont@loaded \@ifpackageloaded{pxufont}{% \ifx t\pxufontUseRubyFont \chardef\pxcz@pxufont@loaded=2 \else \chardef\pxcz@pxufont@loaded=1 \fi }{%else \chardef\pxcz@pxufont@loaded=0 } %% \ifpxcz@old@hook@system \newif\ifpxcz@old@hook@system \@ifl@t@r\fmtversion{2020/10/01}{}{\pxcz@old@hook@systemtrue} %--------------------------------------- custom presets %% \pxcz@custom@presets \pxcz@onlypreamble@let\pxcz@custom@presets\@empty %% \pxcz@custom@apply@opt@unicode \pxcz@onlypreamble@let\pxcz@custom@apply@opt@unicode\@empty %% freeze \pxcz@onlypreamble@let\pxcz@custom\relax \let\pxcz@uniweight\relax \let\pxcz@multiweight\relax %% \pxcz@check@avail@custom@presets \pxcz@onlypreamble@let\pxcz@check@avail@custom@presets\relax \AtEndOfPackage{% \def\pxcz@check@avail@custom@presets#1#2#3{% \PackageError\pxcz@pkgname {Custom presets cannot be registered after\MessageBreak loading pxchfon package}% {\@eha}}} %% \pxcz@declare@oneweight@preset{}{}{} \pxcz@onlypreamble@def\pxcz@declare@oneweight@preset#1#2#3{% \pxcz@check@avail@custom@presets \xdef\pxcz@custom@presets{\pxcz@custom@presets \pxcz@custom{#1}{\pxcz@uniweight{#2}{#3}}}} %% \pxcz@declare@multiweight@preset{}{}...{} \pxcz@onlypreamble@def\pxcz@declare@multiweight@preset#1#2#3#4#5#6#7#8#9{% \pxcz@check@avail@custom@presets \xdef\pxcz@custom@presets{\pxcz@custom@presets \pxcz@custom{#1}{\pxcz@multiweight{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}}} %%<+> \pxchfonDeclareOneWeightPreset{}{}{} \@onlypreamble\pxchfonDeclareOneWeightPreset \newcommand*\pxchfonDeclareOneWeightPreset[1]{% \pxcz@declare@oneweight@preset{user:#1}} %%<+> \pxchfonDeclareMultiWeightPreset{}{}...{} \@onlypreamble\pxchfonDeclareMultiWeightPreset \newcommand*\pxchfonDeclareMultiWeightPreset[1]{% \pxcz@declare@multiweight@preset{user:#1}} %% Load custom preset definitions \IfFileExists{pxchfon-extras.def}{% PXchfon-extras \PackageInfo\pxcz@pkgname {Extra preset settings are loaded\@gobble}% \input{pxchfon-extras.def}% }{} \IfFileExists{pxchfon.cfg}{% of user \PackageInfo\pxcz@pkgname {Custom preset settings are loaded\@gobble}% \begingroup \makeatother\input{pxchfon.cfg}% \endgroup }{} %--------------------------------------- handle options %% variables \newif\ifpxcz@enabled \pxcz@enabledtrue \let\pxcz@alphabet=n \newif\ifpxcz@otf \pxcz@otftrue \newif\ifpxcz@cmap@alpha \newif\ifpxcz@mmivjis \newif\ifpxcz@everypage \newif\ifpxcz@oneweight \newif\ifpxcz@uniquify \newif\ifpxcz@fullwidth \let\pxcz@directunicode\relax \let\pxcz@main@preset\relax \let\pxcz@file@preset\relax \newif\ifpxcz@file@preset@tl \newif\ifpxcz@alpha \newif\ifpxcz@rel \newif\ifpxcz@dumpmap \newif\ifpxcz@dumpmap@tl \newif\ifpxcz@switch@font \pxcz@switch@fonttrue \newif\ifpxcz@switch@font@xwid \newif\ifpxcz@switch@font@xjis \let\pxcz@strict@csi\relax \newif\ifpxcz@directunicode@default \let\pxcz@legacycode\relax \let\pxcz@expert\relax \newif\ifpxcz@glyphid %% process options % drivers \DeclareOption{nodvidriver}{\pxcz@enabledfalse} \DeclareOption{dvips}{\pxcz@enabledfalse} \DeclareOption{dviout}{\pxcz@enabledfalse} \DeclareOption{xdvi}{\pxcz@enabledfalse} \DeclareOption{dvipdfmx}{\pxcz@enabledtrue} % (no)alphabet / relfont \DeclareOption{alphabet}{\let\pxcz@alphabet=t} \DeclareOption{noalphabet}{\let\pxcz@alphabet=f} \DeclareOption{relfont}{\let\pxcz@alphabet=r} % (no)otf \DeclareOption{otf}{\pxcz@otftrue} \DeclareOption{nootf}{\pxcz@otffalse} \DeclareOption{utf}{\pxcz@otftrue} \DeclareOption{noutf}{\pxcz@otffalse} % (no)usecmapforalphabet \DeclareOption{usecmapforalphabet}{\pxcz@cmap@alphatrue} \DeclareOption{nousecmapforalphabet}{\pxcz@cmap@alphafalse} % (no)prefer2004jis / (no)jis2004 \DeclareOption{prefer2004jis}{\pxcz@mmivjistrue} \DeclareOption{noprefer2004jis}{\pxcz@mmivjisfalse} \DeclareOption{jis2004}{\pxcz@mmivjistrue} \DeclareOption{nojis2004}{\pxcz@mmivjisfalse} % (no)everypage \DeclareOption{everypage}{\pxcz@everypagetrue} \DeclareOption{noeverypage}{\pxcz@everypagefalse} % (no)oneweight \DeclareOption{oneweight}{\pxcz@oneweighttrue} \DeclareOption{nooneweight}{\pxcz@oneweightfalse} % (no)directunicode / directunicode* \chardef\pxcz@directunicode@none=0 \chardef\pxcz@directunicode@otf=1 \chardef\pxcz@directunicode@all=2 \chardef\pxcz@directunicode@full=3 \DeclareOption{directunicode*}{\let\pxcz@directunicode\pxcz@directunicode@all} \DeclareOption{directunicode}{\let\pxcz@directunicode\pxcz@directunicode@otf} \DeclareOption{nodirectunicode}{\let\pxcz@directunicode\pxcz@directunicode@none} % (no)dumpmap \DeclareOption{dumpmap}{\pxcz@dumpmaptrue} \DeclareOption{nodumpmap}{\pxcz@dumpmapfalse} % (no)dumpmaptl \DeclareOption{dumpmaptl}{\pxcz@dumpmap@tltrue} \DeclareOption{nodumpmaptl}{\pxcz@dumpmap@tlfalse} % (no)switchfont \DeclareOption{switchfont}{\pxcz@switch@fonttrue} \DeclareOption{noswitchfont}{\pxcz@switch@fontfalse} % (no)strictcsi \DeclareOption{strictcsi}{\let\pxcz@strict@csi=t} \DeclareOption{nostrictcsi}{\let\pxcz@strict@csi=f} % XXXXX-legacycode \chardef\pxcz@legacycode@apply=0 \chardef\pxcz@legacycode@ignore=1 \chardef\pxcz@legacycode@suppress=2 \chardef\pxcz@legacycode@replace=3 \DeclareOption{apply-legacycode}{\let\pxcz@legacycode\pxcz@legacycode@apply} \DeclareOption{ignore-legacycode}{\let\pxcz@legacycode\pxcz@legacycode@ignore} \DeclareOption{suppress-legacycode}{\let\pxcz@legacycode\pxcz@legacycode@suppress} \DeclareOption{replace-legacycode}{\let\pxcz@legacycode\pxcz@legacycode@replace} % (no)expert \DeclareOption{expert}{\let\pxcz@expert=t} \DeclareOption{noexpert}{\let\pxcz@expert=f} % (no)glyphid \DeclareOption{glyphid}{\pxcz@glyphidtrue} \DeclareOption{noglyphid}{\pxcz@glyphidfalse} % preset spec options \pxcz@onlypreamble@def\pxcz@all@main@preset{% noembed,% %(uniweight) ms,ipa,ipaex,% %(multiweight) ms-hg,ipa-hg,ipaex-hg,moga-mobo,moga-mobo-ex,moga-maruberi,ume,% kozuka-pro,kozuka-pr6,kozuka-pr6n,hiragino-pro,hiragino-pron,% hiragino-elcapitan-pro,hiragino-elcapitan-pron,% morisawa-pro,morisawa-pr6n,yu-win,yu-win10,yu-win10+,yu-osx,% sourcehan-otc,sourcehan,sourcehan-jp,noto-otc,noto,noto-jp,% haranoaji,% sourcehan-otc+,sourcehan+,noto-otc+,noto+,% sourcehan-otc!,sourcehan!,sourcehan-jp!,noto-otc!,noto!,noto-jp!,% noto-otf!,% %(alias) hiragino,noto-otf,% noEmbed,kozuka,hiragino-elcapitan,morisawa} \pxcz@onlypreamble@def\pxcz@all@abolished@preset{% ipa-otf,ipa-otf-dx,kozuka4,kozuka6,kozuka6n, ms-dx,ipa-ttf,ipa-ttf-dx,ipav2,ipav2-dx,ipa-dx,hiragino-dx} \def\pxcz@do#1{\DeclareOption{#1}{\def\pxcz@main@preset{#1}}} \@for\pxcz@x:=\pxcz@all@main@preset\do{% \expandafter\pxcz@do\expandafter{\pxcz@x}} \@for\pxcz@x:=\pxcz@all@abolished@preset\do{% \expandafter\pxcz@do\expandafter{\pxcz@x}} \def\pxcz@custom#1#2{\pxcz@do{#1}} \pxcz@custom@presets %% 'local-only' constant options % The 'unicode' option means a Unicode-oriented mapping, and requires % dvipdfmx of version 20170918 or later. The 'unicode-fwid' is a variant. % The 'unicode*(-fwid)' option is a transitional (deteriorated) version % of 'unicode(-fwid)' and can work with dvipdfmx of version 20170318. % NOTE: 'unicode*(-fwid)' is DEPRECATED and will be abolished in v2.0. \pxcz@onlypreamble@csdef{pxcz@POPT/unicode}{% \let\pxcz@directunicode\pxcz@directunicode@full} \pxcz@onlypreamble@csdef{pxcz@POPT/unicode*}{% \pxcz@uniquifytrue \let\pxcz@directunicode\pxcz@directunicode@full} \pxcz@onlypreamble@csdef{pxcz@POPT/unicode-fwid}{% \pxcz@fullwidthtrue \let\pxcz@directunicode\pxcz@directunicode@full} \pxcz@onlypreamble@csdef{pxcz@POPT/unicode*-fwid}{% \pxcz@fullwidthtrue \pxcz@uniquifytrue \let\pxcz@directunicode\pxcz@directunicode@full} % general option handler \DeclareOption*{% \pxcz@csuse@or{pxcz@POPT/\CurrentOption}{% \pxcz@parse@opt\CurrentOption \ifpxcz@ok\else \@unknownoptionerror \fi}} %% \pxcz@use@list \pxcz@onlypreamble@let\pxcz@use@list\@empty \let\pxcz@use@do\relax %freeze %% \pxcz@parse@opt{