%%
%% This is file 'pxchfon.sty'.
%%
%% Copyright (c) 2009-2024 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}[2024/08/22 v2.2]
\def\pxcz@pkgname{pxchfon}

%--------------------------------------- general

%% packages
\RequirePackage{keyval}

%% variables
\newif\ifpxcz@ok
\newif\ifpxcz@utf
\let\pxcz@value\relax
\let\pxcz@pre\relax
\let\pxcz@post\relax

%% unique tokens
\def\pxcz@end{\pxcz@end@}
\def\pxcz@mt{\pxcz@mt@}
\toksdef\pxcz@mk=9 % unexpandable

%% \pxcz@letcs\CSa{<cs2>}
\def\pxcz@letcs#1#2{%
  \expandafter\let\expandafter#1\csname#2\endcsname}
%% \pxcz@csletcs{<cs1>}{<cs2>}
\def\pxcz@csletcs#1#2{%
  \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}

%% \pxcz@cond\ifXXX...\fi{<true>}{<false>}
\@gobbletwo\if\if \def\pxcz@cond#1\fi{%
  #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}

%% \pxcz@onlypreamble@csdef{<csname>}
\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@first@doc@hook
% Invoked earlier than \pxcz@doc@hook.
\pxcz@onlypreamble@let\pxcz@first@doc@hook\@empty
\AtBeginDocument{\pxcz@first@doc@hook}

%% \pxcz@new@gbool{<name>}
\pxcz@onlypreamble@def\pxcz@new@gbool#1{%
  \expandafter\pxcz@new@gbool@a\csname if#1\endcsname{#1}}
