%%
%% This is file 'pxchfon.sty'.
%% 
%% Copyright (c) 2017 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}[2017/06/19 v1.0a]
\def\pxcz@pkgname{pxchfon}

%% preparations
\def\pxcz@error{\PackageError\pxcz@pkgname}
\def\pxcz@warn{\PackageWarning\pxcz@pkgname}
\def\pxcz@info{\PackageInfo\pxcz@pkgname}

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

%% variables
\newif\ifpxcz@ok
\newif\ifpxcz@utf

%--------------------------------------- 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
% and in addition cause pxjafont to abort immediately.
\@ifpackageloaded{pxjafont}{%
  \ifx\pxAliasedPxjafont\@undefined
    \pxcz@error{Package 'pxjafont' is of incompatible version}%
    {You must use version 0.5 of pxjafont.}%
    \DeclareOption{noalphabet}{}\ProcessOptions
    \let\pxjf@main@preset\relax % make pxjafont bombout
  \endinput\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

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

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

%% 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
\let\pxcz@directunicode\pxcz@directunicode@none
\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}
% preset spec options
\def\pxcz@all@main@preset{%
  noembed,%
  %(uniweight)
  ms,ipa,ipaex,%
  %(multiweight)
  ms-hg,ipa-hg,ipaex-hg,moga-mobo,moga-mobo-ex,moga-maruberi,%
  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,noto-otc,noto%
  %(obsolete)
  ipa-otf,ipa-otf-dx,kozuka4,kozuka6,kozuka6n,hiragino,%
  %(alias)
  ms-dx,ipa-ttf,ipa-ttf-dx,ipav2,ipav2-dx,ipa-dx,hiragino-dx,%
  noEmbed,kozuka,hiragino-elcapitan,morisawa}
  % But note, 'hiragino' != 'hiragino-pro'
\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}}
% others
\def\pxcz@opt@@unicode{unicode}
\def\pxcz@opt@@unicodeS{unicode*}
\DeclareOption*{%
  \ifx\CurrentOption\pxcz@opt@@unicode
    \let\pxcz@directunicode\pxcz@directunicode@full
  \else\ifx\CurrentOption\pxcz@opt@@unicodeS
    \pxcz@uniquifytrue
    \let\pxcz@directunicode\pxcz@directunicode@full
  \else
    \pxcz@parse@opt\CurrentOption
    \ifpxcz@ok\else \@unknownoptionerror \fi
  \fi\fi}
\@onlypreamble\pxcz@parse@opt
\def\pxcz@parse@opt#1{%
  \expandafter\pxcz@parse@opt@a#1\@nnil}
\@onlypreamble\pxcz@parse@opt@a
\def\pxcz@parse@opt@a{%
  \futurelet\pxcz@tok\pxcz@parse@opt@b}
\@onlypreamble\pxcz@parse@opt@b
\def\pxcz@parse@opt@b{%
  \pxcz@okfalse
  \let\pxcz@tmpa\remove@to@nnil
  \ifx+\pxcz@tok
    \pxcz@file@preset@tltrue \let\pxcz@tmpa\pxcz@parse@opt@c
  \else\ifx*\pxcz@tok
    \pxcz@file@preset@tlfalse \let\pxcz@tmpa\pxcz@parse@opt@c
  \fi\fi \pxcz@tmpa}
