<reponame>naginata5101/setting
%
% pxchfon.sty
%

%%%% package declaration
\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{pxchfon}[2013/06/16 v0.7d]
\def\pxcz@pkgname{pxchfon}

%%%% definitions
\def\pxcz@error{\PackageError\pxcz@pkgname}
\def\pxcz@warn{\PackageInfo\pxcz@pkgname}
\newif\ifpxcz@ok
\newif\ifpxcz@utf

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

%%%% check for upTeX
\newif\ifpxcz@uptex \pxcz@uptexfalse
\edef\pxcz@tmpa{\string\ucs}\edef\pxcz@tmpb{\meaning\ucs}
\ifx\pxcz@tmpa\pxcz@tmpb \pxcz@uptextrue \fi

%%%% process options
\let\pxcz@alphabet=n
\DeclareOption{alphabet}{\let\pxcz@alphabet=t}
\DeclareOption{noalphabet}{\let\pxcz@alphabet=f}
\DeclareOption{relfont}{\let\pxcz@alphabet=r}
\newif\ifpxcz@otf \pxcz@otftrue
\DeclareOption{otf}{\pxcz@otftrue}
\DeclareOption{nootf}{\pxcz@otffalse}
\DeclareOption{utf}{\pxcz@otftrue}
\DeclareOption{noutf}{\pxcz@otffalse}
\newif\ifpxcz@cmap@alpha
\DeclareOption{usecmapforalphabet}{\pxcz@cmap@alphatrue}
\DeclareOption{nousecmapforalphabet}{\pxcz@cmap@alphafalse}
\newif\ifpxcz@mmivjis
\DeclareOption{prefer2004jis}{\pxcz@mmivjistrue}
\DeclareOption{noprefer2004jis}{\pxcz@mmivjisfalse}
\newif\ifpxcz@everypage
\DeclareOption{everypage}{\pxcz@everypagetrue}
\DeclareOption{noeverypage}{\pxcz@everypagefalse}
\newif\ifpxcz@oneweight
\DeclareOption{oneweight}{\pxcz@oneweighttrue}
\DeclareOption{nooneweight}{\pxcz@oneweightfalse}
\newif\ifpxcz@directunicode
\DeclareOption{directunicode}{\pxcz@directunicodetrue}
\DeclareOption{nodirectunicode}{\pxcz@directunicodefalse}
% preset spec options
\def\pxcz@all@main@preset{%
  noembed,%
  %(uniweight)
  ms,ipa,ipaex,%
  %(multiweight)
  ms-hg,ipa-hg,moga-mobo,moga-maruberi,%
  kozuka-pro,kozuka-pr6,kozuka-pr6n,%
  hiragino-pro,hiragino-pron,morisawa-pro,morisawa-pr6n,%
  %(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}
\let\pxcz@main@preset\relax
\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}}
% dispatch
\ProcessOptions*
% 'everypage' needs 'atbegshi' package
\ifpxcz@everypage
\RequirePackage{atbegshi}
\fi

%% \ifpxcz@alpha
\newif\ifpxcz@alpha
\if      t\pxcz@alphabet \pxcz@alphatrue
\else\if f\pxcz@alphabet \pxcz@alphafalse
\else\if r\pxcz@alphabet \pxcz@alphafalse
\else\if\pxcz@main@preset\relax \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

%% \ifpxcz@rel
\newif\ifpxcz@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

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