\pxcz@onlypreamble@def\pxcz@new@gbool@a#1#2{%
  \@namedef{#2true}{\global\let#1\iftrue}%
  \@namedef{#2false}{\global\let#1\iffalse}%
  \@nameuse{#2false}}\@gobbletwo\fi\fi

%% \pxcz@csuse@or{<csname>}{<default>}
\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@setkeys{<kv-family>}{<text>}{<error>}
\pxcz@onlypreamble@def\pxcz@setkeys#1#2#3{%
  \let\KV@errx#3%
  \edef\pxcz@do{\noexpand\setkeys{#1}{#2}}\pxcz@do
  \let\KV@errx\pxcz@org@KV@errx}
\let\pxcz@org@KV@errx\KV@errx

%% \pxcz@handle@mt@kvopt{<key>}{<value>}{<code>}
\pxcz@onlypreamble@def\pxcz@handle@mt@kvopt#1#2#3{%
  \ifx\pxcz@mt#2\pxcz@mt #3%
  \else
    \PackageError\pxcz@pkgname
     {No value allowed for key '#1'}%
     {\@ehc}%
  \fi}

%% \pxcz@handle@kvopt{<key>}{<cs-key>}{<value>}{<code>}
%% \pxcz@handle@bool@kvopt{<key>}{<cs-key>}{<value>}
\pxcz@onlypreamble@def\pxcz@handle@kvopt{%
  \pxcz@handle@kvopt@a{@@}}
\pxcz@onlypreamble@def\pxcz@handle@bool@kvopt#1#2#3{%
  \pxcz@handle@kvopt@a{}{#1}{#2}{#3}{\pxcz@value}}
\pxcz@onlypreamble@def\pxcz@handle@kvopt@a#1#2#3#4{%
  \@nameuse{pxcz@#3@giventrue}%
  \pxcz@letcs\pxcz@value{pxcz@#3#1#4}%
  \ifx\pxcz@value\relax
    \PackageError\pxcz@pkgname
     {Invalid value for key '#2'\MessageBreak (#4)}%
     {\@ehc}%
    \expandafter\@gobble
  \else \expandafter\@firstofone
  \fi}

%% \pxcz@split{<at>}{<target>}
\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}}

%% \pxcz@let@jchar@token\CS{<code>}
\pxcz@onlypreamble@def\pxcz@let@jchar@token#1#2{%
  \begingroup
    \kansujichar1=#2\relax \kcatcode#2=18\relax
    \xdef\pxcz@g@tmpa{\kansuji1}%
  \endgroup
  \let#1=\pxcz@g@tmpa}

%% \pxcz@geta
\pxcz@let@jchar@token\pxcz@geta{\jis"222E}

%% \pxcz@Z\newrobustcmd*\CS...
% On e-TeX engines, it simply does \newrobustcmd*;
% otherwise it does \DeclareRobustCommand* with 'new' check.
\pxcz@onlypreamble@def\pxcz@Z\newrobustcmd*#1{%
  \pxcz@okfalse
  \@ifdefinable{#1}{\pxcz@oktrue}%
  \pxcz@cond\ifpxcz@ok\fi
    {\DeclareRobustCommand*#1}{\providecommand*\pxcz@mt}%
}

%% \pxcz@PackageNoteNoLine
\ifx\PackageNoteNoLine\@undefined
  \let\pxcz@PackageNoteNoLine\PackageWarningNoLine
\else
  \let\pxcz@PackageNoteNoLine\PackageNoteNoLine
\fi

%--------------------------------------- environment check

%%<+> \pxchfonNoCheckMultiweight
% If defined, skips the check for using multi-weight settings
% without loading japanese-otf package with 'deluxe'.
%(keep unchanged)

%%<+> \pxchfonNoCheckExpert
% If defined, skips the check for using expert settings without
% substituting all weights.
%(keep unchanged)

%% check for 'pxjafont' package
\@ifpackageloaded{pxjafont}{%
  \PackageError\pxcz@pkgname
   {Old 'pxjafont' is loaded}{\@ehc}
  \endinput}{}

%% \ifpxcz@uptex
\newif\ifpxcz@uptex \pxcz@uptexfalse
\def\pxcz@do#1#2{%
  \edef\pxcz@tmpa{\string#1}\edef\pxcz@tmpb{\meaning#1}%
  \ifx\pxcz@tmpa\pxcz@tmpb #2\fi}
\pxcz@do\ucs{%
  \pxcz@do\ptexversion{\pxcz@uptextrue}
  \pxcz@do\kchardef{\pxcz@uptextrue}
  % only upTeX in Unicode is seen as upTeX
  \ifnum\ucs"3000="3000 \else \pxcz@uptexfalse \fi}
%% \ifpxcz@etex
\newif\ifpxcz@etex \pxcz@etexfalse
\pxcz@do\eTeXversion{\pxcz@etextrue}
%% \ifpxcz@etoolbox
\newif\ifpxcz@etoolbox
\ifpxcz@etex
  \IfFileExists{etoolbox.sty}{%
    \RequirePackage{etoolbox}[2011/01/03]% v2.1
    \pxcz@etoolboxtrue
    \let\pxcz@Z\@empty
  }{}
\fi

%% \pxcz@JYn
\edef\pxcz@JYn{%
  \ifpxcz@uptex JY2\else JY1\fi}

%% \ifpxcz@lite@mode
\newif\ifpxcz@lite@mode
\IfFileExists{pxchfon0.def}{}{%else
  \PackageInfo\pxcz@pkgname
   {Working in Lite mode\@gobble}%
  \pxcz@lite@modetrue}

%% \ifpxcz@otf@loaded
%% \pxcz@otf@weight: otf weight mode
\newif\ifpxcz@otf@loaded \pxcz@otf@loadedtrue
% watch out for priority...
\@ifpackagewith{otf}{deluxe}{%
  \let\pxcz@otf@weight=d
}{\@ifpackagewith{otf}{bold}{%
  \let\pxcz@otf@weight=b
}{\@ifpackagewith{otf}{expert}{%
  \let\pxcz@otf@weight=r % 'expert' cancels 'noreplace'
}{\@ifpackagewith{otf}{noreplace}{%
  \let\pxcz@otf@weight=n
}{\@ifpackageloaded{otf}{%
  \let\pxcz@otf@weight=r
}{%else
  \pxcz@otf@loadedfalse \let\pxcz@otf@weight=n
}}}}}

%% \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}{}

%% \ifpxcz@otf@mmivjis: 'jis2004' of otf is used?
\newif\ifpxcz@otf@mmivjis \pxcz@otf@mmivjisfalse
\@ifpackagewith{otf}{jis2004}{\pxcz@otf@mmivjistrue}{}

%% \pxcz@jascale
\ifpxcz@uptex % do not consider JFM scale
  \let\pxcz@jascale\utf@sc@le
  \ifx\pxcz@jascale\@undefined
    \let\pxcz@jascale\Cjascale
  \fi
  \ifx\pxcz@jascale\@undefined
    \edef\pxcz@jascale{\ifx\jsc@JYn\@undefined 0.962216\else 0.924715\fi}%
  \fi
\fi

%% \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}

%% \pxcz@hy@disable@commands{<code>}
\pxcz@onlypreamble@def\pxcz@hy@disable@commands{%
  \providecommand*\pdfstringdefPreHook{}%
  \g@addto@macro\pdfstringdefPreHook}

%--------------------------------------- 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{<name>}{<f-mc>}{<f-gt>}
\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{<name>}{<f-1>}...{<f-8>}
\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{<name>}{<f-mc>}{<f-gt>}
\@onlypreamble\pxchfonDeclareOneWeightPreset
\newcommand*\pxchfonDeclareOneWeightPreset[1]{%
  \pxcz@declare@oneweight@preset{user:#1}}
%%<+> \pxchfonDeclareMultiWeightPreset{<name>}{<f-1>}...{<f-8>}
\@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\relax
\newif\ifpxcz@otf \pxcz@otftrue
\newif\ifpxcz@cmap@alpha
\pxcz@new@gbool{pxcz@mmivjis}
\newif\ifpxcz@everypage
\newif\ifpxcz@oneweight
\newif\ifpxcz@fullwidth
\let\pxcz@unicode\relax
\let\pxcz@main@preset\relax
\let\pxcz@file@preset\relax
\newif\ifpxcz@file@preset@tl
\newif\ifpxcz@dumpmap
\newif\ifpxcz@dumpmap@tl
\newif\ifpxcz@switch@font \pxcz@switch@fonttrue
\newif\ifpxcz@switch@font@xjis
\let\pxcz@strict@csi\relax
\newif\ifpxcz@unicode@given
\let\pxcz@legacycode\relax
\newif\ifpxcz@legacycode@replace
\newif\ifpxcz@legacycode@replace@given
\let\pxcz@expert\relax
\chardef\pxcz@glyphid\z@
\newif\ifpxcz@autojfmsync

%% \pxcz@invalid@opt{<key>}
\pxcz@onlypreamble@def\pxcz@invalid@opt#1{%
  \@unknownoptionerror}

%% process options
% drivers
\DeclareOption{nodvidriver}{\pxcz@enabledfalse}
\DeclareOption{resetdvidriver}{\pxcz@enabledtrue}
\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}
% unicode=<name>
\chardef\pxcz@unicode@@false=0
\chardef\pxcz@unicode@@UTF=1
\chardef\pxcz@unicode@@simple=2
\chardef\pxcz@unicode@@full=3
\chardef\pxcz@unicode@@true=\pxcz@unicode@@full
\define@key{pxchfon}{unicode}[true]{%
  \pxcz@handle@kvopt{unicode}{unicode}{#1}{%
    \let\pxcz@unicode\pxcz@value}}
\DeclareOption{nounicode}{\setkeys{pxchfon}{unicode=false}}
% (old options)
\DeclareOption{directunicode*}{\setkeys{pxchfon}{unicode=simple}}
\DeclareOption{directunicode}{\setkeys{pxchfon}{unicode=UTF}}
\DeclareOption{nodirectunicode}{\setkeys{pxchfon}{unicode=false}}
% (no)fullwidth
\DeclareOption{fullwidth}{\pxcz@fullwidthtrue}
\DeclareOption{nofullwidth}{\pxcz@fullwidthfalse}
% (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}
% legacycode=<name>
\chardef\pxcz@legacycode@@apply=0
\chardef\pxcz@legacycode@@ignore=1
\chardef\pxcz@legacycode@@suppress=2
\define@key{pxchfon}{legacycode}{%
  \pxcz@handle@kvopt{legacycode}{legacycode}{#1}{%
    \let\pxcz@legacycode\pxcz@value}}
% legacycode-replace=<bool>
\define@key{pxchfon}{legacycode-replace}[true]{%
  \pxcz@handle@bool@kvopt{legacycode-replace}{legacycode@replace}{#1}}
% (no)expert
\DeclareOption{expert}{\let\pxcz@expert=t}
\DeclareOption{noexpert}{\let\pxcz@expert=f}
% (no)glyphid
\DeclareOption{glyphid}{\chardef\pxcz@glyphid=2 }
\DeclareOption{noglyphid}{\chardef\pxcz@glyphid=0 }
% (no)autojfmsync
\DeclareOption{autojfmsync}{\pxcz@autojfmsynctrue}
\DeclareOption{noautojfmsync}{\pxcz@autojfmsyncfalse}
% maybe-multiweight
\DeclareOption{maybe-multiweight}{\let\pxchfonNoCheckMultiweight=t}
% nocheck-expert
\DeclareOption{nocheck-expert}{\let\pxchfonNoCheckExpert=t}
% use=<spec>
\define@key{pxchfon}{use}{%
  \pxcz@okfalse
  \pxcz@split{:}{#1}\ifx\pxcz@pre\relax
    \pxcz@handle@use@b{file}{#1}%
  \else
    \pxcz@handle@use@a{file}{file}%
    \pxcz@handle@use@a{tl-ja}{ja}%
    \pxcz@handle@use@a{tl-ko}{ko}%
    \pxcz@handle@use@a{tl-sc}{sc}%
    \pxcz@handle@use@a{tl-tc}{tc}%
    \pxcz@handle@use@a{tl}{ja}%
  \fi
  \ifpxcz@ok\else
    \PackageError\pxcz@pkgname
     {The value for option 'use' has an invalid prefix:\MessageBreak
      ('\pxcz@pre:')}%
     {\@ehc}%
  \fi}
\pxcz@onlypreamble@def\pxcz@handle@use@a#1#2{%
  \ifpxcz@ok\else
    \def\pxcz@tmpb{#1}\ifx\pxcz@pre\pxcz@tmpb
      \pxcz@handle@use@b{#2}{\pxcz@post}%
  \fi\fi}
\pxcz@onlypreamble@def\pxcz@handle@use@b#1#2{%
  \edef\pxcz@use@list{\pxcz@use@list\pxcz@use@do{#1}{#2}}%
  \pxcz@oktrue}

% 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-osx,%
  sourcehan-otc,sourcehan,sourcehan-jp,noto-otc,noto,noto-jp,%
  haranoaji,%
  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{%
  sourcehan+,sourcehan-otc+,noto+,noto-otc+,yu-win10+,
  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 ABOLISHED.
\define@key{pxchfon}{unicode*}[]{%
  \PackageError\pxcz@pkgname
   {Option 'unicode*' is ABOLISHED!\MessageBreak
    You should update to TL2018 or later and use\MessageBreak
    option 'unicode' instead}%
   {This option was to invoke a transitional setting\MessageBreak
    that was specially tailored for TL2017.\MessageBreak
    \@ehc}}
% general option handler
\DeclareOption*{%
  \pxcz@parse@opt\CurrentOption
  \ifpxcz@ok\else
    \pxcz@setkeys{pxchfon}{\CurrentOption}\pxcz@invalid@opt
  \fi}

%% \pxcz@use@list
\pxcz@onlypreamble@let\pxcz@use@list\@empty
\let\pxcz@use@do\relax %freeze

%% \pxcz@parse@opt{<option>}
\pxcz@onlypreamble@def\pxcz@parse@opt#1{%
  \pxcz@okfalse
  \pxcz@parse@opt@a{+}{#1}{\pxcz@file@preset@tltrue}%
  \pxcz@parse@opt@a{*}{#1}{\pxcz@file@preset@tlfalse}%
  \pxcz@parse@opt@a{tl:}{#1}{\pxcz@file@preset@tltrue}%
  \pxcz@parse@opt@a{file:}{#1}{\pxcz@file@preset@tlfalse}}
\pxcz@onlypreamble@def\pxcz@parse@opt@a#1#2#3{% for file presets
  \ifpxcz@ok\else
    \pxcz@split{#1}{#2}\ifx\pxcz@pre\@empty
      #3\let\pxcz@file@preset\pxcz@post \pxcz@oktrue
    \fi
  \fi}
\pxcz@onlypreamble@def\pxcz@parse@opt@a#1#2#3{%
  \ifpxcz@ok\else
    \pxcz@split{#1}{#2}\ifx\pxcz@pre\@empty
      #3\let\pxcz@file@preset\pxcz@post \pxcz@oktrue
    \fi
  \fi}

%% dispatch
\ProcessOptions*

%% adjust \pxcz@pxufont@avail
\ifpxcz@enabled\else
  % pxufont-ruby (virtually) requires dvipdfmx.
  % (But if it is already loaded, it cannot be helped.)
  \ifnum\pxcz@pxufont@avail=2 \ifnum\pxcz@pxufont@loaded<2
    \chardef\pxcz@pxufont@avail=1
  \fi\fi
\fi

%% 'everypage' needs 'atbegshi' package
\ifpxcz@everypage \ifpxcz@old@hook@system
\RequirePackage{atbegshi}
\fi\fi

%% apply default value for \pxcz@unicode
\ifpxcz@unicode@given\else
  \let\pxcz@unicode\pxcz@unicode@@false
  \ifnum\pxcz@pxufont@loaded>0
    \pxcz@PackageNoteNoLine\pxcz@pkgname
     {Option 'unicode' is enabled, since the package\MessageBreak
      'pxufont' is already loaded}
    \let\pxcz@unicode\pxcz@unicode@@full
  \fi
\fi

%% set 'pxcz@alpha'
%% apply default value for \pxcz@alphabet
\if\pxcz@alphabet\relax
  \ifx\pxcz@main@preset\relax \ifx\pxcz@file@preset\relax
    \PackageWarningNoLine\pxcz@pkgname
     {No preset is given and options for alphabetic\MessageBreak
      fonts ('alphabet'/'noalphabet'/'relfont') are\MessageBreak
      omitted. Here 'alphabet' will be assumed, but\MessageBreak
      such omission is now DEPRECATED and the behavior\MessageBreak
      might be changed in future!!\MessageBreak
      You must write the option 'alphabet' explicitly}
    \let\pxcz@alphabet=t
  \fi\fi
  \if\pxcz@alphabet\relax
    \let\pxcz@alphabet=f
  \fi
\fi

%% \ifpxcz@alphafont
% Whether or not alphabet fonts are used.
\newif\ifpxcz@alphafont
\if f\pxcz@alphabet \else \pxcz@alphafonttrue \fi
\ifpxcz@alphafont\ifpxcz@lite@mode
  \PackageError\pxcz@pkgname
   {Font settings for alphabetic logical fonts\MessageBreak
    are not supported in Lite edition}%
   {You must install full edition of PXchfon bundle.}%
  \pxcz@alphafontfalse \let\pxcz@alphabet=f
\fi\fi

%% apply default for \pxcz@strict@csi
\ifx\pxcz@strict@csi\relax
  % 'dumpmap(tl)' changes the 'strictcsi' default to true.
  \let\pxcz@strict@csi=f
  \ifpxcz@dumpmap \let\pxcz@strict@csi=t \fi
  \ifpxcz@dumpmap@tl \let\pxcz@strict@csi=t \fi
\fi
\if t\pxcz@strict@csi
  % 'strictcsi' requires some pdfTeX feature.
  \ifx\pdffiledump\@undefined
    \PackageWarningNoLine\pxcz@pkgname
     {The option 'strictcsi' cannot be used, because\MessageBreak
      the engine does not support '\string\pdffiledump'}
    \let\pxcz@strict@csi=f
  \fi
\fi

%% apply 'switch@font'
\ifpxcz@switch@font
  \pxcz@switch@font@xjistrue
\else
  \let\pxcz@switch@font@xjistrue\pxcz@switch@font@xjisfalse
\fi

%--------------------------------------- preset-dependent setup

%% \pxcz@warn@unless@all@defined@for
% The \do-list of names of problematic features.
\pxcz@onlypreamble@let\pxcz@warn@unless@all@defined@for\@empty
%% \pxcz@warn@unless@all@embedded@for
% The \do-list of names of problematic features.
\pxcz@onlypreamble@let\pxcz@warn@unless@all@embedded@for\@empty

%% \pxcz@apply@opt@unicode
% Forces the 'unicode' setup (unless a directunicode option was given).
\pxcz@onlypreamble@def\pxcz@apply@opt@unicode{%
  \ifpxcz@unicode@given\else % default -> unicode
    \pxcz@warn@unicode
    \let\pxcz@unicode\pxcz@unicode@@full
  \fi}
%% \pxcz@warn@unicode
\pxcz@onlypreamble@def\pxcz@warn@unicode{%
  \pxcz@PackageNoteNoLine\pxcz@pkgname
   {The option 'unicode' is enforced, because the\MessageBreak
    preset '\pxcz@main@preset' is selected.}}

%% the setup
\def\pxcz@do#1{%
  \edef\pxcz@tmpa{#1}%
  \pxcz@cond\ifx\pxcz@main@preset\pxcz@tmpa\fi
      {\@firstofone}{\@gobble}}
% 'sourcehan(-otc)' and 'noto(-otc)' force 'unicode' setting.
\pxcz@do{sourcehan}{\pxcz@apply@opt@unicode}
\pxcz@do{sourcehan-otc}{\pxcz@apply@opt@unicode}
\pxcz@do{sourcehan-jp}{\pxcz@apply@opt@unicode}
\pxcz@do{noto}{\pxcz@apply@opt@unicode}
\pxcz@do{noto-otf}{\pxcz@apply@opt@unicode}
\pxcz@do{noto-otc}{\pxcz@apply@opt@unicode}
\pxcz@do{noto-jp}{\pxcz@apply@opt@unicode}
\pxcz@custom@apply@opt@unicode
% No-embed is not supported under the 'unicode' setup
\ifnum\pxcz@unicode=\pxcz@unicode@@full
  \g@addto@macro\pxcz@warn@unless@all@embedded@for{%
    \do{Direct Unicode spec ('unicode')}}
\fi

%% apply default for pxcz@legacycode@replace
\ifpxcz@legacycode@replace@given\else
  \ifnum\pxcz@unicode=\pxcz@unicode@@full
    \pxcz@legacycode@replacetrue
  \fi
\fi

%% apply default for \pxcz@legacycode
\ifx\pxcz@legacycode\relax
  \ifpxcz@legacycode@replace
    \let\pxcz@legacycode\pxcz@legacycode@@suppress
  \else \let\pxcz@legacycode\pxcz@legacycode@@apply
  \fi
\fi

%% 'lecacycode=replace' requires the 'pxufont' package
\ifpxcz@legacycode@replace
  \ifnum\pxcz@pxufont@avail<1
    \PackageError\pxcz@pkgname
     {The option 'lecacycode-replace' requires the 'pxufont'\MessageBreak
       package, but it is not installed}%
     {\@ehc}
    \pxcz@legacycode@replacefalse
  \fi
\fi

%% check requirements for 'glyphid'
\ifnum\pxcz@glyphid>0
  \pxcz@oktrue
  \ifpxcz@enabled\else \pxcz@okfalse \fi
  \ifpxcz@legacycode@replace\else \pxcz@okfalse \fi
  \ifnum\pxcz@unicode<\pxcz@unicode@@simple \pxcz@okfalse \fi
  \ifpxcz@uptex\else \pxcz@okfalse \fi
  \ifnum\pxcz@pxufont@avail<2 \pxcz@okfalse \fi
  \ifpxcz@ok\else
    \PackageWarningNoLine\pxcz@pkgname
     {The option 'glyphid' will not work. You must\MessageBreak
      use upLaTeX and the 'unicode' option, and package\MessageBreak
      'pxufont' of v0.5 or later must be installed}
    \chardef\pxcz@glyphid=1 % fallback mode
  \fi
\fi

%% check requirements for 'expert'
\pxcz@oktrue
\ifpxcz@legacycode@replace\else \pxcz@okfalse \fi
\ifnum\pxcz@unicode=\pxcz@unicode@@full\else \pxcz@okfalse \fi
\ifnum\pxcz@pxufont@avail<2 \pxcz@okfalse \fi
\ifpxcz@ok\else
  \if t\pxcz@expert % explicitly given
    \PackageError\pxcz@pkgname
     {The option 'expert' cannot be used here. You must\MessageBreak
      use upLaTeX and the 'unicode' option, and package\MessageBreak
      'pxufont' of v0.5 or later must be installed}
     {\@ehc}
  \fi
  \let\pxcz@expert=f
\fi

%% apply default for \pxcz@expert
\ifpxcz@otf@expert
  \ifx\pxcz@expert\relax
    \let\pxcz@expert=t
  \fi
\else
  \if t\pxcz@expert
    \PackageWarningNoLine\pxcz@pkgname
     {The 'expert' option will be ignored, since the\MessageBreak
      expert mode of the 'otf' package is not enabled}
  \fi
  \let\pxcz@expert=f
\fi
\g@addto@macro\pxcz@first@doc@hook{%
  \if t\pxcz@expert \ifx\pxchfonNoCheckExpert\@undefined
    \g@addto@macro\pxcz@warn@unless@all@defined@for{%
      \do{Expert glyph shapes ('expert')}}%
  \fi\fi}

%--------------------------------------- '\pxchfonsetup'

%% errors
\pxcz@onlypreamble@def\pxcz@err@ivsky#1{%
  \PackageError\pxcz@pkgname
   {Unknown key: #1}%
   {\@ehc}}

%% 'jis2004=<bool>'
\define@key{pxchfonS}{jis2004}[true]{%
  \pxcz@handle@bool@kvopt{jis2004}{mmivjis}{#1}}
%% 'maybe-multiweight'
\define@key{pxchfonS}{maybe-multiweight}[]{%
  \pxcz@handle@mt@kvopt{maybe-multiweight}{#1}{%
    \global\let\pxchfonNoCheckMultiweight=t}}
%% 'nocheck-expert'
\define@key{pxchfonS}{nocheck-expert}[]{%
  \pxcz@handle@mt@kvopt{nocheck-expert}{#1}{%
    \global\let\pxchfonNoCheckExpert=t}}

%%<*> \pxchfonsetup{<text>}
\@onlypreamble\pxchfonsetup
\pxcz@Z\newrobustcmd*\pxchfonsetup[1]{%
  \pxcz@setkeys{pxchfonS}{#1}\pxcz@err@ivsky}

%--------------------------------------- user interface

%% variables
\newif\ifpxcz@deluxe@used

%% \pxcz@sym@list
\def\pxcz@sym@list{%
  mnl,mnr,mnb,gtr,gtb,gtx,gtu,mgr,%
  koml,komr,komb,kogr,kogb,kogx,kogu,komgr,%
  scml,scmr,scmb,scgr,scgb,scgx,scgu,scmgr,%
  tcml,tcmr,tcmb,tcgr,tcgb,tcgx,tcgu,tcmgr}

%%<*> \setminchofont/\setgothicfont/etc.
% japanese
\pxcz@Z\newrobustcmd*\setminchofont{\pxcz@setfont{mnl,mnr,mnb}}
\pxcz@Z\newrobustcmd*\setgothicfont{\pxcz@setfont{gtr,gtb,gtx,gtu}}
\pxcz@Z\newrobustcmd*\setlightminchofont{\pxcz@setdf{mnl}}
\pxcz@Z\newrobustcmd*\setmediumminchofont{\pxcz@setdf{mnr}}
\pxcz@Z\newrobustcmd*\setboldminchofont{\pxcz@setdf{mnb}}
\pxcz@Z\newrobustcmd*\setmediumgothicfont{\pxcz@setdf{gtr}}
\pxcz@Z\newrobustcmd*\setboldgothicfont{\pxcz@setdf{gtb}}
\pxcz@Z\newrobustcmd*\setxboldgothicfont{\pxcz@setdf{gtx}}
\pxcz@Z\newrobustcmd*\setoneweightgothicfont{\pxcz@setdf{gtu}}
\pxcz@Z\newrobustcmd*\setmarugothicfont{\pxcz@setdf{mgr}}
% korean
\pxcz@Z\newrobustcmd*\setkoreanminchofont{%
  \pxcz@setfont{koml,komr,komb}}
\pxcz@Z\newrobustcmd*\setkoreangothicfont{%
  \pxcz@setfont{kogr,kogb,kogx,kogu,komgr}}
\pxcz@Z\newrobustcmd*\setkoreanlightminchofont{\pxcz@setdf{koml}}
\pxcz@Z\newrobustcmd*\setkoreanmediumminchofont{\pxcz@setdf{komr}}
\pxcz@Z\newrobustcmd*\setkoreanboldminchofont{\pxcz@setdf{komb}}
\pxcz@Z\newrobustcmd*\setkoreanmediumgothicfont{\pxcz@setdf{kogr}}
\pxcz@Z\newrobustcmd*\setkoreanboldgothicfont{\pxcz@setdf{kogb}}
\pxcz@Z\newrobustcmd*\setkoreanxboldgothicfont{\pxcz@setdf{kogx}}
\pxcz@Z\newrobustcmd*\setkoreanoneweightgothicfont{\pxcz@setdf{kogu}}
\pxcz@Z\newrobustcmd*\setkoreanmarugothicfont{\pxcz@setdf{komgr}}
% schinese
\pxcz@Z\newrobustcmd*\setschineseminchofont{%
  \pxcz@setfont{scml,scmr,scmb}}
\pxcz@Z\newrobustcmd*\setschinesegothicfont{%
  \pxcz@setfont{scgr,scgb,scgx,scgu,scmgr}}
\pxcz@Z\newrobustcmd*\setschineselightminchofont{\pxcz@setdf{scml}}
\pxcz@Z\newrobustcmd*\setschinesemediumminchofont{\pxcz@setdf{scmr}}
\pxcz@Z\newrobustcmd*\setschineseboldminchofont{\pxcz@setdf{scmb}}
\pxcz@Z\newrobustcmd*\setschinesemediumgothicfont{\pxcz@setdf{scgr}}
\pxcz@Z\newrobustcmd*\setschineseboldgothicfont{\pxcz@setdf{scgb}}
\pxcz@Z\newrobustcmd*\setschinesexboldgothicfont{\pxcz@setdf{scgx}}
\pxcz@Z\newrobustcmd*\setschineseoneweightgothicfont{\pxcz@setdf{scgu}}
\pxcz@Z\newrobustcmd*\setschinesemarugothicfont{\pxcz@setdf{scmgr}}
% tchinese
\pxcz@Z\newrobustcmd*\settchineseminchofont{%
  \pxcz@setfont{tcml,tcmr,tcmb}}
\pxcz@Z\newrobustcmd*\settchinesegothicfont{%
  \pxcz@setfont{tcgr,tcgb,tcgx,tcgu,tcmgr}}
\pxcz@Z\newrobustcmd*\settchineselightminchofont{\pxcz@setdf{tcml}}
\pxcz@Z\newrobustcmd*\settchinesemediumminchofont{\pxcz@setdf{tcmr}}
\pxcz@Z\newrobustcmd*\settchineseboldminchofont{\pxcz@setdf{tcmb}}
\pxcz@Z\newrobustcmd*\settchinesemediumgothicfont{\pxcz@setdf{tcgr}}
\pxcz@Z\newrobustcmd*\settchineseboldgothicfont{\pxcz@setdf{tcgb}}
\pxcz@Z\newrobustcmd*\settchinesexboldgothicfont{\pxcz@setdf{tcgx}}
\pxcz@Z\newrobustcmd*\settchineseoneweightgothicfont{\pxcz@setdf{tcgu}}
\pxcz@Z\newrobustcmd*\settchinesemarugothicfont{\pxcz@setdf{tcmgr}}

\pxcz@onlypreamble@def\pxcz@setfont#1{\@ifnextchar[%]
  {\pxcz@setfont@a{#1}}{\pxcz@setfont@a{#1}[0]}}
\pxcz@onlypreamble@def\pxcz@setdf{%
  \pxcz@deluxe@usedtrue\pxcz@setfont}
\pxcz@onlypreamble@def\pxcz@setfont@a#1[#2]#3{%
  \edef\pxcz@tmpa{#3}\pxcz@lower\pxcz@tmpa
  \pxcz@split{?:}{?\pxcz@tmpa}%
  \ifx\pxcz@pre\relax
    \pxcz@split{tc?}{\pxcz@tmpa?}%
    \ifx\pxcz@pre\relax \pxcz@setfont@b{#1}{#3}%
    \else \pxcz@setfont@b{#1}{:#2:#3}%
    \fi
  \else \pxcz@setfont@b{#1}{#3}%
  \fi}
\pxcz@onlypreamble@def\pxcz@setfont@b#1#2{%
  \@for\pxcz@tmpx:=#1\do{%
    \@namedef{pxcz@FS/\pxcz@tmpx}{#2}}}
\@for\pxcz@x:=\pxcz@sym@list\do{%
  \@namedef{pxcz@FS/\pxcz@x}{}}

% check for usage of multi-weight commands
\g@addto@macro\pxcz@first@doc@hook{%
  \ifx t\pxchfonMaybeMultiweight % for compatibility
    \let\pxchfonNoCheckMultiweight=t%
  \fi
  \ifx\pxchfonNoCheckMultiweight\@undefined
    \ifpxcz@deluxe@used\if d\pxcz@otf@weight\else
      \PackageWarningNoLine\pxcz@pkgname
       {Setting for multi-weight usage of japanese-otf\MessageBreak
        font set is employed, but 'deluxe' option\MessageBreak
        of japanese-otf is not enabled!\MessageBreak
        You should specify 'maybe-multiweight' option\MessageBreak
        if you really intend the present setting}
    \fi\fi
  \fi}

%--------------------------------------- fontmap internals

%% \pxcz@noembed
% The value given to \set...font to mean 'no-embed'.
\def\pxcz@noembed{*}

%% \pxcz@kill@mapping
\def\pxcz@kill@mapping{!}

%% \pxcz@cmap@directuni
% CMap symbol for "direct unicode".
\def\pxcz@cmap@directuni{unicode}

%% \pxcz@cmap@hwuni
% CMap name for halfwidth fonts.
\def\pxcz@cmap@hwuni{UniJIS-UCS2-HW-H}

%%<*> \usecmapforalphabet/\nousecmapforalphabet
\pxcz@Z\newrobustcmd*\usecmapforalphabet{%
  \global\pxcz@cmap@alphatrue}
\pxcz@Z\newrobustcmd*\nousecmapforalphabet{%
  \global\pxcz@cmap@alphafalse}

%% \pxcz@NEF/<sym>
\def\pxcz@do#1#2{%
  \def\pxcz@tmpb{#2}%
  \@for\pxcz@tmpa:=#1\do{%
    \expandafter\let\csname pxcz@NEF/\pxcz@tmpa\endcsname\pxcz@tmpb
  }}
\pxcz@do{mnl,mnr,mnb}{Ryumin-Light}
\pxcz@do{gtr,gtb,gtx,gtu,mgr}{GothicBBB-Medium}
\pxcz@do{koml,komr,komb}{HYSMyeongJo-Medium}
\pxcz@do{kogr,kogb,kogx,kogu,komgr}{HYGoThic-Medium}
\pxcz@do{scml,scmr,scmb}{STSong-Light}
\pxcz@do{scgr,scgb,scgx,scgu,scmgr}{STHeiti-Regular}
\pxcz@do{tcml,tcmr,tcmb}{MSung-Light}
\pxcz@do{tcgr,tcgb,tcgx,tcgu,tcmgr}{MHei-Medium}

%%<+> \JaFontReplacementFor{<sym>}
\newcommand*\JaFontReplacementFor[1]{%
  \csname pxcz@FS/#1\endcsname}
\@namedef{pxcz@FS/*}{\pxcz@empty}

%%<+> \JaFontReplacementHook{<code>}
\@onlypreamble\JaFontReplacementHook
\pxcz@Z\newrobustcmd*\JaFontReplacementHook{%
  \g@addto@macro\pxcz@user@hook}
\let\pxcz@user@hook\@empty

%%<+> \JaFontUserDefinedMap
\@onlypreamble\JaFontUserDefinedMap
\pxcz@Z\newrobustcmd*\JaFontUserDefinedMap{%
  \g@addto@macro\pxcz@user@map}
\pxcz@onlypreamble@let\pxcz@user@map\@empty

%% \pxcz@check@extra
% Executed at the begin-document hook.
\@onlypreamble\pxcz@check@extra
\let\pxcz@check@extra\@empty

%% \pxcz@addtospec@aux{<name>}{<text>}
\pxcz@onlypreamble@def\pxcz@addtospec@aux#1#2{%
  \xdef\pxcz@spec{\pxcz@spec\noexpand\special{pdf:#1 #2}}%
}

%%<*> \usefontmapline{<map-line>}
\@onlypreamble\usefontmapline
\pxcz@Z\newrobustcmd*\usefontmapline[1]{%
  \JaFontUserDefinedMap{\pxcz@add@mapline{#1}}%
}
%%<*> \usefontmapfile{<map-file>}
\@onlypreamble\usefontmapfile
\pxcz@Z\newrobustcmd*\usefontmapfile[1]{%
  \JaFontUserDefinedMap{\pxcz@add@mapfile{#1}}%
}
%% \pxcz@add@mapfile{<map-file>}
\pxcz@onlypreamble@def\pxcz@add@mapfile{%
  \pxcz@addtospec@aux{mapfile}%
}
%% \pxcz@add@mapline{<map-line>}
\pxcz@onlypreamble@def\pxcz@add@mapline{%
  \pxcz@addtospec@aux{mapline}%
}

%--------------------------------------- map entry handling

%%<*> \setnewglyphcmapprefix{<str>}
\def\pxcz@pfx@jis@dflt{2004-}
\def\pxcz@pfx@jis@star{JISX0213-2004-}
\@onlypreamble\setnewglyphcmapprefix
\pxcz@Z\newrobustcmd*\setnewglyphcmapprefix{%
  \@ifstar{\pxcz@set@pfx@jis\pxcz@pfx@jis@star}%
   {\pxcz@set@pfx@jis}}
\def\pxcz@set@pfx@jis#1{%
  \edef\pxcz@pfx@jis{#1}}
\setnewglyphcmapprefix{\pxcz@pfx@jis@dflt}

%% variables
\let\pxcz@sym\relax
\let\pxcz@cmap\relax
\let\pxcz@font\relax
\let\pxcz@csi\relax
\newif\ifpxcz@vert
\newif\ifpxcz@retain
\newif\ifpxcz@retain@csi
\let\pxcz@lopts\relax
\let\pxcz@mopts\relax
\let\pxcz@font@tribe\relax
\newif\ifpxcz@noembed@used

%% \pxcz@@jpXX
\edef\pxcz@@jpXX{%
  \ifpxcz@mmivjis jp04\else jp90\fi}
%% \pxcz@add@lopt
\pxcz@onlypreamble@def\pxcz@add@lopt#1{%
  \edef\pxcz@lopts{%
    \ifx\pxcz@lopts\@empty\else \pxcz@lopts:\fi#1}}

%% \pxcz@is@jis@cmap
\pxcz@onlypreamble@def\pxcz@is@jis@cmap{%
  \pxcz@okfalse
  \expandafter\pxcz@is@jis@cmap@a\pxcz@cmap\pxcz@end}
\pxcz@onlypreamble@def\pxcz@is@jis@cmap@a#1#2\pxcz@end{%
  \ifx\pxcz@mt#2\pxcz@mt \pxcz@oktrue \fi}

%% \pxcz@force@mmiv@cmap
\pxcz@onlypreamble@def\pxcz@force@mmiv@cmap{%
  \pxcz@is@jis@cmap \ifpxcz@ok
    \edef\pxcz@cmap{\pxcz@pfx@jis\pxcz@cmap}%
  \else
    \pxcz@split{UniJIS-}\pxcz@cmap
    \ifx\pxcz@pre\relax\else
      \edef\pxcz@cmap{UniJIS2004-\pxcz@post}%
    \fi
  \fi}

%% \pxcz@inspect@font@tribe
\pxcz@onlypreamble@def\pxcz@inspect@font@tribe{%
  \let\pxcz@font@tribe\@empty
  \ifx\pxcz@font\@empty
  \else\ifx\pxcz@font\pxcz@noembed
  \else
    \pxcz@inspect@font@tribe@a{:moga}{.ttc?}{mogamobo}%
    \pxcz@inspect@font@tribe@a{:mobo}{.ttc?}{mogamobo}%
  \fi\fi
  \ifx\pxcz@font@tribe\@empty\else
    \PackageInfo\pxcz@pkgname
     {Font tribe is '\pxcz@font@tribe':\MessageBreak
      \@spaces\pxcz@font\@gobble}%
  \fi}
\pxcz@onlypreamble@def\pxcz@inspect@font@tribe@a#1#2#3{%
  \pxcz@split{#1}{?\pxcz@font}%
  \ifx\pxcz@pre\relax\else
    \pxcz@split{#2}{\pxcz@font?}%
    \ifx\pxcz@pre\relax\else
      \def\pxcz@font@tribe{#3}%
    \fi
  \fi}

%% \pxcz@switch@font@for{<feature>}
% Modifies \pxcz@font, assuming \pxcz@font@tribe is properly set.
\pxcz@onlypreamble@def\pxcz@switch@font@for#1{%
  \pxcz@letcs\pxcz@tmpb{pxcz@switch@font@@\pxcz@font@tribe @#1}%
  \ifx\pxcz@tmpb\relax\else
%\typeout{#1:\pxcz@font-->\expandafter\pxcz@tmpb\pxcz@font}%
    \edef\pxcz@font{\expandafter\pxcz@tmpb\pxcz@font}%
  \fi}
% entries
\ifpxcz@switch@font@xjis
  \@namedef{pxcz@switch@font@@mogamobo@jp90}#1.ttc{%
    \pxcz@csuse@or{pxcz@SFMG/#1.ttc}{#1.ttc}}
  \def\pxcz@do#1#2#3{\@namedef{pxcz@SFMG/:#1:#3}{:#2:#3}}
  \pxcz@do{0}{3}{mogam.ttc}
  \pxcz@do{1}{4}{mogam.ttc}
  \pxcz@do{0}{3}{mogamb.ttc}
  \pxcz@do{1}{4}{mogamb.ttc}
  \pxcz@do{0}{2}{mogag.ttc}
  \pxcz@do{1}{3}{mogag.ttc}
  \pxcz@do{0}{2}{mogagb.ttc}
  \pxcz@do{1}{3}{mogagb.ttc}
  \pxcz@do{0}{2}{mobog.ttc}
  \pxcz@do{1}{3}{mobog.ttc}
  \pxcz@do{0}{2}{mobogb.ttc}
  \pxcz@do{1}{3}{mobogb.ttc}
\fi

%% \pxcz@declare@entry@modifier{<name>}
\pxcz@onlypreamble@def\pxcz@declare@entry@modifier#1{%
  \pxcz@onlypreamble@csdef{pxcz@MEM/#1}}

%% entry modifiers
% Uni: Changes cmap to 'unicode' if directunicode.
\pxcz@declare@entry@modifier{Uni}{%
  \ifnum\pxcz@unicode<\pxcz@unicode@@UTF\else
    \ifx\pxcz@font\pxcz@noembed\else
      \let\pxcz@cmap\pxcz@cmap@directuni
    \fi
  \fi}
% Uni*: Changes cmap to 'unicode' if directunicode*.
\pxcz@declare@entry@modifier{Uni*}{%
  \ifnum\pxcz@unicode<\pxcz@unicode@@simple\else
    \ifx\pxcz@font\pxcz@noembed\else
      \let\pxcz@cmap\pxcz@cmap@directuni
    \fi
  \fi}
% Switch: Selects 90 or 04 (according to mmivjis)
\pxcz@declare@entry@modifier{Switch}{%
  \ifpxcz@mmivjis
    \pxcz@force@mmiv@cmap
  \else
    \pxcz@switch@font@for{jp90}%
  \fi
  \pxcz@add@lopt{\pxcz@@jpXX}}
% 04
\pxcz@declare@entry@modifier{04}{%
  \pxcz@add@lopt{jp04}}
% 90
\pxcz@declare@entry@modifier{90}{%
  \pxcz@switch@font@for{jp90}%
  \pxcz@add@lopt{jp90}}
% HWid
\pxcz@declare@entry@modifier{HWid}{%
  \ifx\pxcz@font\pxcz@noembed \pxcz@okfalse
  \else\ifnum\pxcz@unicode=\pxcz@unicode@@full \pxcz@oktrue
  \else\ifpxcz@cmap@alpha \pxcz@okfalse
  \else \pxcz@oktrue
  \fi\fi\fi
  \ifpxcz@ok
    \let\pxcz@cmap\pxcz@cmap@directuni
    \pxcz@switch@font@for{hwid}%
  \else \let\pxcz@cmap\pxcz@cmap@hwuni
  \fi
  \pxcz@add@lopt{hwid}}
% FWid
\pxcz@declare@entry@modifier{FWid}{%
  \pxcz@switch@font@for{fwid}%
  \pxcz@add@lopt{fwid}}
% AJ16/AK12/AG14/AC14
\pxcz@declare@entry@modifier{AJ16}{\def\pxcz@csi{AJ16}}
\pxcz@declare@entry@modifier{AK12}{\def\pxcz@csi{AK12}\pxcz@retaintrue}
\pxcz@declare@entry@modifier{AG14}{\def\pxcz@csi{AG14}\pxcz@retaintrue}
\pxcz@declare@entry@modifier{AC14}{\def\pxcz@csi{AC14}\pxcz@retaintrue}
% V: Adds '-w 1' if cmap is 'unicode'.
\pxcz@declare@entry@modifier{V}{%
  \pxcz@verttrue
  \ifx\pxcz@cmap\pxcz@cmap@directuni
    \edef\pxcz@mopts{ -w 1\pxcz@mopts}%
  \fi}
% Exp: Adds 'hkna/vkna' if cmap is 'unicode'.
\pxcz@declare@entry@modifier{Exp}{%
  \if t\pxcz@expert \ifx\pxcz@cmap\pxcz@cmap@directuni
    \ifpxcz@vert \pxcz@add@lopt{vkna}%
    \else \pxcz@add@lopt{hkna}%
    \fi
  \fi\fi}
% Ruby
\pxcz@declare@entry@modifier{Ruby}{%
  \if t\pxcz@expert
    \let\pxcz@cmap\pxcz@cmap@directuni
    \pxcz@add@lopt{ruby}%
  \fi}
% I
\pxcz@declare@entry@modifier{I}{%
  \def\pxcz@csi{I}%
  \pxcz@retaintrue \pxcz@retain@csitrue}
% Fin: final step
\pxcz@declare@entry@modifier{Fin}{%
  \ifx\pxcz@csi\relax\else
    \ifpxcz@retain@csi
      \edef\pxcz@mopts{/\pxcz@csi}%
    \else\expandafter\ifx\csname pxcz@OT/\pxcz@sym\endcsname\relax
      \edef\pxcz@mopts{/\pxcz@csi}%
    \else % omit CSI part for CFF fonts
      \let\pxcz@mopts\@empty
    \fi\fi
  \fi}

%% \pxcz@spec
\let\pxcz@spec\@empty

%% \pxcz@addtospec{<id>}
\pxcz@onlypreamble@def\pxcz@addtospec#1{%
  \begingroup
    \let\Entry\pxcz@Entry
    \@nameuse{pxcz@ME/#1}%
  \endgroup}
%% \Entry{<sym>}{<tfm>}{<cmap>}{<modify>,...}
\pxcz@onlypreamble@def\pxcz@Entry#1#2#3#4{%
  \def\pxcz@sym{#1}\def\pxcz@cmap{#3}%
  \let\pxcz@csi\relax \let\pxcz@mopts\@empty \let\pxcz@lopts\@empty
  \pxcz@retainfalse \pxcz@retain@csifalse \pxcz@vertfalse
  \edef\pxcz@font{\@nameuse{pxcz@FS/\pxcz@sym}}%
  \pxcz@inspect@font@tribe
  % apply modifiers
  \@for\pxcz@tmpx:=#4,Fin\do{%
    \ifx\pxcz@font\@empty\else
      \@nameuse{pxcz@MEM/\pxcz@tmpx}%
    \fi}%
  % resolve no-embed font spec
  \ifx\pxcz@font\pxcz@noembed
    \edef\pxcz@font{!\@nameuse{pxcz@NEF/\pxcz@sym}}%
    \pxcz@retaintrue
    \global\pxcz@noembed@usedtrue
  \fi
  % apply layout options when using 'unicode'
  \ifnum\pxcz@unicode<\pxcz@unicode@@full\else
    \ifx\pxcz@cmap\pxcz@cmap@directuni
        \ifpxcz@fullwidth
          \pxcz@split{wid}\pxcz@lopts\ifx\pxcz@pre\relax
            \pxcz@add@lopt{fwid}%
          \fi
        \fi
      \ifx\pxcz@lopts\@empty\else
        \edef\pxcz@mopts{\pxcz@mopts\space -l \pxcz@lopts}%
      \fi
    \fi
  \fi
  % suppress legacy-code mappings unless 'apply-legacycode'
  \ifx\pxcz@cmap\pxcz@cmap@directuni\else \ifpxcz@retain\else
    \ifnum\pxcz@legacycode=\pxcz@legacycode@@apply % no-op
    \else\ifnum\pxcz@legacycode=\pxcz@legacycode@@ignore
      \let\pxcz@font\@empty % skip
    \else\ifx\pxcz@font\@empty\else
      \let\pxcz@font\pxcz@kill@mapping % kill
    \fi\fi\fi
  \fi\fi
  % output it
  \ifx\pxcz@font\pxcz@kill@mapping
    \pxcz@add@mapline{-#2}%
  \else\ifx\pxcz@font\@empty\else
    \pxcz@add@mapline{#2 \pxcz@cmap\space\pxcz@font\pxcz@mopts}%
  \fi\fi}

%% \pxcz@do@file@preset
\pxcz@onlypreamble@def\pxcz@do@file@preset{%
  \ifpxcz@file@preset@tl
    \pxcz@use@mapfile{ja}{\pxcz@file@preset}%
  \else
    \pxcz@use@mapfile{file}{\pxcz@file@preset}%
  \fi}

%% \pxcz@use@mapfile{<type>}{<basename>}
\pxcz@onlypreamble@def\pxcz@use@mapfile#1{%#1=<type>
  \pxcz@csuse@or{pxcz@use@mapfile@@#1}{\pxcz@use@mapfile@a{#1}}}
\pxcz@onlypreamble@def\pxcz@use@mapfile@@file#1{%#1=<basename>
  \pxcz@use@mapfile@b{#1}}
\pxcz@onlypreamble@def\pxcz@use@mapfile@@ja#1{%
  \pxcz@use@mapfile@b{ptex-#1}%
  \ifpxcz@uptex \pxcz@use@mapfile@b{uptex-#1}\fi
  \ifpxcz@otf
    \pxcz@use@mapfile@b{otf-#1}%
    \ifpxcz@uptex \pxcz@use@mapfile@b{otf-up-#1}\fi
  \fi}
\pxcz@onlypreamble@def\pxcz@use@mapfile@a#1#2{%
  \ifpxcz@uptex \pxcz@use@mapfile@b{uptex-#1-#2}\fi
  \ifpxcz@otf \pxcz@use@mapfile@b{otf-#1-#2}\fi}
\pxcz@onlypreamble@def\pxcz@use@mapfile@b#1{%
  \pxcz@add@mapfile{#1.map}}

%--------------------------------------- map entry definitions

%% \pxcz@mapentry{<id>}{<text>}
\pxcz@onlypreamble@def\pxcz@mapentry#1{%
  \pxcz@onlypreamble@csdef{pxcz@ME/#1}}

%% map entries
\pxcz@mapentry{STD}{%
\Entry{mnr}{rml}           {H}                   {Switch}%
\Entry{mnr}{rmlv}          {V}                   {Switch,V}%
\Entry{gtu}{gbm}           {H}                   {Switch}%
\Entry{gtu}{gbmv}          {V}                   {Switch,V}%
}
\pxcz@mapentry{ALPHA}{%
\Entry{mnl}{r-cfjar-l-@PXcjk0@}{unicode}         {HWid}%
\Entry{mnl}{r-cfjar-lz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
\Entry{mnr}{r-cfjar-r-@PXcjk0@}{unicode}         {HWid}%
\Entry{mnr}{r-cfjar-rz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
\Entry{mnb}{r-cfjar-b-@PXcjk0@}{unicode}         {HWid}%
\Entry{mnb}{r-cfjar-bz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
\Entry{gtr}{r-cfjas-r-@PXcjk0@}{unicode}         {HWid}%
\Entry{gtr}{r-cfjas-rz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
\Entry{gtb}{r-cfjas-b-@PXcjk0@}{unicode}         {HWid}%
\Entry{gtb}{r-cfjas-bz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
\Entry{gtx}{r-cfjas-x-@PXcjk0@}{unicode}         {HWid}%
\Entry{gtx}{r-cfjas-xz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
\Entry{mgr}{r-cfjam-r-@PXcjk0@}{unicode}         {HWid}%
\Entry{mgr}{r-cfjam-rz-@PXcjk0@}{UniJIS-UCS2-H}  {Uni*,FWid}%
}
\pxcz@mapentry{UTF}{%
\Entry{mnr}{unijmin-h}     {UniJIS-UTF16-H}      {Uni*,Switch}%
\Entry{mnr}{unijmin-v}     {UniJIS-UTF16-V}      {Uni*,Switch,V}%
\Entry{mnr}{cidmin-h}      {Identity-H}          {AJ16}%
\Entry{mnr}{cidmin-v}      {Identity-V}          {AJ16,V}%
\Entry{mnr}{hmr}           {H}                   {Switch}%
\Entry{mnr}{hmrv}          {V}                   {Switch,V}%
\Entry{gtu}{unijgoth-h}    {UniJIS-UTF16-H}      {Uni*,Switch}%
\Entry{gtu}{unijgoth-v}    {UniJIS-UTF16-V}      {Uni*,Switch,V}%
\Entry{gtu}{cidgoth-h}     {Identity-H}          {AJ16}%
\Entry{gtu}{cidgoth-v}     {Identity-V}          {AJ16,V}%
\Entry{gtu}{hkb}           {H}                   {Switch}%
\Entry{gtu}{hkbv}          {V}                   {Switch,V}%
}
\pxcz@mapentry{OTF}{%
\Entry{mnl}{otf-ujml-h}    {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{mnl}{otf-ujml-v}    {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{mnl}{otf-cjml-h}    {Identity-H}          {AJ16}%
\Entry{mnl}{otf-cjml-v}    {Identity-V}          {AJ16,V}%
\Entry{mnl}{hminl-h}       {H}                   {90}%
\Entry{mnl}{hminl-v}       {V}                   {90,V}%
\Entry{mnl}{otf-ujmln-h}   {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{mnl}{otf-ujmln-v}   {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{mnl}{hminln-h}      {H}                   {}%
\Entry{mnl}{hminln-v}      {V}                   {V}%
\Entry{mnr}{otf-ujmr-h}    {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{mnr}{otf-ujmr-v}    {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{mnr}{otf-cjmr-h}    {Identity-H}          {AJ16}%
\Entry{mnr}{otf-cjmr-v}    {Identity-V}          {AJ16,V}%
\Entry{mnr}{hminr-h}       {H}                   {90}%
\Entry{mnr}{hminr-v}       {V}                   {90,V}%
\Entry{mnr}{otf-ujmrn-h}   {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{mnr}{otf-ujmrn-v}   {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{mnr}{hminrn-h}      {H}                   {}%
\Entry{mnr}{hminrn-v}      {V}                   {V}%
\Entry{mnb}{otf-ujmb-h}    {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{mnb}{otf-ujmb-v}    {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{mnb}{otf-cjmb-h}    {Identity-H}          {AJ16}%
\Entry{mnb}{otf-cjmb-v}    {Identity-V}          {AJ16,V}%
\Entry{mnb}{hminb-h}       {H}                   {90}%
\Entry{mnb}{hminb-v}       {V}                   {90,V}%
\Entry{mnb}{otf-ujmbn-h}   {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{mnb}{otf-ujmbn-v}   {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{mnb}{hminbn-h}      {H}                   {}%
\Entry{mnb}{hminbn-v}      {V}                   {V}%
\Entry{gtr}{otf-ujgr-h}    {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{gtr}{otf-ujgr-v}    {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{gtr}{otf-cjgr-h}    {Identity-H}          {AJ16}%
\Entry{gtr}{otf-cjgr-v}    {Identity-V}          {AJ16,V}%
\Entry{gtr}{hgothr-h}      {H}                   {90}%
\Entry{gtr}{hgothr-v}      {V}                   {90,V}%
\Entry{gtr}{otf-ujgrn-h}   {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{gtr}{otf-ujgrn-v}   {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{gtr}{hgothrn-h}     {H}                   {}%
\Entry{gtr}{hgothrn-v}     {V}                   {V}%
\Entry{gtb}{otf-ujgb-h}    {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{gtb}{otf-ujgb-v}    {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{gtb}{otf-cjgb-h}    {Identity-H}          {AJ16}%
\Entry{gtb}{otf-cjgb-v}    {Identity-V}          {AJ16,V}%
\Entry{gtb}{hgothb-h}      {H}                   {90}%
\Entry{gtb}{hgothb-v}      {V}                   {90,V}%
\Entry{gtb}{otf-ujgbn-h}   {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{gtb}{otf-ujgbn-v}   {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{gtb}{hgothbn-h}     {H}                   {}%
\Entry{gtb}{hgothbn-v}     {V}                   {V}%
\Entry{gtx}{otf-ujge-h}    {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{gtx}{otf-ujge-v}    {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{gtx}{otf-cjge-h}    {Identity-H}          {AJ16}%
\Entry{gtx}{otf-cjge-v}    {Identity-V}          {AJ16,V}%
\Entry{gtx}{hgotheb-h}     {H}                   {90}%
\Entry{gtx}{hgotheb-v}     {V}                   {90,V}%
\Entry{gtx}{otf-ujgen-h}   {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{gtx}{otf-ujgen-v}   {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{gtx}{hgothebn-h}    {H}                   {}%
\Entry{gtx}{hgothebn-v}    {V}                   {V}%
\Entry{mgr}{otf-ujmgr-h}   {UniJIS-UTF16-H}      {Uni,90,FWid}%
\Entry{mgr}{otf-ujmgr-v}   {UniJIS-UTF16-V}      {Uni,90,FWid,V}%
\Entry{mgr}{otf-cjmgr-h}   {Identity-H}          {AJ16}%
\Entry{mgr}{otf-cjmgr-v}   {Identity-V}          {AJ16,V}%
\Entry{mgr}{hmgothr-h}     {H}                   {90}%
\Entry{mgr}{hmgothr-v}     {V}                   {90,V}%
\Entry{mgr}{otf-ujmgrn-h}  {UniJIS2004-UTF16-H}  {Uni,04,FWid}%
\Entry{mgr}{otf-ujmgrn-v}  {UniJIS2004-UTF16-V}  {Uni,04,FWid,V}%
\Entry{mgr}{hmgothrn-h}    {H}                   {}%
\Entry{mgr}{hmgothrn-v}    {V}                   {V}%
%
\ifpxcz@otf@multi
\Entry{koml}{otf-ukml-h}   {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{koml}{otf-ukml-v}   {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{koml}{otf-ckml-h}   {Identity-H}          {AK12}%
\Entry{koml}{otf-ckml-v}   {Identity-V}          {AK12,V}%
\Entry{komr}{otf-ukmr-h}   {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{komr}{otf-ukmr-v}   {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{komr}{otf-ckmr-h}   {Identity-H}          {AK12}%
\Entry{komr}{otf-ckmr-v}   {Identity-V}          {AK12,V}%
\Entry{komb}{otf-ukmb-h}   {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{komb}{otf-ukmb-v}   {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{komb}{otf-ckmb-h}   {Identity-H}          {AK12}%
\Entry{komb}{otf-ckmb-v}   {Identity-V}          {AK12,V}%
\Entry{kogr}{otf-ukgr-h}   {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{kogr}{otf-ukgr-v}   {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{kogr}{otf-ckgr-h}   {Identity-H}          {AK12}%
\Entry{kogr}{otf-ckgr-v}   {Identity-V}          {AK12,V}%
\Entry{kogb}{otf-ukgb-h}   {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{kogb}{otf-ukgb-v}   {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{kogb}{otf-ckgb-h}   {Identity-H}          {AK12}%
\Entry{kogb}{otf-ckgb-v}   {Identity-V}          {AK12,V}%
\Entry{kogx}{otf-ukge-h}   {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{kogx}{otf-ukge-v}   {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{kogx}{otf-ckge-h}   {Identity-H}          {AK12}%
\Entry{kogx}{otf-ckge-v}   {Identity-V}          {AK12,V}%
\Entry{komgr}{otf-ukmgr-h} {UniKS-UTF16-H}       {Uni,FWid}%
\Entry{komgr}{otf-ukmgr-v} {UniKS-UTF16-V}       {Uni,FWid,V}%
\Entry{komgr}{otf-ckmgr-h} {Identity-H}          {AK12}%
\Entry{komgr}{otf-ckmgr-v} {Identity-V}          {AK12,V}%

\Entry{scml}{otf-ucml-h}   {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scml}{otf-ucml-v}   {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scml}{otf-ccml-h}   {Identity-H}          {AG14}%
\Entry{scml}{otf-ccml-v}   {Identity-V}          {AG14,V}%
\Entry{scmr}{otf-ucmr-h}   {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scmr}{otf-ucmr-v}   {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scmr}{otf-ccmr-h}   {Identity-H}          {AG14}%
\Entry{scmr}{otf-ccmr-v}   {Identity-V}          {AG14,V}%
\Entry{scmb}{otf-ucmb-h}   {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scmb}{otf-ucmb-v}   {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scmb}{otf-ccmb-h}   {Identity-H}          {AG14}%
\Entry{scmb}{otf-ccmb-v}   {Identity-V}          {AG14,V}%
\Entry{scgr}{otf-ucgr-h}   {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scgr}{otf-ucgr-v}   {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scgr}{otf-ccgr-h}   {Identity-H}          {AG14}%
\Entry{scgr}{otf-ccgr-v}   {Identity-V}          {AG14,V}%
\Entry{scgb}{otf-ucgb-h}   {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scgb}{otf-ucgb-v}   {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scgb}{otf-ccgb-h}   {Identity-H}          {AG14}%
\Entry{scgb}{otf-ccgb-v}   {Identity-V}          {AG14,V}%
\Entry{scgx}{otf-ucge-h}   {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scgx}{otf-ucge-v}   {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scgx}{otf-ccge-h}   {Identity-H}          {AG14}%
\Entry{scgx}{otf-ccge-v}   {Identity-V}          {AG14,V}%
\Entry{scmgr}{otf-ucmgr-h} {UniGB-UTF16-H}       {Uni,FWid}%
\Entry{scmgr}{otf-ucmgr-v} {UniGB-UTF16-V}       {Uni,FWid,V}%
\Entry{scmgr}{otf-ccmgr-h} {Identity-H}          {AG14}%
\Entry{scmgr}{otf-ccmgr-v} {Identity-V}          {AG14,V}%

\Entry{tcml}{otf-utml-h}   {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcml}{otf-utml-v}   {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcml}{otf-ctml-h}   {Identity-H}          {AC14}%
\Entry{tcml}{otf-ctml-v}   {Identity-V}          {AC14,V}%
\Entry{tcmr}{otf-utmr-h}   {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcmr}{otf-utmr-v}   {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcmr}{otf-ctmr-h}   {Identity-H}          {AC14}%
\Entry{tcmr}{otf-ctmr-v}   {Identity-V}          {AC14,V}%
\Entry{tcmb}{otf-utmb-h}   {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcmb}{otf-utmb-v}   {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcmb}{otf-ctmb-h}   {Identity-H}          {AC14}%
\Entry{tcmb}{otf-ctmb-v}   {Identity-V}          {AC14,V}%
\Entry{tcgr}{otf-utgr-h}   {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcgr}{otf-utgr-v}   {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcgr}{otf-ctgr-h}   {Identity-H}          {AC14}%
\Entry{tcgr}{otf-ctgr-v}   {Identity-V}          {AC14,V}%
\Entry{tcgb}{otf-utgb-h}   {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcgb}{otf-utgb-v}   {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcgb}{otf-ctgb-h}   {Identity-H}          {AC14}%
\Entry{tcgb}{otf-ctgb-v}   {Identity-V}          {AC14,V}%
\Entry{tcgx}{otf-utge-h}   {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcgx}{otf-utge-v}   {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcgx}{otf-ctge-h}   {Identity-H}          {AC14}%
\Entry{tcgx}{otf-ctge-v}   {Identity-V}          {AC14,V}%
\Entry{tcmgr}{otf-utmgr-h} {UniCNS-UTF16-H}      {Uni,FWid}%
\Entry{tcmgr}{otf-utmgr-v} {UniCNS-UTF16-V}      {Uni,FWid,V}%
\Entry{tcmgr}{otf-ctmgr-h} {Identity-H}          {AC14}%
\Entry{tcmgr}{otf-ctmgr-v} {Identity-V}          {AC14,V}%
\fi
}
\pxcz@mapentry{UPSTD}{%
\Entry{mnr}{uprml-h}       {UniJIS-UTF16-H}      {Uni*,Switch}%
\Entry{mnr}{uprml-v}       {UniJIS-UTF16-V}      {Uni*,Switch,V}%
\Entry{mnr}{uprml-hq}      {UniJIS-UCS2-H}       {Uni*,FWid}%
\Entry{gtu}{upgbm-h}       {UniJIS-UTF16-H}      {Uni*,Switch}%
\Entry{gtu}{upgbm-v}       {UniJIS-UTF16-V}      {Uni*,Switch,V}%
\Entry{gtu}{upgbm-hq}      {UniJIS-UCS2-H}       {Uni*,FWid}%
\Entry{mnr}{urml}          {UniJIS-UTF16-H}      {Uni*,Switch}%
\Entry{mnr}{urmlv}         {UniJIS-UTF16-V}      {Uni*,Switch,V}%
\Entry{gtu}{ugbm}          {UniJIS-UTF16-H}      {Uni*,Switch}%
\Entry{gtu}{ugbmv}         {UniJIS-UTF16-V}      {Uni*,Switch,V}%
%
\Entry{komr}{uphysmjm-h}    {UniKS-UTF16-H}       {Uni*}%
\Entry{komr}{uphysmjm-v}    {UniKS-UTF16-V}       {Uni*,V}%
\Entry{kogu}{uphygt-h}      {UniKS-UTF16-H}       {Uni*}%
\Entry{kogu}{uphygt-v}      {UniKS-UTF16-V}       {Uni*,V}%
\Entry{scmr}{upstsl-h}      {UniGB-UTF16-H}       {Uni*}%
\Entry{scmr}{upstsl-v}      {UniGB-UTF16-V}       {Uni*,V}%
\Entry{scgu}{upstht-h}      {UniGB-UTF16-H}       {Uni*}%
\Entry{scgu}{upstht-v}      {UniGB-UTF16-V}       {Uni*,V}%
\Entry{tcmr}{upmsl-h}       {UniCNS-UTF16-H}      {Uni*}%
\Entry{tcmr}{upmsl-v}       {UniCNS-UTF16-V}      {Uni*,V}%
\Entry{tcgu}{upmhm-h}       {UniCNS-UTF16-H}      {Uni*}%
\Entry{tcgu}{upmhm-v}       {UniCNS-UTF16-V}      {Uni*,V}%
}
\pxcz@mapentry{UPOTF}{%
\Entry{mnl}{uphminl-h}     {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{mnl}{uphminl-v}     {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{mnl}{uphminln-h}    {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{mnl}{uphminln-v}    {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
\Entry{mnr}{uphminr-h}     {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{mnr}{uphminr-v}     {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{mnr}{uphminrn-h}    {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{mnr}{uphminrn-v}    {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
\Entry{mnb}{uphminb-h}     {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{mnb}{uphminb-v}     {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{mnb}{uphminbn-h}    {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{mnb}{uphminbn-v}    {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
\Entry{gtr}{uphgothr-h}    {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{gtr}{uphgothr-v}    {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{gtr}{uphgothrn-h}   {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{gtr}{uphgothrn-v}   {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
\Entry{gtb}{uphgothb-h}    {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{gtb}{uphgothb-v}    {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{gtb}{uphgothbn-h}   {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{gtb}{uphgothbn-v}   {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
\Entry{gtx}{uphgotheb-h}   {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{gtx}{uphgotheb-v}   {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{gtx}{uphgothebn-h}  {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{gtx}{uphgothebn-v}  {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
\Entry{mgr}{uphmgothr-h}   {UniJIS-UTF16-H}      {Uni*,90,Exp}%
\Entry{mgr}{uphmgothr-v}   {UniJIS-UTF16-V}      {Uni*,90,V,Exp}%
\Entry{mgr}{uphmgothrn-h}  {UniJIS2004-UTF16-H}  {Uni*,04,Exp}%
\Entry{mgr}{uphmgothrn-v}  {UniJIS2004-UTF16-V}  {Uni*,04,V,Exp}%
}
\pxcz@mapentry{GID}{%
\Entry{mnl}{zur-gjml-h}    {Identity-H}          {I}%
\Entry{mnl}{zur-gjml-v}    {Identity-V}          {I,V}%
\Entry{mnr}{zur-gjmr-h}    {Identity-H}          {I}%
\Entry{mnr}{zur-gjmr-v}    {Identity-V}          {I,V}%
\Entry{mnb}{zur-gjmb-h}    {Identity-H}          {I}%
\Entry{mnb}{zur-gjmb-v}    {Identity-V}          {I,V}%
\Entry{gtr}{zur-gjgr-h}    {Identity-H}          {I}%
\Entry{gtr}{zur-gjgr-v}    {Identity-V}          {I,V}%
\Entry{gtb}{zur-gjgb-h}    {Identity-H}          {I}%
\Entry{gtb}{zur-gjgb-v}    {Identity-V}          {I,V}%
\Entry{gtx}{zur-gjge-h}    {Identity-H}          {I}%
\Entry{gtx}{zur-gjge-v}    {Identity-V}          {I,V}%
\Entry{mgr}{zur-gjmgr-h}   {Identity-H}          {I}%
\Entry{mgr}{zur-gjmgr-v}   {Identity-V}          {I,V}%
}
\pxcz@mapentry{EXPERT}{%
\Entry{mnl}{zur-rjml-h}    {unicode}             {Ruby}%
\Entry{mnl}{zur-rjml-v}    {unicode}             {V,Ruby}%
\Entry{mnr}{zur-rjmr-h}    {unicode}             {Ruby}%
\Entry{mnr}{zur-rjmr-v}    {unicode}             {V,Ruby}%
\Entry{mnb}{zur-rjmb-h}    {unicode}             {Ruby}%
\Entry{mnb}{zur-rjmb-v}    {unicode}             {V,Ruby}%
\Entry{gtr}{zur-rjgr-h}    {unicode}             {Ruby}%
\Entry{gtr}{zur-rjgr-v}    {unicode}             {V,Ruby}%
\Entry{gtb}{zur-rjgb-h}    {unicode}             {Ruby}%
\Entry{gtb}{zur-rjgb-v}    {unicode}             {V,Ruby}%
\Entry{gtx}{zur-rjge-h}    {unicode}             {Ruby}%
\Entry{gtx}{zur-rjge-v}    {unicode}             {V,Ruby}%
\Entry{mgr}{zur-rjmgr-h}   {unicode}             {Ruby}%
\Entry{mgr}{zur-rjmgr-v}   {unicode}             {V,Ruby}%
}
\pxcz@mapentry{PXOTF}{%
}

% user-defined map
\pxcz@mapentry{USR}{%
  \pxcz@user@map
}

%--------------------------------------- '\diruni'

%% variables
\newif\ifpxcz@diruni@ok

%% check if \diruni is available
\ifpxcz@uptex
  \ifpxcz@otf@loaded % direct Unicode needs otf
    \ifnum\pxcz@unicode>\z@ \pxcz@diruni@oktrue \fi
  \else
    \ifnum\pxcz@unicode<\pxcz@unicode@@simple\else
      \pxcz@diruni@oktrue % 'unicode=UTF' does not need otf
      \g@addto@macro\pxcz@first@doc@hook{%
        % loading otf later causes inconsistency
        \@ifpackageloaded{otf}{\pxcz@diruni@okfalse}{}}%
    \fi
  \fi
\fi

%%<*> \diruni
\pxcz@Z\newrobustcmd*\diruni{%
    \not@math@alphabet\diruni\relax
    \ifx\cy@encoding\pxcz@JYn % if in standard Japanese encoding
      \expandafter\let\csname UTF \endcsname\pxcz@du@UTF
      \kanjishape{diruni}\selectfont
    \fi
}

%%<*> \textdiruni{<text>}
\pxcz@Z\newrobustcmd*\textdiruni[1]{%
  \relax\ifmmode\hbox\fi{\diruni#1}%
}

%% \pxcz@du@UTF
\def\pxcz@du@UTF#1{%
  \kchar"#1\relax}

%% redefinition in PDF-strings
\pxcz@hy@disable@commands{%
  \let\pxcz@diruni\@empty
  \let\textdiruni\@firstofone
}

%% \pxcz@err@diruni
\def\pxcz@err@diruni{%
  \global\let\pxcz@diruni\relax
  \PackageError\pxcz@pkgname
   {Command '\string\(text)diruni' not available}%
   {You must use upLaTeX and load pxchfon
    \ifcase\pxcz@unicode with 'unicode' option%
    \else pxchfon after 'otf' package%
    \fi .\MessageBreak\@ehc}}
\g@addto@macro\pxcz@first@doc@hook{%
  \ifpxcz@diruni@ok \let\pxcz@err@diruni\relax
  \else \let\pxcz@diruni\pxcz@err@diruni
  \fi}

\ifpxcz@diruni@ok   %---- <*diruni-ok>

%% \pxcz@du@decl@shape{<fam>}{<ser>}<sw>{<tfmname>}{<suffix>}
\pxcz@onlypreamble@def\pxcz@du@decl@shape#1#2#3#4#5{%
\DeclareFontShape{JY2}{#1}{#2}{diruni}{<->%
    \pxcz@du@shape@spec{#3}{#4}{#5}{h}}{}%
\DeclareFontShape{JT2}{#1}{#2}{diruni}{<->%
    \pxcz@du@shape@spec{#3}{#4}{#5}{v}}{}}
\pxcz@onlypreamble@def\pxcz@du@shape@spec#1#2#3#4{%
  \if#1t%
    s*[\pxcz@jascale]#2\ifpxcz@otf@mmivjis#3\fi-#4%
  \else#2\fi}

\if d\pxcz@otf@weight % deluxe
\pxcz@du@decl@shape{hmc}{l}t{otf-ujml}{n}%
\pxcz@du@decl@shape{hmc}{m}t{otf-ujmr}{n}%
\pxcz@du@decl@shape{hmc}{bx}t{otf-ujmb}{n}%
\pxcz@du@decl@shape{hgt}{m}t{otf-ujgr}{n}%
\pxcz@du@decl@shape{hgt}{bx}t{otf-ujgb}{n}%
\pxcz@du@decl@shape{hgt}{eb}t{otf-ujge}{n}%
\pxcz@du@decl@shape{mg}{m}t{otf-ujmgr}{n}%
\else\if b\pxcz@otf@weight % bold
\pxcz@du@decl@shape{hmc}{m}t{otf-ujmr}{n}%
\pxcz@du@decl@shape{hmc}{bx}f{ssub*hgt/m/diruni}{}%
\pxcz@du@decl@shape{hgt}{m}t{otf-ujgb}{n}%
\pxcz@du@decl@shape{hgt}{bx}f{ssub*hgt/m/diruni}{}%
\else\if r\pxcz@otf@weight % default
\pxcz@du@decl@shape{hmc}{m}t{otf-ujmr}{n}%
\pxcz@du@decl@shape{hmc}{bx}f{ssub*hgt/m/diruni}{}%
\pxcz@du@decl@shape{hgt}{m}t{otf-ujgr}{n}%
\pxcz@du@decl@shape{hgt}{bx}f{ssub*hgt/m/diruni}{}%
\else                 % noreplace
\ifnum\pxcz@unicode>\@ne % (directunicode*)
\pxcz@du@decl@shape{mc}{m}t{uprml}{}%
\pxcz@du@decl@shape{mc}{bx}f{ssub*gt/m/diruni}{}%
\pxcz@du@decl@shape{gt}{m}t{upgbm}{}%
\pxcz@du@decl@shape{gt}{bx}f{ssub*gt/m/diruni}{}%
\else                          % (directunicode)
\pxcz@du@decl@shape{mc}{m}t{otf-ujmr}{n}%
\pxcz@du@decl@shape{mc}{bx}f{ssub*gt/m/diruni}{}%
\pxcz@du@decl@shape{gt}{m}t{otf-ujgr}{n}%
\pxcz@du@decl@shape{gt}{bx}f{ssub*gt/m/diruni}{}%
\fi
\fi\fi\fi

\g@addto@macro\pxcz@first@doc@hook{%
  \def\pxcz@do#1#2#3{%
    \DeclareFontShape{#1}{#2}{#3}{diruni}{<->ssub*#2/#3/n}{}}%
  \@for\pxcz@tmpa:={\rmdefault,\sfdefault,\ttdefault}\do{%
    \pxcz@force@load@font@fam\pxcz@tmpa
    \@for\pxcz@tmpb:={m,bx}\do{%
      \edef\pxcz@tmpb{{\f@encoding}{\pxcz@tmpa}{\pxcz@tmpb}}%
      \expandafter\pxcz@do\pxcz@tmpb}}%
}
\pxcz@onlypreamble@def\pxcz@force@load@font@fam#1{%
  \begingroup
    \edef\f@family{#1}\def\f@series{m}\def\f@shape{n}%
    \xdef\font@name{\csname\curr@fontshape/\f@size\endcsname}%
    \let\extract@font\relax
    \pickup@font
  \endgroup
}

\fi                 %---- </diruni-ok>

%--------------------------------------- 'glyphid'
\ifnum\pxcz@glyphid>0 %---- <*glyphid>

\ifnum\pxcz@glyphid=2 %---- <*glyphid-ok>

%% check integrity
\ifpxcz@otf@loaded\else
  \g@addto@macro\pxcz@first@doc@hook{%
    % loading otf later causes inconsistency
    \@ifpackageloaded{otf}{%
      \PackageWarningNoLine\pxcz@pkgname
       {The option 'glyphid' will not work. You must\MessageBreak
        load pxchfon after 'otf' package}%
      \def\pxcz@gid{\pxcz@gid@fb}%
      \chardef\pxcz@glyphid=1
    }{}}
\fi

%% \pxcz@gid{<number>}
\def\pxcz@gid#1{%
  \begingroup
    \kanjishape{dirgid}\selectfont
    \kchar#1\pxcz@gid@jfm@sync
  \endgroup}
\let\pxcz@gid@jfm@sync\relax

%% \pxcz@dg@decl@shape{<fam>}{<ser>}<sw>{<tfmname>}
\pxcz@onlypreamble@def\pxcz@dg@decl@shape#1#2#3#4{%
\DeclareFontShape{JY2}{#1}{#2}{dirgid}{<->%
    \pxcz@dg@shape@spec{#3}{#4}{h}}{}%
\DeclareFontShape{JT2}{#1}{#2}{dirgid}{<->%
    \pxcz@dg@shape@spec{#3}{#4}{v}}{}}
\pxcz@onlypreamble@def\pxcz@dg@shape@spec#1#2#3{%
  \if#1t%
    s*[\pxcz@jascale]#2-#3%
  \else#2\fi}

\if d\pxcz@otf@weight % deluxe
\pxcz@dg@decl@shape{hmc}{l}t{zur-gjml}%
\pxcz@dg@decl@shape{hmc}{m}t{zur-gjmr}%
\pxcz@dg@decl@shape{hmc}{bx}t{zur-gjmb}%
\pxcz@dg@decl@shape{hgt}{m}t{zur-gjgr}%
\pxcz@dg@decl@shape{hgt}{bx}t{zur-gjgb}%
\pxcz@dg@decl@shape{hgt}{eb}t{zur-gjge}%
\pxcz@dg@decl@shape{mg}{m}t{zur-gjmgr}%
\else\if b\pxcz@otf@weight % bold
\pxcz@dg@decl@shape{hmc}{m}t{zur-gjmr}%
\pxcz@dg@decl@shape{hmc}{bx}f{ssub*hgt/m/dirgid}{}%
\pxcz@dg@decl@shape{hgt}{m}t{zur-gjgb}%
\pxcz@dg@decl@shape{hgt}{bx}f{ssub*hgt/m/dirgid}{}%
\else\if r\pxcz@otf@weight % default
\pxcz@dg@decl@shape{hmc}{m}t{zur-gjmr}%
\pxcz@dg@decl@shape{hmc}{bx}f{ssub*hgt/m/dirgid}{}%
\pxcz@dg@decl@shape{hgt}{m}t{zur-gjgr}%
\pxcz@dg@decl@shape{hgt}{bx}f{ssub*hgt/m/dirgid}{}%
\else                 % noreplace
\pxcz@dg@decl@shape{mc}{m}t{zur-gjmr}%
\pxcz@dg@decl@shape{mc}{bx}f{ssub*gt/m/dirgid}{}%
\pxcz@dg@decl@shape{gt}{m}t{zur-gjgr}%
\pxcz@dg@decl@shape{gt}{bx}f{ssub*gt/m/dirgid}{}%
\fi\fi\fi

\fi                   %---- </glyphid-ok>

%%<*> \gid{<number>}
\pxcz@Z\newrobustcmd*\gid{\pxcz@gid}

%% \pxcz@gid@fb
\def\pxcz@gid@fb#1{%
    \begingroup
      \pxcz@geta
    \endgroup}
\providecommand*\pxcz@gid{\pxcz@gid@fb}

% redefinition in PDF-strings
\def\pxcz@hy@gid#1{%
  \ifx\pxjahyperBadCharacter\@undefined
    \pxcz@geta
  \else
    \pxjahyperBadCharacter{GID+#1}%
  \fi
}
  \pxcz@hy@disable@commands{%
    \let\gid\pxcz@hy@gid}

\fi                   %---- </glyphid>
%--------------------------------------- 'pxchfon0' submodule
\ifpxcz@lite@mode\else

%% load the submodule
\input{pxchfon0.def}

\fi
%--------------------------------------- begin-document hook

%% \pxcz@set@page@hook{<text>}
\ifpxcz@old@hook@system %----
\ifpxcz@everypage
\pxcz@onlypreamble@def\pxcz@set@page@hook#1{%
  \AtBeginShipout{\setbox\AtBeginShipoutBox=\vbox{%
     \baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@
     #1\copy\AtBeginShipoutBox}}}
\else
\pxcz@onlypreamble@def\pxcz@set@page@hook#1{%
  % this is \AtBeginDvi with forcing of yoko-dir added
  \global\setbox\@begindvibox\vbox{\yoko\unvbox\@begindvibox#1}}
\fi
\else %----
\ifpxcz@everypage
\pxcz@onlypreamble@def\pxcz@set@page@hook#1{%
  \AddToHook{shipout/background}{\hb@xt@\z@{#1\hss}}}
\else
\pxcz@onlypreamble@def\pxcz@set@page@hook#1{%
  \AtBeginDvi{#1}}
\fi
\fi %----

%% \pxcz@check@alldefined{<sym>,...}
\pxcz@onlypreamble@def\pxcz@check@alldefined#1{%
  \pxcz@oktrue
  \@for\pxcz@x:={#1}\do{%
    \expandafter\ifx\csname pxcz@FS/\pxcz@x\endcsname\@empty
      \pxcz@okfalse \fi}}

%% the begin-document hook
\pxcz@onlypreamble@def\pxcz@doc@hook{%
  \ifpxcz@otf
    \@ifpackageloaded{otf}{\pxcz@otftrue}{\pxcz@otffalse}%
    \@ifpackageloaded{utf}{\pxcz@utftrue}{\pxcz@utffalse}%
    \ifx\pxchfonNoCheckMultiweight\@undefined\else
      \pxcz@otftrue
    \fi
  \fi
  \pxcz@user@hook
  \let\pxcz@use@do\pxcz@use@mapfile
  \pxcz@use@list
  \ifx\pxcz@file@preset\relax\else
    \pxcz@do@file@preset
  \fi
  \ifx t\pxcz@strict@csi
    \pxcz@inspect@flavor@all
  \fi
  \if t\pxcz@alphabet % 'alphabet'
    \pxcz@setup@alphabet
    \pxcz@addtospec{ALPHA}%
  \fi
  \if r\pxcz@alphabet % 'relfont'
    \pxcz@setup@relfont
    \pxcz@addtospec{ALPHA}%
  \fi
  \ifpxcz@uptex\else
    \pxcz@addtospec{STD}%
  \fi
  \ifnum0\ifpxcz@legacycode@replace 1\fi
         \ifpxcz@uptex 1\fi >\z@
    \pxcz@addtospec{UPSTD}%
  \fi
  \ifpxcz@otf
    \ifnum0\ifpxcz@legacycode@replace 1\fi
           \ifpxcz@uptex 1\fi >\z@
      \pxcz@addtospec{UPOTF}%
    \fi
    \pxcz@addtospec{OTF}%
  \fi
  \ifnum\pxcz@glyphid=2 \pxcz@addtospec{GID}%
  \fi
  \ifx t\pxcz@expert \pxcz@addtospec{EXPERT}%
  \fi
  \ifpxcz@utf \pxcz@addtospec{UTF}%
  \fi
  % warn if some weights are not substituted, and if necessaty
  \ifx\pxcz@warn@unless@all@defined@for\@empty\else
    \if d\pxcz@otf@weight
      \pxcz@check@alldefined{mnl,mnr,mnb,gtr,gtb,gtx,mgr}%
    \else \pxcz@check@alldefined{mnr,mnb,gtr,gtb}%
    \fi
    \ifpxcz@ok\else
      \def\do##1{\MessageBreak - ##1}%
      \PackageWarningNoLine\pxcz@pkgname
       {There are some weights that font files are\MessageBreak
        not specified for. It is possibly okay,\MessageBreak
        but some features of pxchfon (listed below)\MessageBreak
        might not work properly when applied to\MessageBreak
        such weights.%
        \pxcz@warn@unless@all@defined@for
        \expandafter\@gobble}% gobble the period
    \fi
  \fi
  % warn if some weights are not embedded, and if necessaty
  \ifx\pxcz@warn@unless@all@embedded@for\@empty\else
      \ifpxcz@noembed@used
    \def\do##1{\MessageBreak - ##1}%
    \PackageWarningNoLine\pxcz@pkgname
     {Some font weights have no-embed setting.\MessageBreak
      So some features of pxchfon (listed below)\MessageBreak
      might not work properly when applied to\MessageBreak
      such weights.%
      \pxcz@warn@unless@all@embedded@for
      \expandafter\@gobble}% gobble the period
  \fi\fi
  %
  \pxcz@check@extra
  \pxcz@addtospec{USR}%
  \ifpxcz@enabled
    \pxcz@set@page@hook{\pxcz@spec}%
  \else\ifx\pxcz@spec\@empty\else
    \pxcz@PackageNoteNoLine\pxcz@pkgname
     {Font mapping is disabled, since the driver in use\MessageBreak
      is not dvipdfmx}%
  \fi\fi
  \ifpxcz@dumpmap
    \pxcz@do@dumpmap
  \fi
  \ifpxcz@dumpmap@tl
    \pxcz@do@dumpmap@tl
  \fi
}
\AtBeginDocument{\pxcz@doc@hook}

%--------------------------------------- strict-CSI mode
\ifx t\pxcz@strict@csi
% In this section, the e-TeX extension plus \pdffiledump and
% \pdffilesize is assumed to be available.

%% variables
\newcount\pxcz@cntr
\let\pxcz@insf@file\relax
\let\pxcz@insf@idx\relax
\let\pxcz@insf@nfont\relax
\let\pxcz@kpse@dir\relax

%% constants
\def\pxcz@insf@@OTTO{"4F54544F }
\def\pxcz@insf@@IZ{"00010000 }
\def\pxcz@insf@@ttcf{"74746366 }

%% \pxcz@insf@read@word{<offset>}
% Reads a 32-bit integer from \pxcz@insf@file at the given offset,
% and sets the value (or -1 on error) to \pxcz@cntr.
\pxcz@onlypreamble@def\pxcz@insf@read@word#1{%
  \pxcz@cntr=#1\relax
  \edef\pxcz@tmpa{\pdffiledump offset\pxcz@cntr length1{\pxcz@insf@file}}%
  \ifnum"0\pxcz@tmpa<"80
    \advance\pxcz@cntr\@ne
    \edef\pxcz@tmpb{\pdffiledump offset\pxcz@cntr length3{\pxcz@insf@file}}%
    \ifnum"1\pxcz@tmpb<"1000000 \pxcz@cntr\m@ne % truncated
    \else \pxcz@cntr"\pxcz@tmpa\pxcz@tmpb\relax % the value
    \fi
  \else \pxcz@cntr\m@ne % overflow
  \fi}

%% \pxcz@inspect@flavor{<path>}{<index>}
% Sets the result to \pxcz@cntr.
% 1=CFF, 0=TTF, <0 if error.
\pxcz@onlypreamble@def\pxcz@inspect@flavor#1#2{%
  \edef\pxcz@insf@file{#1}%
  \mathchardef\pxcz@insf@idx=#2\relax
  \pxcz@insf@read@word{0}% outer tag
  \ifnum\pxcz@cntr=\pxcz@insf@@ttcf % TTC/OTC
    \pxcz@insf@read@word{8}% font count
    \ifnum\pxcz@cntr>"7FFF \pxcz@cntr\m@ne \fi
    \ifnum\pxcz@cntr>\m@ne
      \mathchardef\pxcz@insf@nfont\pxcz@cntr
      \@tempcnta\pxcz@insf@idx \multiply\@tempcnta4
      \advance\@tempcnta12 \pxcz@insf@read@word{\@tempcnta}% inner tag
      \@tempcnta\pxcz@cntr
    \fi
  \else % not collection
    \@tempcnta=0 \chardef\pxcz@insf@nfont=1
  \fi
  \ifnum\pxcz@cntr>\m@ne % no format error so far
    \ifnum\pxcz@insf@idx<\pxcz@insf@nfont
      \pxcz@insf@read@word{\@tempcnta}%
      \ifnum\pxcz@cntr=\m@ne % ERROR: bad format
      \else\ifnum\pxcz@cntr=\pxcz@insf@@OTTO \pxcz@cntr\@ne % CFF-flavor
      \else\ifnum\pxcz@cntr=\pxcz@insf@@IZ \pxcz@cntr\z@ % TTF-flavor
      \else \pxcz@cntr-\thr@@ % ERROR: unknown tag
      \fi\fi\fi
    \else \pxcz@cntr-\tw@ % ERROR: bad index
    \fi
  %else ERROR: bad format
  \fi}

%% \pxcz@kpse@dir@cache
% to spped up \pxcz@kpsewhich
\pxcz@onlypreamble@let\pxcz@kpse@dir@cache\@empty

%% \pxcz@kpsewhich{<filename>}
% Sets to \pxcz@kpse@dir the directory where the file is found
% (or \relax if not found).
\pxcz@onlypreamble@def\pxcz@kpsewhich#1{%
  \edef\pxcz@tmpa{#1}\let\pxcz@kpse@dir\relax
  \let\do\pxcz@kpsewhich@do \pxcz@kpse@dir@cache\relax
  \ifx\pxcz@kpse@dir\relax
    \chardef\pxcz@tmpz=\endlinechar \endlinechar\m@ne
    \openin\@inputcheck="|kpsewhich \pxcz@tmpa"\relax
    \unless\ifeof\@inputcheck
      \readline\@inputcheck to\pxcz@tmpb
      \unless\ifx\pxcz@tmpb\@empty
        \let\pxcz@kpse@dir\@empty \let\do\relax
        \expandafter\pxcz@kpsewhich@a\pxcz@tmpb/\pxcz@end
        \edef\pxcz@kpse@dir@cache{%
          \pxcz@kpse@dir@cache\do{\pxcz@kpse@dir}}%
      \fi
    \fi
    \endlinechar\pxcz@tmpz
  \fi}
\pxcz@onlypreamble@def\pxcz@kpsewhich@a#1/#2\pxcz@end{%
  \ifx\pxcz@end#2\pxcz@end \expandafter\@gobble
  \else \expandafter\@firstofone
  \fi{%
    \edef\pxcz@kpse@dir{\pxcz@kpse@dir#1/}%
    \pxcz@kpsewhich@a#2\pxcz@end}}
\pxcz@onlypreamble@def\pxcz@kpsewhich@do#1{%
  \ifnum0\pdffilesize{#1\pxcz@tmpa}>\z@
    \def\pxcz@kpse@dir{#1}%
    \expandafter\pxcz@kpsewhich@do@a
  \fi}
\def\pxcz@kpsewhich@do@a#1\relax{}

%% \pxcz@inspect@flavor@all
% Sets \[pxcz@OT/<sym>].
\pxcz@onlypreamble@def\pxcz@inspect@flavor@all{%
  \@for\pxcz@tmpa:=\pxcz@sym@list\do{%
    \edef\pxcz@tmpa{{\pxcz@tmpa}{\@nameuse{pxcz@FS/\pxcz@tmpa}}}%
    \expandafter\pxcz@inspect@flavor@all@a\pxcz@tmpa}}
\pxcz@onlypreamble@def\pxcz@inspect@flavor@all@a#1#2{%
  \def\pxcz@tmpa{#2}%
  \ifx\pxcz@tmpa\@empty
  \else\ifx\pxcz@tmpa\pxcz@noembed
    \@namedef{pxcz@OT/#1}{t}%
  \else \pxcz@inspect@flavor@all@b#2\pxcz@end{#1}%
  \fi\fi}
\pxcz@onlypreamble@def\pxcz@inspect@flavor@all@b#1#2\pxcz@end{%
  \edef\pxcz@tmpa{\ifx:#1\else:0:\fi#1#2}%
  \expandafter\pxcz@inspect@flavor@all@c\pxcz@tmpa\pxcz@end}
\pxcz@onlypreamble@def\pxcz@inspect@flavor@all@c:#1:#2\pxcz@end#3{%
  \pxcz@kpsewhich{#2}%
  \unless\ifx\pxcz@kpse@dir\relax
    \pxcz@inspect@flavor{\pxcz@kpse@dir#2}{#1}%
%\typeout{#3)\pxcz@kpse@dir#2;#1==>\the\pxcz@cntr}%
    \ifnum\pxcz@cntr>\z@
      \@namedef{pxcz@OT/#3}{t}%
    \fi
  \fi}

\fi
%--------------------------------------- dump font map
% if some dumpmap is enabled...
\ifnum 0\ifpxcz@dumpmap 1\fi
        \ifpxcz@dumpmap@tl 1\fi >\z@

%% variables
\let\pxcz@dump@text\relax
\let\pxcz@spec@save\relax
\newwrite\pxcz@fout

%% \pxcz@add@to@dump@text
\def\pxcz@add@to@dump@text#1{%
  \edef\pxcz@dump@text{\pxcz@dump@text#1}}

%% \pxcz@dump@special{<string>}
\pxcz@onlypreamble@def\pxcz@dump@special#1{%
  \pxcz@dump@special@a#1\bxcz@end}
\pxcz@onlypreamble@def\pxcz@dump@special@a#1 #2\bxcz@end{%
  \@nameuse{pxcz@dump@special@#1}\@gobble{#2}}
\@namedef{pxcz@dump@special@pdf:mapline}#1#2{%
  \pxcz@add@to@dump@text{\pxcz@rmin#2^^J}}

%% \pxcz@rmin
\def\pxcz@rmin#1{%
  \ifx-#1\@percentchar\else#1\fi}

%% \pxcz@dump@spec@to{<file-name>}
\pxcz@onlypreamble@def\pxcz@dump@spec@to#1{%
  \def\pxcz@dump@text{\@percentchar\space#1^^J}%
  \let\special\pxcz@dump@special
  \pxcz@spec \let\special\relax
  \pxcz@add@to@dump@text{\@percentchar\space EOF}%
  \immediate\openout\pxcz@fout=#1\relax
  \immediate\write\pxcz@fout{\pxcz@dump@text}%
  \immediate\closeout\pxcz@fout}

%% \pxcz@do@dumpmap
\pxcz@onlypreamble@def\pxcz@do@dumpmap{%
  \begingroup
    \pxcz@dump@spec@to{\jobname.map}%
  \endgroup}

%% \pxcz@do@dumpmap@tl
\pxcz@onlypreamble@def\pxcz@do@dumpmap@tl{%
  \begingroup
    \let\pxcz@spec@save\pxcz@spec
    \pxcz@do@dumpmap@tl@a{STD}{ptex-\jobname}%
    \pxcz@do@dumpmap@tl@a{UPSTD}{uptex-\jobname}%
    \pxcz@do@dumpmap@tl@a{OTF}{otf-\jobname}%
    \pxcz@do@dumpmap@tl@a{UPOTF}{otf-up-\jobname}%
    \global\let\pxcz@spec\pxcz@spec@save
  \endgroup}
\pxcz@onlypreamble@def\pxcz@do@dumpmap@tl@a#1#2{%
  \global\let\pxcz@spec\@empty
  \pxcz@addtospec{#1}%
  \pxcz@dump@spec@to{#2.map}}

\fi
%--------------------------------------- JFM sync

%%<+> \jfmsync
\DeclareRobustCommand*{\jfmsync}{%
  \pxcz@jfm@sync}
%% \pxcz@jfm@sync
\let\pxcz@jfm@sync\relax

%%<+> \jfmsyncbox{<width>}{<text>}
\DeclareRobustCommand*{\jfmsyncbox}[2]{%
  \makebox[#1][l]{#2\jfmsync}}
\pxcz@hy@disable@commands{%
  \let\jfmsyncbox\@secondoftwo}

\ifpxcz@enabled     %---- when using dvipdfmx

\def\pxcz@jfm@sync{%
  % force to break text stream
  \special{ps:}}

\ifpxcz@autojfmsync %---- <*autojfmsync>
% Makes \git/\CID/\UTF do automatically jfmsync
\let\pxcz@gid@jfm@sync\pxcz@jfm@sync
\g@addto@macro\pxcz@first@doc@hook{%
  \ifx\put@character\@undefined\else
    \g@addto@macro\put@character{\pxcz@jfm@sync}%
  \fi
  \ifx\put@character@\@undefined\else
    \g@addto@macro\put@character@{\pxcz@jfm@sync}%
  \fi}
\fi                 %---- </autojfmsync>
\fi                 %----

%--------------------------------------- preset japanese font mappings

%% \pxcz@declare@preset{<name>}{<text>}
\pxcz@onlypreamble@def\pxcz@declare@preset#1{%
  \pxcz@onlypreamble@csdef{pxcz@the@preset@#1}}

%% \pxcz@declare@preset@alias{<name1>}{<name2>}
\pxcz@onlypreamble@def\pxcz@declare@preset@alias#1#2{%
  \expandafter\pxcz@onlypreamble@let\csname pxcz@the@preset@#1%
  \expandafter\endcsname\csname pxcz@the@preset@#2\endcsname}

%% \pxcz@abolished@preset
\pxcz@onlypreamble@def\pxcz@abolished@preset{%
  \PackageError\pxcz@pkgname
   {The old preset '\pxcz@main@preset' is *abolished*}{\@ehc}%
  \pxcz@uniweight{ERROR.ttf}{ERROR.ttf}}
\@for\pxcz@x:=\pxcz@all@abolished@preset\do{%
  \pxcz@onlypreamble@csdef{pxcz@the@preset@\pxcz@x}{\pxcz@abolished@preset}}

%% \pxcz@uniweight{<font-mn>}{<font-gt>}
\pxcz@onlypreamble@def\pxcz@uniweight#1#2{%
  \setminchofont{#1}\setgothicfont{#2}\setmarugothicfont{#2}}

%% \pxcz@multiweight{<font-mnl>}{<font-mnr>}{<font-mnb>}
%%   {<font-gtr>}{<font-gtb>}{<font-gtx>}{<font-gtu>}{<font-mgr>}
\pxcz@onlypreamble@def\pxcz@multiweight#1#2#3#4#5#6#7#8{%
  \setminchofont{#2}\setgothicfont{#7}\setmarugothicfont{#8}%
  \ifpxcz@oneweight\else
  \setlightminchofont{#1}\setboldminchofont{#3}%
  \setmediumgothicfont{#4}\setboldgothicfont{#5}\setxboldgothicfont{#6}%
  \fi}

%% \pxcz@use@preset{<name>}
\pxcz@onlypreamble@def\pxcz@use@preset#1{%
  \csname pxcz@the@preset@#1\endcsname}

%% Redefine \pxcz@custom
\let\pxcz@custom\pxcz@declare@preset
\pxcz@custom@presets

%% definitions of main preset mappings
\pxcz@declare@preset{noembed}{%
  \pxcz@uniweight{*}{*}}
%(uniweight)
\pxcz@declare@preset{ms}{%
  \pxcz@uniweight{:0:msmincho.ttc}{:0:msgothic.ttc}}
\pxcz@declare@preset{ipa}{%
  \pxcz@uniweight{ipam.ttf}{ipag.ttf}}
\pxcz@declare@preset{ipaex}{%
  \pxcz@uniweight{ipaexm.ttf}{ipaexg.ttf}}
%(multiweight)
\pxcz@declare@preset{ms-hg}{%
  \pxcz@multiweight{:0:msmincho.ttc}{:0:msmincho.ttc}{:0:hgrme.ttc}%
  {:0:hgrgm.ttc}{:0:hgrge.ttc}{:0:hgrsgu.ttc}{:0:msgothic.ttc}{hgrsmp.ttf}}
\pxcz@declare@preset{ipa-hg}{%
  \pxcz@multiweight{ipam.ttf}{ipam.ttf}{:0:hgrme.ttc}%
  {:0:hgrgm.ttc}{:0:hgrge.ttc}{:0:hgrsgu.ttc}{ipag.ttf}{hgrsmp.ttf}}
\pxcz@declare@preset{ipaex-hg}{%
  \pxcz@multiweight{ipaexm.ttf}{ipaexm.ttf}{:0:hgrme.ttc}%
  {:0:hgrgm.ttc}{:0:hgrge.ttc}{:0:hgrsgu.ttc}{ipaexg.ttf}{hgrsmp.ttf}}
\pxcz@declare@preset{moga-mobo}{%
  \pxcz@multiweight{:0:mogam.ttc}{:0:mogam.ttc}{:0:mogamb.ttc}%
  {:0:mogag.ttc}{:0:mogagb.ttc}{:0:mogagb.ttc}{:0:mogag.ttc}{:0:mobog.ttc}}
\pxcz@declare@preset{moga-mobo-ex}{%
  \pxcz@multiweight{:1:mogam.ttc}{:1:mogam.ttc}{:1:mogamb.ttc}%
  {:1:mogag.ttc}{:1:mogagb.ttc}{:1:mogagb.ttc}{:1:mogag.ttc}{:1:mobog.ttc}}
\pxcz@declare@preset{moga-maruberi}{%
  \pxcz@multiweight{:0:mogam.ttc}{:0:mogam.ttc}{:0:mogamb.ttc}%
  {:0:mogag.ttc}{:0:mogagb.ttc}{:0:mogagb.ttc}{:0:mogag.ttc}{MTLmr3m.ttf}}
\pxcz@declare@preset{ume}{%
  \pxcz@multiweight{ume-tmo3.ttf}{ume-tmo3.ttf}{ume-tmo3.ttf}%
  {ume-tgo4.ttf}{ume-tgo5.ttf}{ume-tgo5.ttf}{ume-tgo5.ttf}{ume-tgo4.ttf}}
\pxcz@declare@preset{kozuka-pro}{%
  \usecmapforalphabet
  \pxcz@multiweight{KozMinPro-Light.otf}{KozMinPro-Regular.otf}%
   {KozMinPro-Bold.otf}{KozGoPro-Regular.otf}{KozGoPro-Bold.otf}%
   {KozGoPro-Heavy.otf}{KozGoPro-Medium.otf}{KozGoPro-Heavy.otf}}
\pxcz@declare@preset{kozuka-pr6}{%
  \usecmapforalphabet
  \pxcz@multiweight{KozMinProVI-Light.otf}{KozMinProVI-Regular.otf}%
   {KozMinProVI-Bold.otf}{KozGoProVI-Regular.otf}{KozGoProVI-Bold.otf}%
   {KozGoProVI-Heavy.otf}{KozGoProVI-Medium.otf}{KozGoProVI-Heavy.otf}}
\pxcz@declare@preset{kozuka-pr6n}{%
  \usecmapforalphabet
  \pxcz@multiweight{KozMinPr6N-Light.otf}{KozMinPr6N-Regular.otf}%
   {KozMinPr6N-Bold.otf}{KozGoPr6N-Regular.otf}{KozGoPr6N-Bold.otf}%
   {KozGoPr6N-Heavy.otf}{KozGoPr6N-Medium.otf}{KozGoPr6N-Heavy.otf}}
\pxcz@declare@preset{hiragino-pro}{%
  \usecmapforalphabet
  \pxcz@multiweight{HiraMinPro-W2.otf}{HiraMinPro-W3.otf}%
   {HiraMinPro-W6.otf}{HiraKakuPro-W3.otf}{HiraKakuPro-W6.otf}%
   {HiraKakuStd-W8.otf}{HiraKakuPro-W6.otf}{HiraMaruPro-W4.otf}}
\pxcz@declare@preset{hiragino-pron}{%
  \usecmapforalphabet
  \pxcz@multiweight{HiraMinProN-W2.otf}{HiraMinProN-W3.otf}%
   {HiraMinProN-W6.otf}{HiraKakuProN-W3.otf}{HiraKakuProN-W6.otf}%
   {HiraKakuStdN-W8.otf}{HiraKakuProN-W6.otf}{HiraMaruProN-W4.otf}}
\pxcz@declare@preset{hiragino-elcapitan-pro}{%
  \usecmapforalphabet
  \pxcz@multiweight{HiraMinPro-W2.otf}{:1:HiraginoSerif-W3.ttc}%
   {:1:HiraginoSerif-W6.ttc}{:3:HiraginoSans-W3.ttc}{:3:HiraginoSans-W6.ttc}%
   {:2:HiraginoSans-W8.ttc}{:3:HiraginoSans-W6.ttc}{:0:HiraginoSansR-W4.ttc}}
\pxcz@declare@preset{hiragino-elcapitan-pron}{%
  \usecmapforalphabet
  \pxcz@multiweight{HiraMinProN-W2.otf}{:0:HiraginoSerif-W3.ttc}%
   {:0:HiraginoSerif-W6.ttc}{:2:HiraginoSans-W3.ttc}{:2:HiraginoSans-W6.ttc}%
   {:3:HiraginoSans-W8.ttc}{:2:HiraginoSans-W6.ttc}{:1:HiraginoSansR-W4.ttc}}
\pxcz@declare@preset{morisawa-pro}{%
  \usecmapforalphabet
  \pxcz@multiweight{A-OTF-RyuminPro-Light.otf}{A-OTF-RyuminPro-Light.otf}%
   {A-OTF-FutoMinA101Pro-Bold.otf}{A-OTF-GothicBBBPro-Medium.otf}%
   {A-OTF-FutoGoB101Pro-Bold}{A-OTF-MidashiGoPro-MB31.otf}%
   {A-OTF-GothicBBBPro-Medium.otf}{A-OTF-Jun101Pro-Light.otf}}
\pxcz@declare@preset{morisawa-pr6n}{%
  \usecmapforalphabet
  \pxcz@multiweight{A-OTF-RyuminPr6N-Light.otf}{A-OTF-RyuminPr6N-Light.otf}%
   {A-OTF-FutoMinA101Pr6N-Bold.otf}{A-OTF-GothicBBBPr6N-Medium.otf}%
   {A-OTF-FutoGoB101Pr6N-Bold}{A-OTF-MidashiGoPr6N-MB31.otf}%
   {A-OTF-GothicBBBPr6N-Medium.otf}{A-OTF-Jun101Pro-Light.otf}}
\pxcz@declare@preset{yu-win}{%
  \pxcz@multiweight{yuminl.ttf}{yumin.ttf}%
   {yumindb.ttf}{yugothic.ttf}{yugothib.ttf}%
   {yugothib.ttf}{yugothic.ttf}{yugothic.ttf}}
\pxcz@declare@preset{yu-win10}{%
  \pxcz@multiweight{yuminl.ttf}{yumin.ttf}%
   {yumindb.ttf}{:0:YuGothR.ttc}{:0:YuGothB.ttc}%
   {:0:YuGothB.ttc}{:0:YuGothM.ttc}{:0:YuGothM.ttc}}
\pxcz@declare@preset{yu-osx}{%
  \usecmapforalphabet
  \pxcz@multiweight{YuMin-Medium.otf}{YuMin-Medium.otf}%
   {YuMin-Demibold.otf}{YuGo-Medium.otf}{YuGo-Bold.otf}%
   {YuGo-Bold.otf}{YuGo-Medium.otf}{YuGo-Medium.otf}}
% Source Han Sans/Serif, "OTC"
\pxcz@declare@preset{sourcehan-otc}{%
  \pxcz@multiweight{:0:SourceHanSerif-Light.ttc}%
   {:0:SourceHanSerif-Regular.ttc}{:0:SourceHanSerif-Bold.ttc}%
   {:0:SourceHanSans-Regular.ttc}{:0:SourceHanSans-Bold.ttc}%
   {:0:SourceHanSans-Heavy.ttc}{:0:SourceHanSans-Medium.ttc}%
   {:0:SourceHanSans-Medium.ttc}}
% Source Han Sans/Serif, "Language-specific OTF"
\pxcz@declare@preset{sourcehan}{%
  \pxcz@multiweight{SourceHanSerif-Light.otf}%
   {SourceHanSerif-Regular.otf}{SourceHanSerif-Bold.otf}%
   {SourceHanSans-Regular.otf}{SourceHanSans-Bold.otf}%
   {SourceHanSans-Heavy.otf}{SourceHanSans-Medium.otf}%
   {SourceHanSans-Medium.otf}}
% Source Han Sans/Serif, "Region-specific Subset OTF"
\pxcz@declare@preset{sourcehan-jp}{%
  \pxcz@multiweight{SourceHanSerifJP-Light.otf}%
   {SourceHanSerifJP-Regular.otf}{SourceHanSerifJP-Bold.otf}%
   {SourceHanSansJP-Regular.otf}{SourceHanSansJP-Bold.otf}%
   {SourceHanSansJP-Heavy.otf}{SourceHanSansJP-Medium.otf}%
   {SourceHanSansJP-Medium.otf}}
% Noto Sans/Serif CJK, "OpenType/CFF Collection (OTC)"
\pxcz@declare@preset{noto-otc}{%
  \pxcz@multiweight{:0:NotoSerifCJK-Light.ttc}%
   {:0:NotoSerifCJK-Regular.ttc}{:0:NotoSerifCJK-Bold.ttc}%
   {:0:NotoSansCJK-Regular.ttc}{:0:NotoSansCJK-Bold.ttc}%
   {:0:NotoSansCJK-Black.ttc}{:0:NotoSansCJK-Medium.ttc}%
   {:0:NotoSansCJK-Medium.ttc}}
% Noto Sans/Serif CJK, "Language-specific OpenType/CFF (OTF)"
\pxcz@declare@preset{noto}{%
  \pxcz@multiweight{NotoSerifCJKjp-Light.otf}%
   {NotoSerifCJKjp-Regular.otf}{NotoSerifCJKjp-Bold.otf}%
   {NotoSansCJKjp-Regular.otf}{NotoSansCJKjp-Bold.otf}%
   {NotoSansCJKjp-Black.otf}{NotoSansCJKjp-Medium.otf}%
   {NotoSansCJKjp-Medium.otf}}
% Noto Sans/Serif CJK, "Region-specific Subset OpenType/CFF (Subset OTF)"
\pxcz@declare@preset{noto-jp}{%
  \pxcz@multiweight{NotoSerifJP-Light.otf}%
   {NotoSerifJP-Regular.otf}{NotoSerifJP-Bold.otf}%
   {NotoSansJP-Regular.otf}{NotoSansJP-Bold.otf}%
   {NotoSansJP-Black.otf}{NotoSansJP-Medium.otf}%
   {NotoSansJP-Medium.otf}}
\pxcz@declare@preset{haranoaji}{%
  \usecmapforalphabet
  \pxcz@multiweight{HaranoAjiMincho-Light.otf}%
   {HaranoAjiMincho-Regular.otf}{HaranoAjiMincho-Bold.otf}%
   {HaranoAjiGothic-Regular.otf}{HaranoAjiGothic-Bold.otf}%
   {HaranoAjiGothic-Heavy.otf}{HaranoAjiGothic-Medium.otf}%
   {HaranoAjiGothic-Medium.otf}}
%(alias)
\pxcz@declare@preset@alias{hiragino}{hiragino-pro}
\pxcz@declare@preset@alias{noEmbed}{noembed}
\pxcz@declare@preset@alias{kozuka}{kozuka-pro}
\pxcz@declare@preset@alias{hiragino-elcapitan}{hiragino-elcapitan-pro}
\pxcz@declare@preset@alias{morisawa}{morisawa-pro}
\pxcz@declare@preset@alias{noto-otf}{noto}
%(bang-variants)
\pxcz@declare@preset@alias{sourcehan!}{sourcehan}
\pxcz@declare@preset@alias{sourcehan-otc!}{sourcehan-otc}
\pxcz@declare@preset@alias{sourcehan-jp!}{sourcehan-jp}
\pxcz@declare@preset@alias{noto!}{noto}
\pxcz@declare@preset@alias{noto-otf!}{noto-otf}
\pxcz@declare@preset@alias{noto-otc!}{noto-otc}
\pxcz@declare@preset@alias{noto-jp!}{noto-jp}

%% ... and invokes the specified one!
\if\pxcz@main@preset\relax\else
\pxcz@use@preset{\pxcz@main@preset}
\pxcz@deluxe@usedfalse
\fi

%% load pxufont
\ifx t\pxcz@expert
  \RequirePackage{pxufont-ruby}[]
\else\ifpxcz@legacycode@replace
  \RequirePackage{pxufont}[]
\fi\fi

%--------------------------------------- all done
\endinput
%% EOF