\@onlypreamble\pxcz@parse@opt@c
\def\pxcz@parse@opt@c#1#2\@nnil{%
  \edef\pxcz@file@preset{#2}}
% dispatch
\ProcessOptions*
%% 'everypage' needs 'atbegshi' package
\ifpxcz@everypage
\RequirePackage{atbegshi}
\fi

%% set 'pxcz@alpha'
\@tempswafalse
\if\pxcz@main@preset\relax
  \if\pxcz@file@preset\relax \@tempswatrue \fi
\fi
\if      t\pxcz@alphabet \pxcz@alphatrue
\else\if f\pxcz@alphabet \pxcz@alphafalse
\else\if r\pxcz@alphabet \pxcz@alphafalse
\else\if@tempswa \pxcz@alphatrue
\else  \pxcz@alphafalse
\fi\fi\fi\fi
\ifpxcz@alpha
  \IfFileExists{pxchfon0.def}{\relax}{%
    \pxcz@error{Option 'alphabet' not available in Lite edition}%
    {You must install full edition of PXchfon bundle, or specify
    'noalphabet'\MessageBreak as package option.}%
  \pxcz@alphafalse}
\fi

%% set 'pxcz@rel'
\if r\pxcz@alphabet \pxcz@reltrue
\else \pxcz@relfalse
\fi
\ifpxcz@rel
  \IfFileExists{pxchfon0.def}{\relax}{%
    \pxcz@error{Option 'relfont' not available in Lite edition}%
    {You must install full edition of PXchfon bundle.}%
  \pxcz@relfalse}
\fi

%% \ifpxcz@alphafont
% Whether or not alphabet fonts are used.
\newif\ifpxcz@alphafont
\ifpxcz@alpha \pxcz@alphafonttrue
\else\ifpxcz@rel \pxcz@alphafonttrue
\else \pxcz@alphafontfalse
\fi\fi

%--------------------------------------- preset-triggered setup

%% \pxcz@if@main@preset{<name>}{<code>}
\@onlypreamble\pxcz@if@main@preset
\def\pxcz@if@main@preset#1{%
  \edef\pxcz@tmpa{#1}%
  \ifx\pxcz@main@preset\pxcz@tmpa \expandafter\@firstofone
  \else \expandafter\@gobble
  \fi}
%% setup
\def\pxcz@preset@setup@sourcehan{%
  \ifnum\pxcz@directunicode=\pxcz@directunicode@all \else
    \let\pxcz@directunicode\pxcz@directunicode@full
    \pxcz@uniquifyfalse
  \fi}
\pxcz@if@main@preset{sourcehan}{%
  \pxcz@preset@setup@sourcehan}
\pxcz@if@main@preset{sourcehan-otc}{%
  \pxcz@preset@setup@sourcehan}
\pxcz@if@main@preset{noto}{%
  \pxcz@preset@setup@sourcehan}
\pxcz@if@main@preset{noto-otc}{%
  \pxcz@preset@setup@sourcehan}
\pxcz@if@main@preset{yu-win10+}{%
  \let\pxcz@directunicode\pxcz@directunicode@full
  \pxcz@uniquifyfalse}

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

%%<*> \setminchofont/\setgothicfont/etc.
\newcommand*\setminchofont{\pxcz@setfont{mnl,mnr,mnb}}
\newcommand*\setgothicfont{\pxcz@setfont{gtr,gtb,gtx,gtu}}
\newcommand*\setlightminchofont{\pxcz@setfont{mnl}}
\newcommand*\setmediumminchofont{\pxcz@setfont{mnr}}
\newcommand*\setboldminchofont{\pxcz@setfont{mnb}}
\newcommand*\setmediumgothicfont{\pxcz@setfont{gtr}}
\newcommand*\setboldgothicfont{\pxcz@setfont{gtb}}
\newcommand*\setxboldgothicfont{\pxcz@setfont{gtx}}
\newcommand*\setoneweightgothicfont{\pxcz@setfont{gtu}}
\newcommand*\setmarugothicfont{\pxcz@setfont{mgr}}
\newcommand*\setkoreanminchofont{\pxcz@setfont{kom}}
\newcommand*\setkoreangothicfont{\pxcz@setfont{kog}}
\newcommand*\setschineseminchofont{\pxcz@setfont{scm}}
\newcommand*\setschinesegothicfont{\pxcz@setfont{scg}}
\newcommand*\settchineseminchofont{\pxcz@setfont{tcm}}
\newcommand*\settchinesegothicfont{\pxcz@setfont{tcg}}
\@onlypreamble\pxcz@setfont
\def\pxcz@setfont#1{\@ifnextchar[%]
  {\pxcz@setfont@a{#1}}{\pxcz@setfont@a{#1}[]}}
\@onlypreamble\pxcz@setfont@a
\def\pxcz@setfont@a#1[#2]#3{%
  \@for\pxcz@x:={#1}\do{%
    \ifx @#2@\@namedef{pxcz@FS/\pxcz@x}{#3}%
    \else\@namedef{pxcz@FS/\pxcz@x}{:#2:#3}\fi}}
\@for\pxcz@x:={%
  mnl,mnr,mnb,gtr,gtb,gtx,gtu,mgr,%
  kom,kog,scm,scg,tcm,tcg%
}\do{\@namedef{pxcz@FS/\pxcz@x}{}}

%--------------------------------------- '\asUTF'
% NB. This feature is superseded by the \diruni command.
\ifpxcz@uptex

%%<*> \asUTF{<jachar>}
\AtBeginDocument{%
  \@ifpackageloaded{otf}{%
    \providecommand*\asUTF{\pxcz@asutf@a}%
  }{}%
}
\def\pxcz@asutf@a#1{%
  \kchardef\pxcz@tmpa=`#1\relax
  \expandafter\pxcz@asutf@b\meaning\pxcz@tmpa\relax
}
\def\pxcz@asutf@b#1"#2\relax{%
  \UTF{#2}%
}

\fi
%--------------------------------------- fontmap internals

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

%% \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
\def\usecmapforalphabet{%
  \global\let\pxcz@cmap@uni\pxcz@cmap@hwuni}
\def\nousecmapforalphabet{%
  \global\let\pxcz@cmap@uni\pxcz@cmap@directuni}
\ifpxcz@cmap@alpha \usecmapforalphabet
\else \nousecmapforalphabet \fi

%% \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{kom}{HYSMyeongJo-Medium}
\pxcz@do{kog}{HYGoThic-Medium}
\pxcz@do{scm}{STSong-Light}
\pxcz@do{scg}{STHeiti-Regular}
\pxcz@do{tcm}{MSung-Light}
\pxcz@do{tcg}{MHei-Medium}

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

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

%%<+> \JaFontUserDefinedMap
\@onlypreamble\JaFontUserDefinedMap
\newcommand*\JaFontUserDefinedMap{%
  \g@addto@macro\pxcz@user@map}
\let\pxcz@user@map\@empty
\@namedef{pxcz@FS/*}{\pxcz@empty}

%%<+> \usefontmapline{<map-line>}
\@onlypreamble\usefontmapline
\newcommand*\usefontmapline[1]{%
  \JaFontUserDefinedMap{\pxcz@addtospec@alt\pxcz@mapline{#1}}}

%%<+> \usefontmapfile{<map-file>}
\@onlypreamble\usefontmapfile
\newcommand*\usefontmapfile[1]{%
  \JaFontUserDefinedMap{\pxcz@addtospec@alt\pxcz@mapfile{#1}}}

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

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

%% \pxcz@pfx@unijis
\edef\pxcz@pfx@unijis{UniJIS\ifpxcz@mmivjis 2004\fi}

%% \pxcz@enable@switch@realfont
\def\pxcz@enable@switch@realfont{%
  \let\pxcz@switch@realfont\pxcz@do@switch@realfont
}
\let\pxcz@switch@realfont\relax

%% \pxcz@do@switch@realfont
\@onlypreamble\pxcz@do@switch@realfont
\def\pxcz@do@switch@realfont{%
  \edef\pxcz@reset@mmivjis{%
    \ifpxcz@mmivjis \noexpand\pxcz@mmivjistrue
    \else \noexpand\pxcz@mmivjisfalse \fi}%
  \let\pxcz@empty\relax
  \pxcz@mmivjistrue  \edef\FONT{\FONTs}%
  \pxcz@mmivjisfalse \edef\FONTo{\FONTs}%
  \pxcz@reset@mmivjis \edef\FONTs{\FONTs}%
  \let\pxcz@empty\@empty}

%% \pxcz@MI
% NB: not \edef
\def\pxcz@MI#1#2:{\ifpxcz@mmivjis:#1:\else:#2:\fi}

%% \pxcz@SH
% NB: not \edef
\def\pxcz@SH#1{%
  \ifx#1/\expandafter\pxcz@SH@otf@dif
  \else \expandafter\pxcz@SH@otc@dif
  \fi}
\def\pxcz@SH@otc@dif#1:{%
  :\the\pxcz@entry@type:}
\def\pxcz@SH@otf@dif#1-{%
  #1\ifcase\pxcz@entry@type\or K\or SC\fi-}

%% \pxcz@NC
% NB: not \edef
\def\pxcz@NC#1{%
  \ifx#1/\expandafter\pxcz@NC@otf@dif
  \else \expandafter\pxcz@NC@otc@dif
  \fi}
\def\pxcz@NC@otc@dif#1:{%
  :\the\pxcz@entry@type:}
\def\pxcz@NC@otf@dif#1jp{%
  #1\ifcase\pxcz@entry@type\or kr\or sc\fi}

%% \pxcz@YW
\def\pxcz@YW#1{%
  \ifx#1/\expandafter\pxcz@YW@mc@dif
  \else \expandafter\pxcz@YW@gt@dif
  \fi}
\def\pxcz@YW@gt@dif#1:{%
  \ifnum\pxcz@entry@type=\tw@ :1:\else:0:\fi}
\def\pxcz@YW@mc@dif#1.ttf{%
  \ifnum\pxcz@entry@type=\tw@ \@nameuse{pxcz@YWG/#1}\else#1.ttf\fi}
\@namedef{pxcz@YWG/yuminl}{:1:YuGothL.ttc}
\@namedef{pxcz@YWG/yumin}{:1:YuGothR.ttc}
\@namedef{pxcz@YWG/yumindb}{:1:YuGothM.ttc}

%% primary macros
\let\pxcz@unidirect\@empty
\let\pxcz@unidirectX\@empty
\let\pxcz@unidirect@wopt\@empty
\let\pxcz@unidirectX@wopt\@empty
\let\pxcz@unidirectX@lopt\@gobble
\ifnum\pxcz@directunicode<\pxcz@directunicode@otf\else
\def\pxcz@unidirect#1-#2-#3{\pxcz@cmap@directuni}
\def\pxcz@unidirect@wopt{ -w 1}
\fi
\ifnum\pxcz@directunicode<\pxcz@directunicode@all\else
\let\pxcz@unidirectX\pxcz@unidirect
\let\pxcz@unidirectX@wopt\pxcz@unidirect@wopt
\fi
\ifnum\pxcz@directunicode<\pxcz@directunicode@full\else
\def\pxcz@unidirectX@lopt#1{ -l #1}
\fi
%% secondary macros
\def\pxcz@entry@UniJIS{\@+\pxcz@pfx@unijis}%
\def\pxcz@entry@@hwid{\@l{hwid}}%
\def\pxcz@entry@@fwid{\@l{fwid}}%
\def\pxcz@entry@@jp#1#2{\@l{jp#1#2}}%
\ifpxcz@mmivjis
\def\pxcz@entry@@jpXX{\@l{jp04}}
\else
\def\pxcz@entry@@jpXX{\@l{jp90}}
\fi
\ifpxcz@uniquify
\let\pxcz@entry@@hwid\pxcz@entry@@jpXX
\let\pxcz@entry@@fwid\pxcz@entry@@jpXX
\fi

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

%% \pxcz@addtospec{<id>}
\@onlypreamble\pxcz@addtospec
\def\pxcz@addtospec#1{%
  \bgroup \let\Entry\pxcz@Entry
    \let\ \space \let\*\pxcz@pfx@jis
    \let\UniJIS\pxcz@entry@UniJIS
    \let\@hwid\pxcz@entry@@hwid \let\@fwid\pxcz@entry@@fwid
    \let\@jp\pxcz@entry@@jp \let\@jpXX\pxcz@entry@@jpXX
    \@nameuse{pxcz@ME/#1}\egroup}
\@onlypreamble\pxcz@Entry
\def\pxcz@Entry#1{%
  \def\pxcz@entry@sym{#1}%
  \expandafter\let\expandafter\FONT\csname pxcz@FS/#1\endcsname
  \let\FONTo\FONT \let\FONTs\FONT
  \ifx\FONT\pxcz@noembed
    \let\UniCMap\pxcz@cmap@hwuni
    \let\+\@empty \let\w\@empty \def\@+{}\let\@w\@empty
    \let\@l\@gobble
    \edef\FONT{!\@nameuse{pxcz@NEF/#1}}%
    \let\FONTo\FONT \let\FONTs\FONT
  \else\ifx\FONT\@empty\else
    \let\UniCMap\pxcz@cmap@uni
    \let\+\pxcz@unidirect \let\w\pxcz@unidirect@wopt
    \def\@+{\pxcz@unidirectX}\let\@w\pxcz@unidirectX@wopt
    \let\@l\pxcz@unidirectX@lopt
    \pxcz@switch@realfont
  \fi\fi
  \ifx\FONT\@empty \expandafter\@gobbletwo
  \else \expandafter\pxcz@entry@a \fi}
\@onlypreamble\pxcz@entry@a
\def\pxcz@entry@a#1#2{%
  \chardef\pxcz@entry@type=#1\relax
  \pxcz@check@entry \ifpxcz@ok
    \xdef\pxcz@spec{%
      \pxcz@spec\noexpand\special{\pxcz@mapline{#2}}}%
  \fi}

%% \pxcz@check@entry
\@onlypreamble\pxcz@check@entry
\def\pxcz@sym@@mgr{mgr}
\def\pxcz@check@entry{%
  \pxcz@oktrue
  \ifnum\pxcz@entry@type=\@ne
    \ifx\pxcz@entry@sym\pxcz@sym@@mgr
      \expandafter\ifx\csname pxcz@FS/gtr\endcsname\relax\else
        \pxcz@okfalse \fi
    \fi
  \fi}

%% \pxcz@do@file@preset
\@onlypreamble\pxcz@do@file@preset
\def\pxcz@do@file@preset{%
  \ifpxcz@file@preset@tl
    \pxcz@do@file@preset@a{ptex-}%
    \ifpxcz@uptex \pxcz@do@file@preset@a{uptex-}\fi
    \ifpxcz@otf
      \pxcz@do@file@preset@a{otf-}%
      \ifpxcz@uptex \pxcz@do@file@preset@a{otf-up-}\fi
    \fi
  \else
    \pxcz@do@file@preset@a{}%
  \fi}
\@onlypreamble\pxcz@do@file@preset@a
\def\pxcz@do@file@preset@a#1{%
  \pxcz@addtospec@alt\pxcz@mapfile{#1\pxcz@file@preset.map}}

%% \pxcz@addtospec@alt
\def\pxcz@addtospec@alt#1#2{%
  \xdef\pxcz@spec{\pxcz@spec\noexpand\special{#1{#2}}}}
\def\pxcz@mapfile#1{pdf:mapfile #1}
\def\pxcz@mapline#1{pdf:mapline #1}

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

%% \pxcz@mapentry{<id>}{<text>}
\def\pxcz@mapentry#1{%
  \expandafter\pxcz@mapentry@a\csname pxcz@ME/#1\endcsname}
\def\pxcz@mapentry@a#1{\@onlypreamble#1\def#1}

%% map entries
% \FONT: file name for the 2004JIS font
% \FONTo: file name for the 90JIS font
% \FONTs: \FONT if prefer2004jis, \FONTo otherwise
% \*H: 2004-H if prefer2004jis, H otherwise
% \UniJIS: UniJIS2004 if prefer2004jis, UniJIS otherwise
% \+Uni...-H: replaced by 'unicode' if directunicode
% \@+Uni...-H: replaced by 'unicode' if directunicode*
% \w: '-w 1' if directunicode
% \@w: '-w 1' if directunicode*
\pxcz@mapentry{STD}{%
\Entry{mnr}0{rml             \*H                     \FONTs}%
\Entry{mnr}0{rmlv            \*V                     \FONTs}%
\Entry{gtu}0{gbm             \*H                     \FONTs}%
\Entry{gtu}0{gbmv            \*V                     \FONTs}%
}
\pxcz@mapentry{ALPHA}{%
\Entry{mnl}1{r-cfjar-l-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
\Entry{mnr}1{r-cfjar-r-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
\Entry{mnb}1{r-cfjar-b-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
\Entry{gtr}1{r-cfjas-r-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
\Entry{gtb}1{r-cfjas-b-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
\Entry{gtx}1{r-cfjas-x-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
\Entry{mgr}1{r-cfjas-r-@PXcjk0@ \UniCMap\            \FONT\@hwid}%
}
\pxcz@mapentry{UTF}{%
\Entry{mnr}0{unijmin-h       \UniJIS-UTF16-H         \FONTs}%
\Entry{mnr}0{unijmin-v       \UniJIS-UTF16-V         \FONTs\@w}%
\Entry{mnr}0{cidmin-h        Identity-H              \FONT/AJ16}%
\Entry{mnr}0{cidmin-v        Identity-V              \FONT/AJ16}%
\Entry{mnr}0{hmr             \*H                     \FONTs}%
\Entry{mnr}0{hmrv            \*V                     \FONTs}%
\Entry{gtu}0{unijgoth-h      \UniJIS-UTF16-H         \FONTs}%
\Entry{gtu}0{unijgoth-v      \UniJIS-UTF16-V         \FONTs\@w}%
\Entry{gtu}0{cidgoth-h       Identity-H              \FONT/AJ16}%
\Entry{gtu}0{cidgoth-v       Identity-V              \FONT/AJ16}%
\Entry{gtu}0{hkb             \*H                     \FONTs}%
\Entry{gtu}0{hkbv            \*V                     \FONTs}%
}
\pxcz@mapentry{OTF}{%
\Entry{mnl}0{otf-ujml-h      \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{mnl}0{otf-ujml-v      \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{mnl}0{otf-cjml-h      Identity-H              \FONT/AJ16}%
\Entry{mnl}0{otf-cjml-v      Identity-V              \FONT/AJ16}%
\Entry{mnl}0{hminl-h         H                       \FONTo}%
\Entry{mnl}0{hminl-v         V                       \FONTo}%
\Entry{mnl}0{otf-ujmln-h     \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{mnl}0{otf-ujmln-v     \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{mnl}0{hminln-h        H                       \FONT}%
\Entry{mnl}0{hminln-v        V                       \FONT}%
\Entry{mnr}0{otf-ujmr-h      \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{mnr}0{otf-ujmr-v      \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{mnr}0{otf-cjmr-h      Identity-H              \FONT/AJ16}%
\Entry{mnr}0{otf-cjmr-v      Identity-V              \FONT/AJ16}%
\Entry{mnr}0{hminr-h         H                       \FONTo}%
\Entry{mnr}0{hminr-v         V                       \FONTo}%
\Entry{mnr}0{otf-ujmrn-h     \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{mnr}0{otf-ujmrn-v     \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{mnr}0{hminrn-h        H                       \FONT}%
\Entry{mnr}0{hminrn-v        V                       \FONT}%
\Entry{mnb}0{otf-ujmb-h      \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{mnb}0{otf-ujmb-v      \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{mnb}0{otf-cjmb-h      Identity-H              \FONT/AJ16}%
\Entry{mnb}0{otf-cjmb-v      Identity-V              \FONT/AJ16}%
\Entry{mnb}0{hminb-h         H                       \FONTo}%
\Entry{mnb}0{hminb-v         V                       \FONTo}%
\Entry{mnb}0{otf-ujmbn-h     \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{mnb}0{otf-ujmbn-v     \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{mnb}0{hminbn-h        H                       \FONT}%
\Entry{mnb}0{hminbn-v        V                       \FONT}%
\Entry{gtr}0{otf-ujgr-h      \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{gtr}0{otf-ujgr-v      \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{gtr}0{otf-cjgr-h      Identity-H              \FONT/AJ16}%
\Entry{gtr}0{otf-cjgr-v      Identity-V              \FONT/AJ16}%
\Entry{gtr}0{hgothr-h        H                       \FONTo}%
\Entry{gtr}0{hgothr-v        V                       \FONTo}%
\Entry{gtr}0{otf-ujgrn-h     \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{gtr}0{otf-ujgrn-v     \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{gtr}0{hgothrn-h       H                       \FONT}%
\Entry{gtr}0{hgothrn-v       V                       \FONT}%
\Entry{gtb}0{otf-ujgb-h      \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{gtb}0{otf-ujgb-v      \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{gtb}0{otf-cjgb-h      Identity-H              \FONT/AJ16}%
\Entry{gtb}0{otf-cjgb-v      Identity-V              \FONT/AJ16}%
\Entry{gtb}0{hgothb-h        H                       \FONTo}%
\Entry{gtb}0{hgothb-v        V                       \FONTo}%
\Entry{gtb}0{otf-ujgbn-h     \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{gtb}0{otf-ujgbn-v     \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{gtb}0{hgothbn-h       H                       \FONT}%
\Entry{gtb}0{hgothbn-v       V                       \FONT}%
\Entry{gtx}0{otf-ujge-h      \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{gtx}0{otf-ujge-v      \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{gtx}0{otf-cjge-h      Identity-H              \FONT/AJ16}%
\Entry{gtx}0{otf-cjge-v      Identity-V              \FONT/AJ16}%
\Entry{gtx}0{hgotheb-h       H                       \FONTo}%
\Entry{gtx}0{hgotheb-v       V                       \FONTo}%
\Entry{gtx}0{otf-ujgen-h     \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{gtx}0{otf-ujgen-v     \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{gtx}0{hgothebn-h      H                       \FONT}%
\Entry{gtx}0{hgothebn-v      V                       \FONT}%
\Entry{mgr}0{otf-ujmgr-h     \+UniJIS-UTF16-H        \FONTo\@jp90}%
\Entry{mgr}0{otf-ujmgr-v     \+UniJIS-UTF16-V        \FONTo\w\@jp90}%
\Entry{mgr}0{otf-cjmgr-h     Identity-H              \FONT/AJ16}%
\Entry{mgr}0{otf-cjmgr-v     Identity-V              \FONT/AJ16}%
\Entry{mgr}0{hmgothr-h       H                       \FONTo}%
\Entry{mgr}0{hmgothr-v       V                       \FONTo}%
\Entry{mgr}0{otf-ujmgrn-h    \+UniJIS2004-UTF16-H    \FONT\@jp04}%
\Entry{mgr}0{otf-ujmgrn-v    \+UniJIS2004-UTF16-V    \FONT\w\@jp04}%
\Entry{mgr}0{hmgothrn-h      H                       \FONT}%
\Entry{mgr}0{hmgothrn-v      V                       \FONT}%
%
\ifpxcz@otf@multi
\Entry{kom}0{otf-ukmr-h      \+UniKS-UTF16-H         \FONT}%
\Entry{kom}0{otf-ukmr-v      \+UniKS-UTF16-V         \FONT\w}%
\Entry{kom}0{otf-ckmr-h      Identity-H              \FONT/AK12}%
\Entry{kom}0{otf-ckmr-v      Identity-V              \FONT/AK12}%
\Entry{kog}0{otf-ukgr-h      \+UniKS-UTF16-H         \FONT}%
\Entry{kog}0{otf-ukgr-v      \+UniKS-UTF16-V         \FONT\w}%
\Entry{kog}0{otf-ckgr-h      Identity-H              \FONT/AK12}%
\Entry{kog}0{otf-ckgr-v      Identity-V              \FONT/AK12}%
\Entry{scm}0{otf-ucmr-h      \+UniGB-UTF16-H         \FONT}%
\Entry{scm}0{otf-ucmr-v      \+UniGB-UTF16-V         \FONT\w}%
\Entry{scm}0{otf-ccmr-h      Identity-H              \FONT/AG14}%
\Entry{scm}0{otf-ccmr-v      Identity-V              \FONT/AG14}%
\Entry{scg}0{otf-ucgr-h      \+UniGB-UTF16-H         \FONT}%
\Entry{scg}0{otf-ucgr-v      \+UniGB-UTF16-V         \FONT\w}%
\Entry{scg}0{otf-ccgr-h      Identity-H              \FONT/AG14}%
\Entry{scg}0{otf-ccgr-v      Identity-V              \FONT/AG14}%
\Entry{tcm}0{otf-utmr-h      \+UniCNS-UTF16-H        \FONT}%
\Entry{tcm}0{otf-utmr-v      \+UniCNS-UTF16-V        \FONT\w}%
\Entry{tcm}0{otf-ctmr-h      Identity-H              \FONT/AC14}%
\Entry{tcm}0{otf-ctmr-v      Identity-V              \FONT/AC14}%
\Entry{tcg}0{otf-utgr-h      \+UniCNS-UTF16-H        \FONT}%
\Entry{tcg}0{otf-utgr-v      \+UniCNS-UTF16-V        \FONT\w}%
\Entry{tcg}0{otf-ctgr-h      Identity-H              \FONT/AC14}%
\Entry{tcg}0{otf-ctgr-v      Identity-V              \FONT/AC14}%
\fi
}
\pxcz@mapentry{UPSTD}{%
\Entry{mnr}0{uprml-h         \UniJIS-UTF16-H         \FONTs\@jpXX}%
\Entry{mnr}0{uprml-v         \UniJIS-UTF16-V         \FONTs\@w\@jpXX}%
\Entry{mnr}2{uprml-hq        \@+UniJIS-UCS2-H        \FONT\@fwid}%
\Entry{gtu}0{upgbm-h         \UniJIS-UTF16-H         \FONTs\@jpXX}%
\Entry{gtu}0{upgbm-v         \UniJIS-UTF16-V         \FONTs\@w\@jpXX}%
\Entry{gtu}2{upgbm-hq        \@+UniJIS-UCS2-H        \FONT\@fwid}%
\Entry{mnr}0{urml            \UniJIS-UTF16-H         \FONTs\@jpXX}%
\Entry{mnr}0{urmlv           \UniJIS-UTF16-V         \FONTs\@w\@jpXX}%
\Entry{gtu}0{ugbm            \UniJIS-UTF16-H         \FONTs\@jpXX}%
\Entry{gtu}0{ugbmv           \UniJIS-UTF16-V         \FONTs\@w\@jpXX}%
%
\Entry{kom}0{uphysmjm-h      \@+UniKS-UTF16-H        \FONT}%
\Entry{kom}0{uphysmjm-v      \@+UniKS-UTF16-V        \FONT\@w}%
\Entry{kog}0{uphygt-h        \@+UniKS-UTF16-H        \FONT}%
\Entry{kog}0{uphygt-v        \@+UniKS-UTF16-V        \FONT\@w}%
\Entry{scm}0{upstsl-h        \@+UniGB-UTF16-H        \FONT}%
\Entry{scm}0{upstsl-v        \@+UniGB-UTF16-V        \FONT\@w}%
\Entry{scg}0{upstht-h        \@+UniGB-UTF16-H        \FONT}%
\Entry{scg}0{upstht-v        \@+UniGB-UTF16-V        \FONT\@w}%
\Entry{tcm}0{upmsl-h         \@+UniCNS-UTF16-H       \FONT}%
\Entry{tcm}0{upmsl-v         \@+UniCNS-UTF16-V       \FONT\@w}%
\Entry{tcg}0{upmhm-h         \@+UniCNS-UTF16-H       \FONT}%
\Entry{tcg}0{upmhm-v         \@+UniCNS-UTF16-V       \FONT\@w}%
}
\pxcz@mapentry{UPOTF}{%
\Entry{mnl}0{uphminl-h       \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{mnl}0{uphminl-v       \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{mnl}0{uphminln-h      \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{mnl}0{uphminln-v      \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
\Entry{mnr}0{uphminr-h       \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{mnr}0{uphminr-v       \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{mnr}0{uphminrn-h      \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{mnr}0{uphminrn-v      \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
\Entry{mnb}0{uphminb-h       \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{mnb}0{uphminb-v       \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{mnb}0{uphminbn-h      \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{mnb}0{uphminbn-v      \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
\Entry{gtr}0{uphgothr-h      \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{gtr}0{uphgothr-v      \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{gtr}0{uphgothrn-h     \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{gtr}0{uphgothrn-v     \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
\Entry{gtb}0{uphgothb-h      \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{gtb}0{uphgothb-v      \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{gtb}0{uphgothbn-h     \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{gtb}0{uphgothbn-v     \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
\Entry{gtx}0{uphgotheb-h     \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{gtx}0{uphgotheb-v     \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{gtx}0{uphgothebn-h    \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{gtx}0{uphgothebn-v    \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
\Entry{mgr}0{uphmgothr-h     \@+UniJIS-UTF16-H       \FONTs\@jp90}%
\Entry{mgr}0{uphmgothr-v     \@+UniJIS-UTF16-V       \FONTs\@w\@jp90}%
\Entry{mgr}0{uphmgothrn-h    \@+UniJIS2004-UTF16-H   \FONTs\@jp04}%
\Entry{mgr}0{uphmgothrn-v    \@+UniJIS2004-UTF16-V   \FONTs\@w\@jp04}%
}
\pxcz@mapentry{PXOTF}{%
}

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

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

%% variables
\newif\ifpxcz@diruni@ok
\let\pxcz@otf@weight\relax

%% check if \diruni is available
\ifpxcz@uptex
  \@ifpackageloaded{otf}{% directunicode needs otf
    \ifnum\pxcz@directunicode>\z@ \pxcz@diruni@oktrue \fi
  }{%else
    \ifnum\pxcz@directunicode<\pxcz@directunicode@all\else
      \pxcz@diruni@oktrue % directunicode* does not need otf
      \AtBeginDocument{% to laod otf later causes inconsistency
        \@ifpackageloaded{otf}{\pxcz@diruni@okfalse}{}}%
    \fi
  }
\fi

%%<*> \diruni
\DeclareRobustCommand*{\diruni}{%
  \not@math@alphabet\diruni\relax
  \fontshape{diruni}\selectfont
}

%%<*> \textdiruni{<text>}
\newcommand*{\textdiruni}[1]{%
  \relax\ifmmode\hbox\fi{\diruni#1}%
}

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

%% \pxcz@otf@weight: otf weight mode
% watch out for priority...
\@ifpackagewith{otf}{deluxe}{%
  \let\pxcz@otf@weight=d
}{\@ifpackagewith{otf}{bold}{%
  \let\pxcz@otf@weight=b
}{\@ifpackagewith{otf}{noreplace}{%
  \let\pxcz@otf@weight=n
}{\@ifpackageloaded{otf}{%
  \let\pxcz@otf@weight=r
}{%else
  \let\pxcz@otf@weight=n
}}}}
%% \pxcz@otf@mmivjis: otf jis2004
\@ifpackagewith{otf}{jis2004}{%
  \let\pxcz@otf@mmivjis=t%
}{%else
  \let\pxcz@otf@mmivjis=f%
}
%% \pxcz@du@scale
\let\pxcz@du@scale\utf@sc@le
\ifx\pxcz@du@scale\@undefined
  \let\pxcz@du@scale\Cjascale
\fi
\ifx\pxcz@du@scale\@undefined
  \edef\pxcz@du@scale{\ifx\jsc@JYn\@undefined 0.962216\else 0.924715\fi}%
\fi

%% \pxcz@du@decl@shape{<fam>}{<ser>}{<font>}
\@onlypreamble\pxcz@du@decl@shape
\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}}{}}
\@onlypreamble\pxcz@du@shape@spec
\def\pxcz@du@shape@spec#1#2#3#4{%
  \if#1t%
    s*[\pxcz@du@scale]#2\if t\pxcz@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@directunicode>\@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

\AtBeginDocument{%
  \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}}%
}
\@onlypreamble\pxcz@force@load@font@fam
\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>

%% \pxcz@err@diruni
\ifcase\pxcz@directunicode
  \def\pxcz@errhelp@diruni{%
    You must use upLaTeX and load pxchfon with 'directunicode(*)' option.}
\else
  \def\pxcz@errhelp@diruni{%
    You must use upLaTeX and load pxchfon after 'otf' package.}
\fi
\def\pxcz@err@diruni{%
  \pxcz@error{Command '\string\diruni' not available}%
   {\pxcz@errhelp@diruni\MessageBreak\@ehc}%
  \global\let\pxcz@err@diruni\relax}
\AtBeginDocument{%
  \ifpxcz@diruni@ok
    \let\pxcz@err@diruni\relax
    \let\pxcz@errhelp@diruni\relax
  \else
    \let\diruni\pxcz@err@diruni
  \fi}

%--------------------------------------- 'alphabet' option

%% \pxcz@decl@shape{<fam>}{<ser>}{<font>}
\@onlypreamble\pxcz@decl@shape
\def\pxcz@decl@shape#1#2#3{%
\DeclareFontShape{OT1}{#1}{#2}{n}{<->#3}{}%
\DeclareFontShape{OT1}{#1}{#2}{it}{<->ssub*#1/#2/n}{}}

\let\pxcz@check@extra\@empty
\@onlypreamble\pxcz@check@extra
%
\ifpxcz@alphafont   %---- <*alphabet>
\ifpxcz@otf@deluxe  %---- <*otfdx> : otf with deluxe option
  % define families cfjar & cfjas
\DeclareFontFamily{OT1}{cfjar}{}%
\pxcz@decl@shape{cfjar}{l}{cfjar-l-l0j}%
\pxcz@decl@shape{cfjar}{m}{cfjar-r-l0j}%
\pxcz@decl@shape{cfjar}{bx}{cfjar-b-l0j}%
\DeclareFontFamily{OT1}{cfjas}{}%
\pxcz@decl@shape{cfjas}{m}{cfjas-r-l0j}%
\pxcz@decl@shape{cfjas}{bx}{cfjas-b-l0j}%
\pxcz@decl@shape{cfjas}{eb}{cfjas-x-l0j}%
  % redefine \ltseries & \ebseries so they affect roman font
\let\ltseries\relax \let\ebseries\relax
\DeclareRobustCommand\ltseries{%
  \not@math@alphabet\ltseries\relax
  \fontseries\ltdefault\selectfont}%
\DeclareRobustCommand\ebseries{%
  \not@math@alphabet\ebseries\relax
  \fontseries\ebdefault\selectfont}%
\else               %---- <*!otfdx>
\DeclareFontFamily{OT1}{cfjar}{}%
\pxcz@decl@shape{cfjar}{m}{cfjar-r-l0j}%
\pxcz@decl@shape{cfjar}{bx}{ssub*cfjas/m/n}%
\DeclareFontFamily{OT1}{cfjas}{}%
\pxcz@decl@shape{cfjas}{m}{cfjas-r-l0j}%
\pxcz@decl@shape{cfjas}{bx}{ssub*cfjas/m/n}%
\@onlypreamble\pxcz@err@dxotf
\def\pxcz@err@dxotf#1{%
  \pxcz@error{Loaded before '#1' with 'deluxe'}%
  {This package must be loaded after '#1' with 'deluxe' option
  when using both.}}
\def\pxcz@check@extra{%
  \expandafter\let\expandafter\pxcz@x\csname pxcz@FS/mnr\endcsname
  \ifx\pxcz@x\@empty\else
    % if mnr is replaced but gtr is not then ...
    \expandafter\ifx\csname pxcz@FS/gtr\endcsname\@empty
      {\expandafter\let\csname pxcz@FS/gtr\endcsname\pxcz@x
        \pxcz@Entry{gtr}1{r-cfjas-r-@PXcjk0@ \pxcz@cmap@uni\space \FONT}}%
  \fi\fi
  \@ifpackagewith{otf}{deluxe}{\pxcz@err@dxotf{otf}}{}%
  \@ifpackagewith{pxotf}{deluxe}{\pxcz@err@dxotf{pxotf}}{}%
}
\fi                 %---- </otfdx>
\fi                 %---- </alphabet>

%--------------------------------------- begin-document hook

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

%% the begin-document hook
\@onlypreamble\pxcz@check@alldefined
\def\pxcz@check@alldefined#1{%
  \pxcz@oktrue
  \@for\pxcz@x:={#1}\do{%
    \expandafter\ifx\csname pxcz@FS/\pxcz@x\endcsname\@empty
      \pxcz@okfalse \fi}}
\AtBeginDocument{%
  \pxcz@user@hook
  \ifx\pxcz@file@preset\relax\else
    \pxcz@do@file@preset
  \fi
  \ifpxcz@alpha
    \pxcz@check@alldefined{mnl,mnr,mnb}%
    \ifpxcz@ok \renewcommand\rmdefault{cfjar}\fi
    \pxcz@check@alldefined{gtr,gtb,gtx}%
    \ifpxcz@ok \renewcommand\sfdefault{cfjas}\fi
    \edef\pxcz@tmpa{\encodingdefault}\def\pxcz@tmpb{OT1}
    \ifx\pxcz@tmpa\pxcz@tmpb\else
      \pxcz@warn{Default encoding is changed to 'OT1' because%
        \MessageBreak'alphabet' option is in effect}%
    \fi
    \renewcommand\encodingdefault{OT1}\normalfont
    \pxcz@addtospec{ALPHA}%
  \fi
  \ifpxcz@rel
    \pxcz@check@alldefined{mnl,mnr,mnb}%
    \ifpxcz@ok \pxcz@decl@relfont\mcdefault{cfjar}{l}\fi
    \pxcz@check@alldefined{gtr,gtb,gtx}%
    \ifpxcz@ok \pxcz@decl@relfont\gtdefault{cfjas}{eb}\fi
    \pxcz@addtospec{ALPHA}%
  \fi
  \ifpxcz@uptex \pxcz@addtospec{UPSTD}%
  \else         \pxcz@addtospec{STD}%
  \fi
  \ifpxcz@otf
    \@ifpackageloaded{otf}{\pxcz@otftrue}{\pxcz@otffalse}%
    \@ifpackageloaded{utf}{\pxcz@utftrue}{\pxcz@utffalse}%
  \fi
  \ifpxcz@otf
    \ifpxcz@uptex \pxcz@addtospec{UPOTF}\fi
    \pxcz@addtospec{OTF}%
  \fi
  \ifpxcz@utf \pxcz@addtospec{UTF}%
  \fi
  \@ifpackageloaded{pxotf}{\pxcz@oktrue}{\pxcz@okfalse}%
  \@ifpackageloaded{pxfontenc}{\pxcz@oktrue}{}%
  \ifpxcz@ok \pxcz@addtospec{PXOTF}%
  \fi
  \pxcz@check@extra
  \pxcz@addtospec{USR}%
  \ifpxcz@enabled
    \pxcz@set@page@hook{\pxcz@spec}%
  \else\ifx\pxcz@spec\@empty\else
    \PackageWarningNoLine\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
}

%% \pxcz@decl@relfont
\@onlypreamble\pxcz@decl@relfont
\def\pxcz@decl@relfont#1#2#3{%
  \DeclareRelationFont{\k@encoding}{#1}{m}{}{OT1}{#2}{m}{}%
  \DeclareRelationFont{\k@encoding}{#1}{bx}{}{OT1}{#2}{bx}{}%
  \ifpxcz@otf@deluxe
    \DeclareRelationFont{\k@encoding}{#1}{#3}{}{OT1}{#2}{#3}{}%
  \fi
  \pxcz@info{Relation font set for \k@encoding/#1}%
}

%--------------------------------------- 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>}
\@onlypreamble\pxcz@dump@special
\def\pxcz@dump@special#1{%
  \pxcz@dump@special@a#1\bxcz@end}
\@onlypreamble\pxcz@dump@special@a
\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{#2^^J}}

%% \pxcz@dump@spec@to{<file-name>}
\@onlypreamble\pxcz@dump@spec@to
\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
\@onlypreamble\pxcz@do@dumpmap
\def\pxcz@do@dumpmap{%
  \begingroup
    \pxcz@dump@spec@to{\jobname.map}%
  \endgroup}

%% \pxcz@do@dumpmap@tl
\@onlypreamble\pxcz@do@dumpmap@tl
\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}
\@onlypreamble\pxcz@do@dumpmap@tl@a
\def\pxcz@do@dumpmap@tl@a#1#2{%
  \global\let\pxcz@spec\@empty
  \pxcz@addtospec{#1}%
  \pxcz@dump@spec@to{#2.map}}

\fi
%--------------------------------------- preset japanese font mappings

%% \pxcz@declare@preset{<name>}{<text>}
\@onlypreamble\pxcz@declare@preset
\def\pxcz@declare@preset#1{%
  \expandafter\pxcz@decl@preset@a\csname pxcz@the@preset@#1\endcsname}
\def\pxcz@decl@preset@a#1{\@onlypreamble#1\def#1}

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

%% \pxcz@declare@depre@preset
\@onlypreamble\pxcz@declare@depre@preset
\def\pxcz@declare@depre@preset#1{%
  \pxcz@declare@deprecated{#1}%
  \pxcz@declare@preset{#1}}
%% \pxcz@declare@depre@preset@alias
\@onlypreamble\pxcz@declare@depre@preset@alias
\def\pxcz@declare@depre@preset@alias#1{%
  \pxcz@declare@deprecated{#1}%
  \pxcz@declare@preset@alias{#1}}
%% \pxcz@declare@deprecated{<name>}
\def\pxcz@declare@deprecated#1{%
  \expandafter\let\csname pxcz@depre@preset@#1\endcsname=t}

%% \pxcz@uniweight{<font-mn>}{<font-gt>}
\@onlypreamble\pxcz@uniweight
\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>}
\@onlypreamble\pxcz@multiweight
\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>}
\def\pxcz@use@preset#1{%
  \expandafter\ifx\csname pxcz@depre@preset@#1\endcsname t%
    \pxcz@error{The old preset '#1' is *abolished*}
      {\@ehc}%
  \fi
  \csname pxcz@the@preset@#1\endcsname}

%% definitions of main preset mappings
\pxcz@declare@preset{noembed}{%
  \usecmapforalphabet
  \pxcz@uniweight{Ryumin-Light}{GothicBBB-Medium}}
%(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@enable@switch@realfont
  \pxcz@multiweight{\pxcz@MI03:mogam.ttc}{\pxcz@MI03:mogam.ttc}%
  {\pxcz@MI03:mogamb.ttc}{\pxcz@MI02:mogag.ttc}{\pxcz@MI02:mogagb.ttc}%
  {\pxcz@MI02:mogagb.ttc}{\pxcz@MI02:mogag.ttc}{\pxcz@MI02:mobog.ttc}}
\pxcz@declare@preset{moga-mobo-ex}{%
  \pxcz@enable@switch@realfont
  \pxcz@multiweight{\pxcz@MI14:mogam.ttc}{\pxcz@MI14:mogam.ttc}%
  {\pxcz@MI14:mogamb.ttc}{\pxcz@MI13:mogag.ttc}{\pxcz@MI13:mogagb.ttc}%
  {\pxcz@MI13:mogagb.ttc}{\pxcz@MI13:mogag.ttc}{\pxcz@MI13:mobog.ttc}}
\pxcz@declare@preset{moga-maruberi}{%
  \pxcz@enable@switch@realfont
  \pxcz@multiweight{\pxcz@MI03:mogam.ttc}{\pxcz@MI03:mogam.ttc}%
  {\pxcz@MI03:mogamb.ttc}{\pxcz@MI02:mogag.ttc}{\pxcz@MI02:mogagb.ttc}%
  {\pxcz@MI02:mogagb.ttc}{\pxcz@MI02:mogag.ttc}{MTLmr3m.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-OTFJun101Pro-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-OTFJun101Pr6N-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-win10+}{%
  \pxcz@multiweight{\pxcz@YW/yuminl.ttf}{\pxcz@YW/yumin.ttf}%
   {\pxcz@YW/yumindb.ttf}{\pxcz@YW:0:YuGothR.ttc}{\pxcz@YW:0:YuGothB.ttc}%
   {\pxcz@YW:0:YuGothB.ttc}{\pxcz@YW:0:YuGothM.ttc}{\pxcz@YW: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{\pxcz@SH:0:SourceHanSerif-Light.ttc}%
   {\pxcz@SH:0:SourceHanSerif-Regular.ttc}%
   {\pxcz@SH:0:SourceHanSerif-Bold.ttc}%
   {\pxcz@SH:0:SourceHanSans-Regular.ttc}%
   {\pxcz@SH:0:SourceHanSans-Bold.ttc}%
   {\pxcz@SH:0:SourceHanSans-Heavy.ttc}%
   {\pxcz@SH:0:SourceHanSans-Medium.ttc}%
   {\pxcz@SH:0:SourceHanSans-Heavy.ttc}}
% Source Han Sans/Serif, "Language-specific OTF"
\pxcz@declare@preset{sourcehan}{%
  \pxcz@multiweight{\pxcz@SH/SourceHanSerif-Light.otf}%
  {\pxcz@SH/SourceHanSerif-Regular.otf}%
   {\pxcz@SH/SourceHanSerif-Bold.otf}%
   {\pxcz@SH/SourceHanSans-Regular.otf}%
   {\pxcz@SH/SourceHanSans-Bold.otf}%
   {\pxcz@SH/SourceHanSans-Heavy.otf}%
   {\pxcz@SH/SourceHanSans-Medium.otf}%
   {\pxcz@SH/SourceHanSans-Heavy.otf}}
% Noto Sans/Serif CJK, "OpenType/CFF Collection (OTC)"
\pxcz@declare@preset{noto-otc}{%
  \pxcz@multiweight{\pxcz@NC:0:NotoSerifCJK-Light.ttc}%
   {\pxcz@NC:0:NotoSerifCJK-Regular.ttc}%
   {\pxcz@NC:0:NotoSerifCJK-Bold.ttc}%
   {\pxcz@NC:0:NotoSansCJK-Regular.ttc}%
   {\pxcz@NC:0:NotoSansCJK-Bold.ttc}%
   {\pxcz@NC:0:NotoSansCJK-Black.ttc}%
   {\pxcz@NC:0:NotoSansCJK-Medium.ttc}%
   {\pxcz@NC:0:NotoSansCJK-Black.ttc}}
% Noto Sans/Serif CJK, "Language-specific OpenType/CFF (OTF)"
\pxcz@declare@preset{noto}{%
  \pxcz@multiweight{\pxcz@NC/NotoSerifCJKjp-Light.otf}%
   {\pxcz@NC/NotoSerifCJKjp-Regular.otf}%
   {\pxcz@NC/NotoSerifCJKjp-Bold.otf}%
   {\pxcz@NC/NotoSansCJKjp-Regular.otf}%
   {\pxcz@NC/NotoSansCJKjp-Bold.otf}%
   {\pxcz@NC/NotoSansCJKjp-Black.otf}%
   {\pxcz@NC/NotoSansCJKjp-Medium.otf}%
   {\pxcz@NC/NotoSansCJKjp-Black.otf}}
%(obsolete)
\pxcz@declare@depre@preset{ipa-otf}{%
  \pxcz@uniweight{ipam.otf}{ipag.otf}}
\pxcz@declare@depre@preset{ipa-otf-dx}{%
  \pxcz@multiweight{ipam.otf}{:0:hgrme.ttc}%
  {:0:hgrgm.ttc}{:0:hgrge.ttc}{:0:hgrsgu.ttc}{hgrsmp.ttf}}
\pxcz@declare@depre@preset{kozuka4}{%
  \usecmapforalphabet
  \pxcz@uniweight{KozMinPro-Regular-Acro.otf}{KozGoPro-Medium-Acro.otf}}
\pxcz@declare@depre@preset{kozuka6}{%
  \usecmapforalphabet
  \pxcz@uniweight{KozMinProVI-Regular.otf}{KozGoProVI-Medium.otf}}
\pxcz@declare@depre@preset{kozuka6n}{%
  \usecmapforalphabet
  \pxcz@uniweight{KozMinPr6N-Regular.otf}{KozGoPr6N-Medium.otf}}
\pxcz@declare@depre@preset{hiragino}{%
  \usecmapforalphabet
  \pxcz@uniweight{HiraMinPro-W3.otf}{HiraKakuPro-W6.otf}}
%(alias)
\pxcz@declare@depre@preset@alias{ms-dx}{ms-hg}
\pxcz@declare@depre@preset@alias{ipa-ttf}{ipa}
\pxcz@declare@depre@preset@alias{ipa-ttf-dx}{ipa-hg}
\pxcz@declare@depre@preset@alias{ipav2}{ipa}
\pxcz@declare@depre@preset@alias{ipav2-dx}{ipa-hg}
\pxcz@declare@depre@preset@alias{ipa-dx}{ipa-hg}
\pxcz@declare@depre@preset@alias{hiragino-dx}{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}

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

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