%%------------------ 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}}
\def\pxcz@setfont#1{\@ifnextchar[%]
  {\pxcz@setfont@a{#1}}{\pxcz@setfont@a{#1}[]}}
\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 pxasutf package.
\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}{HYSMyeongJoStd-Medium}
\pxcz@do{kog}{HYGoThic-Medium}
\pxcz@do{scm}{STSongStd-Light}
\pxcz@do{scg}{STHeiti-Regular}
\pxcz@do{tcm}{MSungStd-Light}
\pxcz@do{tcg}{MHei-Medium}

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

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

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

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

%%<*> \setnewglyphcmapprefix{<str>}
\def\pxcz@pfx@jis@dflt{2004-}
\def\pxcz@pfx@jis@star{JISX0213-2004-}
\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
\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{\ifpxcz@mmivjis:0:\else:3:\fi}

%% \pxcz@unidirect
\let\pxcz@unidirect\@empty
\let\pxcz@unidirect@wopt\@empty
\ifpxcz@directunicode
\def\pxcz@unidirect#116-#2{\pxcz@cmap@directuni}
\def\pxcz@unidirect@wopt{ -w 1}
\fi

%% \pxcz@addtospec{<id>}
\def\pxcz@addtospec#1{%
  \bgroup \let\Entry\pxcz@Entry
    \let\ \space \let\*\pxcz@pfx@jis 
    \let\UniJIS\pxcz@pfx@unijis
    \@nameuse{pxcz@ME/#1}\egroup}
\def\pxcz@Entry#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
    \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
    \pxcz@switch@realfont
  \fi\fi
  \ifx\FONT\@empty \expandafter\@gobble
  \else \expandafter\pxcz@entry@a \fi}
\def\pxcz@entry@a#1{%
  \xdef\pxcz@spec{\pxcz@spec\noexpand\special{\pxcz@line{#1}}}}
\let\pxcz@spec\@empty
\def\pxcz@line#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
\pxcz@mapentry{STD}{%
\Entry{mnr}{rml        \*H            \FONTs}%
\Entry{mnr}{rmlv       \*V            \FONTs}%
\Entry{gtu}{gbm        \*H            \FONTs}%
\Entry{gtu}{gbmv       \*V            \FONTs}%
}
\pxcz@mapentry{ALPHA}{%
\Entry{mnl}{r-cfjar-l-@PXcjk0@ \UniCMap\ \FONT}%
\Entry{mnr}{r-cfjar-r-@PXcjk0@ \UniCMap\ \FONT}%
\Entry{mnb}{r-cfjar-b-@PXcjk0@ \UniCMap\ \FONT}%
\Entry{gtr}{r-cfjas-r-@PXcjk0@ \UniCMap\ \FONT}%
\Entry{gtb}{r-cfjas-b-@PXcjk0@ \UniCMap\ \FONT}%
\Entry{gtx}{r-cfjas-x-@PXcjk0@ \UniCMap\ \FONT}%
\Entry{mgr}{r-cfjas-r-@PXcjk0@ \UniCMap\ \FONT}%
}
\pxcz@mapentry{UTF}{%
\Entry{mnr}{unijmin-h  \UniJIS-UTF16-H \FONTs}%
\Entry{mnr}{unijmin-v  \UniJIS-UTF16-V \FONTs}%
\Entry{mnr}{cidmin-h   Identity-H     \FONT/AJ16}%
\Entry{mnr}{cidmin-v   Identity-V     \FONT/AJ16}%
\Entry{mnr}{hmr        \*H            \FONTs}%
\Entry{mnr}{hmrv       \*V            \FONTs}%
\Entry{gtu}{unijgoth-h \UniJIS-UTF16-H \FONTs}%
\Entry{gtu}{unijgoth-v \UniJIS-UTF16-V \FONTs}%
\Entry{gtu}{cidgoth-h  Identity-H     \FONT/AJ16}%
\Entry{gtu}{cidgoth-v  Identity-V     \FONT/AJ16}%
\Entry{gtu}{hkb        \*H            \FONTs}%
\Entry{gtu}{hkbv       \*V            \FONTs}%
}
\pxcz@mapentry{OTF}{%
\Entry{mnl}{otf-ujml-h \+UniJIS-UTF16-H \FONTo}%
\Entry{mnl}{otf-ujml-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{mnl}{otf-cjml-h Identity-H     \FONT/AJ16}%
\Entry{mnl}{otf-cjml-v Identity-V     \FONT/AJ16}%
\Entry{mnl}{hminl-h    H              \FONTo}%
\Entry{mnl}{hminl-v    V              \FONTo}%
\Entry{mnl}{otf-ujmln-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{mnl}{otf-ujmln-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{mnl}{hminln-h   H              \FONT}%
\Entry{mnl}{hminln-v   V              \FONT}%
\Entry{mnr}{otf-ujmr-h \+UniJIS-UTF16-H \FONTo}%
\Entry{mnr}{otf-ujmr-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{mnr}{otf-cjmr-h Identity-H     \FONT/AJ16}%
\Entry{mnr}{otf-cjmr-v Identity-V     \FONT/AJ16}%
\Entry{mnr}{hminr-h    H              \FONTo}%
\Entry{mnr}{hminr-v    V              \FONTo}%
\Entry{mnr}{otf-ujmrn-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{mnr}{otf-ujmrn-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{mnr}{hminrn-h   H              \FONT}%
\Entry{mnr}{hminrn-v   V              \FONT}%
\Entry{mnb}{otf-ujmb-h \+UniJIS-UTF16-H \FONTo}%
\Entry{mnb}{otf-ujmb-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{mnb}{otf-cjmb-h Identity-H     \FONT/AJ16}%
\Entry{mnb}{otf-cjmb-v Identity-V     \FONT/AJ16}%
\Entry{mnb}{hminb-h    H              \FONTo}%
\Entry{mnb}{hminb-v    V              \FONTo}%
\Entry{mnb}{otf-ujmbn-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{mnb}{otf-ujmbn-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{mnb}{hminbn-h   H              \FONT}%
\Entry{mnb}{hminbn-v   V              \FONT}%
\Entry{gtr}{otf-ujgr-h \+UniJIS-UTF16-H \FONTo}%
\Entry{gtr}{otf-ujgr-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{gtr}{otf-cjgr-h Identity-H     \FONT/AJ16}%
\Entry{gtr}{otf-cjgr-v Identity-V     \FONT/AJ16}%
\Entry{gtr}{hgothr-h   H              \FONTo}%
\Entry{gtr}{hgothr-v   V              \FONTo}%
\Entry{gtr}{otf-ujgrn-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{gtr}{otf-ujgrn-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{gtr}{hgothrn-h  H              \FONT}%
\Entry{gtr}{hgothrn-v  V              \FONT}%
\Entry{gtb}{otf-ujgb-h \+UniJIS-UTF16-H \FONTo}%
\Entry{gtb}{otf-ujgb-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{gtb}{otf-cjgb-h Identity-H     \FONT/AJ16}%
\Entry{gtb}{otf-cjgb-v Identity-V     \FONT/AJ16}%
\Entry{gtb}{hgothb-h   H              \FONTo}%
\Entry{gtb}{hgothb-v   V              \FONTo}%
\Entry{gtb}{otf-ujgbn-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{gtb}{otf-ujgbn-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{gtb}{hgothbn-h  H              \FONT}%
\Entry{gtb}{hgothbn-v  V              \FONT}%
\Entry{gtx}{otf-ujge-h \+UniJIS-UTF16-H \FONTo}%
\Entry{gtx}{otf-ujge-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{gtx}{otf-cjge-h Identity-H     \FONT/AJ16}%
\Entry{gtx}{otf-cjge-v Identity-V     \FONT/AJ16}%
\Entry{gtx}{hgotheb-h  H              \FONTo}%
\Entry{gtx}{hgotheb-v  V              \FONTo}%
\Entry{gtx}{otf-ujgen-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{gtx}{otf-ujgen-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{gtx}{hgothebn-h H              \FONT}%
\Entry{gtx}{hgothebn-v V              \FONT}%
\Entry{mgr}{otf-ujmgr-h \+UniJIS-UTF16-H \FONTo}%
\Entry{mgr}{otf-ujmgr-v \+UniJIS-UTF16-V \FONTo\w}%
\Entry{mgr}{otf-cjmgr-h Identity-H     \FONT/AJ16}%
\Entry{mgr}{otf-cjmgr-v Identity-V     \FONT/AJ16}%
\Entry{mgr}{hmgothr-h   H              \FONTo}%
\Entry{mgr}{hmgothr-v   V              \FONTo}%
\Entry{mgr}{otf-ujmgrn-h \+UniJIS2004-UTF16-H \FONT}%
\Entry{mgr}{otf-ujmgrn-v \+UniJIS2004-UTF16-V \FONT\w}%
\Entry{mgr}{hmgothrn-h  H              \FONT}%
\Entry{mgr}{hmgothrn-v  V              \FONT}%
%
\Entry{kom}{otf-ukmr-h \+UniKS-UTF16-H   \FONT}%
\Entry{kom}{otf-ukmr-v \+UniKS-UTF16-V   \FONT\w}%
\Entry{kom}{otf-ckmr-h Identity-H        \FONT/AK12}%
\Entry{kom}{otf-ckmr-v Identity-V        \FONT/AK12}%
\Entry{kog}{otf-ukgr-h \+UniKS-UTF16-H   \FONT}%
\Entry{kog}{otf-ukgr-v \+UniKS-UTF16-V   \FONT\w}%
\Entry{kog}{otf-ckgr-h Identity-H        \FONT/AK12}%
\Entry{kog}{otf-ckgr-v Identity-V        \FONT/AK12}%
\Entry{scm}{otf-ucmr-h \+UniGB-UTF16-H   \FONT}%
\Entry{scm}{otf-ucmr-v \+UniGB-UTF16-V   \FONT\w}%
\Entry{scm}{otf-ccmr-h Identity-H        \FONT/AG14}%
\Entry{scm}{otf-ccmr-v Identity-V        \FONT/AG14}%
\Entry{scg}{otf-ucgr-h \+UniGB-UTF16-H   \FONT}%
\Entry{scg}{otf-ucgr-v \+UniGB-UTF16-V   \FONT\w}%
\Entry{scg}{otf-ccgr-h Identity-H        \FONT/AG14}%
\Entry{scg}{otf-ccgr-v Identity-V        \FONT/AG14}%
\Entry{tcm}{otf-utmr-h \+UniCNS-UTF16-H  \FONT}%
\Entry{tcm}{otf-utmr-v \+UniCNS-UTF16-V  \FONT\w}%
\Entry{tcm}{otf-ctmr-h Identity-H        \FONT/AC14}%
\Entry{tcm}{otf-ctmr-v Identity-V        \FONT/AC14}%
\Entry{tcg}{otf-utgr-h \+UniCNS-UTF16-H  \FONT}%
\Entry{tcg}{otf-utgr-v \+UniCNS-UTF16-V  \FONT\w}%
\Entry{tcg}{otf-ctgr-h Identity-H        \FONT/AC14}%
\Entry{tcg}{otf-ctgr-v Identity-V        \FONT/AC14}%
}
\pxcz@mapentry{UPSTD}{%
\Entry{mnr}{uprml-h    \UniJIS-UTF16-H \FONTs}%
\Entry{mnr}{uprml-v    \UniJIS-UTF16-V \FONTs}%
\Entry{mnr}{uprml-hq   UniJIS-UCS2-H   \FONT}%
\Entry{gtu}{upgbm-h    \UniJIS-UTF16-H \FONTs}%
\Entry{gtu}{upgbm-v    \UniJIS-UTF16-V \FONTs}%
\Entry{gtu}{upgbm-hq   UniJIS-UCS2-H   \FONT}%
\Entry{mnr}{urml       \UniJIS-UTF16-H \FONTs}%
\Entry{mnr}{urmlv      \UniJIS-UTF16-V \FONTs}%
\Entry{gtu}{ugbm       \UniJIS-UTF16-H \FONTs}%
\Entry{gtu}{ugbmv      \UniJIS-UTF16-V \FONTs}%
%
\Entry{kom}{uphysmjm-h UniKS-UTF16-H  \FONT}%
\Entry{kom}{uphysmjm-v UniKS-UTF16-V  \FONT}%
\Entry{kog}{uphygt-h   UniKS-UTF16-H  \FONT}%
\Entry{kog}{uphygt-v   UniKS-UTF16-V  \FONT}%
\Entry{scm}{upstsl-h   UniGB-UTF16-H  \FONT}%
\Entry{scm}{upstsl-v   UniGB-UTF16-V  \FONT}%
\Entry{scg}{upstht-h   UniGB-UTF16-H  \FONT}%
\Entry{scg}{upstht-v   UniGB-UTF16-V  \FONT}%
\Entry{tcm}{upmsl-h    UniCNS-UTF16-H \FONT}%
\Entry{tcm}{upmsl-v    UniCNS-UTF16-V \FONT}%
\Entry{tcg}{upmhm-h    UniCNS-UTF16-H \FONT}%
\Entry{tcg}{upmhm-v    UniCNS-UTF16-V \FONT}%
}
\pxcz@mapentry{UPOTF}{%
\Entry{mnl}{uphminl-h   \UniJIS-UTF16-H \FONTs}%
\Entry{mnl}{uphminl-v   \UniJIS-UTF16-V \FONTs}%
\Entry{mnr}{uphminr-h   \UniJIS-UTF16-H \FONTs}%
\Entry{mnr}{uphminr-v   \UniJIS-UTF16-V \FONTs}%
\Entry{mnb}{uphminb-h   \UniJIS-UTF16-H \FONTs}%
\Entry{mnb}{uphminb-v   \UniJIS-UTF16-V \FONTs}%
\Entry{gtr}{uphgothr-h  \UniJIS-UTF16-H \FONTs}%
\Entry{gtr}{uphgothr-v  \UniJIS-UTF16-V \FONTs}%
\Entry{gtb}{uphgothb-h  \UniJIS-UTF16-H \FONTs}%
\Entry{gtb}{uphgothb-v  \UniJIS-UTF16-V \FONTs}%
\Entry{gtx}{uphgotheb-h \UniJIS-UTF16-H \FONTs}%
\Entry{gtx}{uphgotheb-v \UniJIS-UTF16-V \FONTs}%
\Entry{mgr}{uphmgothr-h \UniJIS-UTF16-H \FONTs}%
\Entry{mgr}{uphmgothr-v \UniJIS-UTF16-V \FONTs}%
}
% for 'PXOTF'
\@onlypreamble\pxcz@entry@pxotf
\def\pxcz@entry@pxotf#1#2{%
\Entry{#1}{r-#2-jy1 H                   \FONT}%
\Entry{#1}{r-#2-j00 78-H                \FONT}%
\Entry{#1}{r-#2-jt1 V                   \FONT}%
\Entry{#1}{r-#2-j10 78-V                \FONT}%
\Entry{#1}{r-#2-jy2 \UniJIS-UTF16-H     \FONT}%
\Entry{#1}{r-#2-j20 UniJIS-UTF16-H      \FONT}%
\Entry{#1}{r-#2-j24 UniJIS2004-UTF16-H  \FONT}%
\Entry{#1}{r-#2-jt2 \UniJIS-UTF16-V     \FONT}%
\Entry{#1}{r-#2-j30 UniJIS-UTF16-V      \FONT}%
\Entry{#1}{r-#2-j34 UniJIS2004-UTF16-V  \FONT}%
\Entry{#1}{r-#2-j40 Identity-H          \FONT/AJ16}%
\Entry{#1}{r-#2-j50 Identity-V          \FONT/AJ16}%
}
\pxcz@mapentry{PXOTF}{%
\pxcz@entry@pxotf{mnl}{njar-l}%
\pxcz@entry@pxotf{mnr}{njar-r}%
\pxcz@entry@pxotf{mnb}{njar-b}%
\pxcz@entry@pxotf{gtr}{njas-r}%
\pxcz@entry@pxotf{gtb}{njas-b}%
\pxcz@entry@pxotf{gtx}{njas-x}%
\pxcz@entry@pxotf{mgr}{mgjas-r}%
}

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

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

%%%% \AtBeginDocument
\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
  \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
    \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}%
  \pxcz@set@page@hook{\pxcz@spec}%
}

%% \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@warn{Relation font set for \k@encoding/#1}%
}

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

%% \pxcz@declare@preset{<name>}{<text>}
\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>}
\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@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{%
  \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{moga-mobo}{%
  \pxcz@enable@switch@realfont
  \pxcz@multiweight{\pxcz@MI mogam.ttc}{\pxcz@MI mogam.ttc}%
  {\pxcz@MI mogamb.ttc}{\pxcz@MI mogag.ttc}{\pxcz@MI mogagb.ttc}%
  {\pxcz@MI mogagb.ttc}{\pxcz@MI mogag.ttc}{\pxcz@MI mobog.ttc}}
\pxcz@declare@preset{moga-maruberi}{%
  \pxcz@enable@switch@realfont
  \pxcz@multiweight{\pxcz@MI mogam.ttc}{\pxcz@MI mogam.ttc}%
  {\pxcz@MI mogamb.ttc}{\pxcz@MI mogag.ttc}{\pxcz@MI mogagb.ttc}%
  {\pxcz@MI mogagb.ttc}{\pxcz@MI 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{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}}
%(obsolete)
\pxcz@declare@preset{ipa-otf}{%
  \pxcz@uniweight{ipam.otf}{ipag.otf}}
\pxcz@declare@preset{ipa-otf-dx}{%
  \pxcz@multiweight{ipam.otf}{:0:hgrme.ttc}%
  {:0:hgrgm.ttc}{:0:hgrge.ttc}{:0:hgrsgu.ttc}{hgrsmp.ttf}}
\pxcz@declare@preset{kozuka4}{%
  \usecmapforalphabet
  \pxcz@uniweight{KozMinPro-Regular-Acro.otf}{KozGoPro-Medium-Acro.otf}}
\pxcz@declare@preset{kozuka6}{%
  \usecmapforalphabet
  \pxcz@uniweight{KozMinProVI-Regular.otf}{KozGoProVI-Medium.otf}}
\pxcz@declare@preset{kozuka6n}{%
  \usecmapforalphabet
  \pxcz@uniweight{KozMinPr6N-Regular.otf}{KozGoPr6N-Medium.otf}}
\pxcz@declare@preset{hiragino}{%
  \usecmapforalphabet
  \pxcz@uniweight{HiraMinPro-W3.otf}{HiraKakuPro-W6.otf}}
%(alias)
\pxcz@declare@preset@alias{ms-dx}{ms-hg}
\pxcz@declare@preset@alias{ipa-ttf}{ipa}
\pxcz@declare@preset@alias{ipa-ttf-dx}{ipa-hg}
\pxcz@declare@preset@alias{ipav2}{ipa}
\pxcz@declare@preset@alias{ipav2-dx}{ipa-hg}
\pxcz@declare@preset@alias{ipa-dx}{ipa-hg}
\pxcz@declare@preset@alias{hiragino-dx}{hiragino-pro}

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

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