diff options
Diffstat (limited to 'Master/texmf-dist/tex/platex')
6 files changed, 914 insertions, 456 deletions
diff --git a/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty b/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty index 310af67b713..eef9fbc3471 100644 --- a/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty +++ b/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty @@ -1,7 +1,7 @@ %% %% This is file 'pxchfon.sty'. %% -%% Copyright (c) 2009-2023 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2009-2024 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxchfon}[2023/08/28 v2.0] +\ProvidesPackage{pxchfon}[2024/08/22 v2.2] \def\pxcz@pkgname{pxchfon} %--------------------------------------- general @@ -28,7 +28,11 @@ %% 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} @@ -47,6 +51,19 @@ \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 @@ -59,13 +76,22 @@ \def\pxcz@lower@a#1\pxcz@end#2{% \lowercase{\def#2{#1}}} -%% \pxcz@setkeys{<text>}{<error>} -\pxcz@onlypreamble@def\pxcz@setkeys#1#2{% - \def\KV@errx##1{#2}% - \edef\pxcz@do{\noexpand\setkeys{pxchfon}{#1}}\pxcz@do +%% \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{% @@ -74,10 +100,11 @@ \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@csletcs{pxcz@value}{pxcz@#3#1#4}% + \pxcz@letcs\pxcz@value{pxcz@#3#1#4}% \ifx\pxcz@value\relax \PackageError\pxcz@pkgname - {Invalid value for option key '#2'\MessageBreak (#4)}% + {Invalid value for key '#2'\MessageBreak (#4)}% + {\@ehc}% \expandafter\@gobble \else \expandafter\@firstofone \fi} @@ -97,8 +124,46 @@ \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 @@ -115,6 +180,18 @@ \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{% @@ -128,13 +205,11 @@ \pxcz@lite@modetrue} %% \ifpxcz@otf@loaded -%% \ifpxcz@otf@deluxe %% \pxcz@otf@weight: otf weight mode \newif\ifpxcz@otf@loaded \pxcz@otf@loadedtrue -\newif\ifpxcz@otf@deluxe \pxcz@otf@deluxefalse % watch out for priority... \@ifpackagewith{otf}{deluxe}{% - \pxcz@otf@deluxetrue \let\pxcz@otf@weight=d + \let\pxcz@otf@weight=d }{\@ifpackagewith{otf}{bold}{% \let\pxcz@otf@weight=b }{\@ifpackagewith{otf}{expert}{% @@ -253,7 +328,7 @@ \let\pxcz@alphabet\relax \newif\ifpxcz@otf \pxcz@otftrue \newif\ifpxcz@cmap@alpha -\newif\ifpxcz@mmivjis +\pxcz@new@gbool{pxcz@mmivjis} \newif\ifpxcz@everypage \newif\ifpxcz@oneweight \newif\ifpxcz@fullwidth @@ -274,9 +349,14 @@ \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} @@ -353,7 +433,9 @@ \DeclareOption{autojfmsync}{\pxcz@autojfmsynctrue} \DeclareOption{noautojfmsync}{\pxcz@autojfmsyncfalse} % maybe-multiweight -\DeclareOption{maybe-multiweight}{\let\pxchfonMaybeMultiweight=t} +\DeclareOption{maybe-multiweight}{\let\pxchfonNoCheckMultiweight=t} +% nocheck-expert +\DeclareOption{nocheck-expert}{\let\pxchfonNoCheckExpert=t} % use=<spec> \define@key{pxchfon}{use}{% \pxcz@okfalse @@ -427,7 +509,7 @@ \DeclareOption*{% \pxcz@parse@opt\CurrentOption \ifpxcz@ok\else - \pxcz@setkeys{\CurrentOption}{\@unknownoptionerror}% + \pxcz@setkeys{pxchfon}{\CurrentOption}\pxcz@invalid@opt \fi} %% \pxcz@use@list @@ -475,7 +557,7 @@ \ifpxcz@unicode@given\else \let\pxcz@unicode\pxcz@unicode@@false \ifnum\pxcz@pxufont@loaded>0 - \PackageWarningNoLine\pxcz@pkgname + \pxcz@PackageNoteNoLine\pxcz@pkgname {Option 'unicode' is enabled, since the package\MessageBreak 'pxufont' is already loaded} \let\pxcz@unicode\pxcz@unicode@@full @@ -486,7 +568,13 @@ %% apply default value for \pxcz@alphabet \if\pxcz@alphabet\relax \ifx\pxcz@main@preset\relax \ifx\pxcz@file@preset\relax - % TODO: warn + \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 @@ -530,32 +618,14 @@ \let\pxcz@switch@font@xjistrue\pxcz@switch@font@xjisfalse \fi -\begingroup \lccode`\@=`\_ \lowercase{% - \xdef\pxcz@get@dvipdfmx@version{% - \let\noexpand\pxcz@dvipdfmx@version\expandafter\noexpand - \csname c@@Kernel@sys@dvipdfmx@version@int\endcsname}} -\endgroup -\AtBeginDocument{% - \@tempswatrue - \ifnum\pxcz@unicode<\pxcz@unicode@@full\else - \pxcz@get@dvipdfmx@version - \ifx\pxcz@dvipdfmx@version\@undefined\else - \ifnum\pxcz@dvipdfmx@version<20170918 - \@tempswafalse \fi\fi - \fi - \if@tempswa\else - \PackageError\pxcz@pkgname - {Option 'unicode' is not available, since\MessageBreak - your dvipdfmx is too old (v.\number\pxcz@dvipdfmx@version)} - {The option requires dvipdfmx version 20170918 or later.% - \MessageBreak\@ehc} - \fi} - %--------------------------------------- preset-dependent setup -%% variables -\newif\ifpxcz@warn@unless@all@defined -\newif\ifpxcz@warn@unless@all@embedded +%% \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). @@ -566,7 +636,7 @@ \fi} %% \pxcz@warn@unicode \pxcz@onlypreamble@def\pxcz@warn@unicode{% - \PackageWarningNoLine\pxcz@pkgname + \pxcz@PackageNoteNoLine\pxcz@pkgname {The option 'unicode' is enforced, because the\MessageBreak preset '\pxcz@main@preset' is selected.}} @@ -586,7 +656,8 @@ \pxcz@custom@apply@opt@unicode % No-embed is not supported under the 'unicode' setup \ifnum\pxcz@unicode=\pxcz@unicode@@full - \pxcz@warn@unless@all@embeddedtrue + \g@addto@macro\pxcz@warn@unless@all@embedded@for{% + \do{Direct Unicode spec ('unicode')}} \fi %% apply default for pxcz@legacycode@replace @@ -661,9 +732,36 @@ \fi \let\pxcz@expert=f \fi -\if t\pxcz@expert - \pxcz@warn@unless@all@definedtrue -\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 @@ -678,53 +776,60 @@ tcml,tcmr,tcmb,tcgr,tcgb,tcgx,tcgu,tcmgr} %%<*> \setminchofont/\setgothicfont/etc. -\newcommand*\setminchofont{\pxcz@setfont{mnl,mnr,mnb}} -\newcommand*\setgothicfont{\pxcz@setfont{gtr,gtb,gtx,gtu}} -\newcommand*\setlightminchofont{\pxcz@setfont@dx{mnl}} -\newcommand*\setmediumminchofont{\pxcz@setfont@dx{mnr}} -\newcommand*\setboldminchofont{\pxcz@setfont@dx{mnb}} -\newcommand*\setmediumgothicfont{\pxcz@setfont@dx{gtr}} -\newcommand*\setboldgothicfont{\pxcz@setfont@dx{gtb}} -\newcommand*\setxboldgothicfont{\pxcz@setfont@dx{gtx}} -\newcommand*\setoneweightgothicfont{\pxcz@setfont@dx{gtu}} -\newcommand*\setmarugothicfont{\pxcz@setfont@dx{mgr}} - -\newcommand*\setkoreanminchofont{\pxcz@setfont{koml,komr,komb}} -\newcommand*\setkoreangothicfont{\pxcz@setfont{kogr,kogb,kogx,kogu,komgr}} -\newcommand*\setkoreanlightminchofont{\pxcz@setfont@dx{koml}} -\newcommand*\setkoreanmediumminchofont{\pxcz@setfont@dx{komr}} -\newcommand*\setkoreanboldminchofont{\pxcz@setfont@dx{komb}} -\newcommand*\setkoreanmediumgothicfont{\pxcz@setfont@dx{kogr}} -\newcommand*\setkoreanboldgothicfont{\pxcz@setfont@dx{kogb}} -\newcommand*\setkoreanxboldgothicfont{\pxcz@setfont@dx{kogx}} -\newcommand*\setkoreanoneweightgothicfont{\pxcz@setfont@dx{kogu}} -\newcommand*\setkoreanmarugothicfont{\pxcz@setfont@dx{komgr}} - -\newcommand*\setschineseminchofont{\pxcz@setfont{scml,scmr,scmb}} -\newcommand*\setschinesegothicfont{\pxcz@setfont{scgr,scgb,scgx,scgu,scmgr}} -\newcommand*\setschineselightminchofont{\pxcz@setfont@dx{scml}} -\newcommand*\setschinesemediumminchofont{\pxcz@setfont@dx{scmr}} -\newcommand*\setschineseboldminchofont{\pxcz@setfont@dx{scmb}} -\newcommand*\setschinesemediumgothicfont{\pxcz@setfont@dx{scgr}} -\newcommand*\setschineseboldgothicfont{\pxcz@setfont@dx{scgb}} -\newcommand*\setschinesexboldgothicfont{\pxcz@setfont@dx{scgx}} -\newcommand*\setschineseoneweightgothicfont{\pxcz@setfont@dx{scgu}} -\newcommand*\setschinesemarugothicfont{\pxcz@setfont@dx{scmgr}} - -\newcommand*\settchineseminchofont{\pxcz@setfont{tcml,tcmr,tcmb}} -\newcommand*\settchinesegothicfont{\pxcz@setfont{tcgr,tcgb,tcgx,tcgu,tcmgr}} -\newcommand*\settchineselightminchofont{\pxcz@setfont@dx{tcml}} -\newcommand*\settchinesemediumminchofont{\pxcz@setfont@dx{tcmr}} -\newcommand*\settchineseboldminchofont{\pxcz@setfont@dx{tcmb}} -\newcommand*\settchinesemediumgothicfont{\pxcz@setfont@dx{tcgr}} -\newcommand*\settchineseboldgothicfont{\pxcz@setfont@dx{tcgb}} -\newcommand*\settchinesexboldgothicfont{\pxcz@setfont@dx{tcgx}} -\newcommand*\settchineseoneweightgothicfont{\pxcz@setfont@dx{tcgu}} -\newcommand*\settchinesemarugothicfont{\pxcz@setfont@dx{tcmgr}} +% 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@setfont@dx{% +\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 @@ -742,22 +847,21 @@ \@for\pxcz@x:=\pxcz@sym@list\do{% \@namedef{pxcz@FS/\pxcz@x}{}} -%%<*> \maybemultiweight -\newcommand*\maybemultiweight{% - \let\pxchfonMaybeMultiweight=t} - % check for usage of multi-weight commands -\ifx t\pxchfonMaybeMultiweight\else - \AtBeginDocument{% - \ifpxcz@deluxe@used\ifpxcz@otf@deluxe\else +\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 + \fi\fi + \fi} %--------------------------------------- fontmap internals @@ -777,9 +881,9 @@ \def\pxcz@cmap@hwuni{UniJIS-UCS2-HW-H} %%<*> \usecmapforalphabet/\nousecmapforalphabet -\newcommand*\usecmapforalphabet{% +\pxcz@Z\newrobustcmd*\usecmapforalphabet{% \global\pxcz@cmap@alphatrue} -\newcommand*\nousecmapforalphabet{% +\pxcz@Z\newrobustcmd*\nousecmapforalphabet{% \global\pxcz@cmap@alphafalse} %% \pxcz@NEF/<sym> @@ -800,42 +904,56 @@ %%<+> \JaFontReplacementFor{<sym>} \newcommand*\JaFontReplacementFor[1]{% \csname pxcz@FS/#1\endcsname} +\@namedef{pxcz@FS/*}{\pxcz@empty} %%<+> \JaFontReplacementHook{<code>} \@onlypreamble\JaFontReplacementHook -\newcommand*\JaFontReplacementHook{% +\pxcz@Z\newrobustcmd*\JaFontReplacementHook{% \g@addto@macro\pxcz@user@hook} \let\pxcz@user@hook\@empty %%<+> \JaFontUserDefinedMap \@onlypreamble\JaFontUserDefinedMap -\newcommand*\JaFontUserDefinedMap{% +\pxcz@Z\newrobustcmd*\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}}} +\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 -\newcommand*\setnewglyphcmapprefix{% +\pxcz@Z\newrobustcmd*\setnewglyphcmapprefix{% \@ifstar{\pxcz@set@pfx@jis\pxcz@pfx@jis@star}% {\pxcz@set@pfx@jis}} \def\pxcz@set@pfx@jis#1{% @@ -887,18 +1005,6 @@ \ifx\pxcz@font\@empty \else\ifx\pxcz@font\pxcz@noembed \else - \pxcz@inspect@font@tribe@a{?SourceHanSerif-}{.otf?}{sourcehan}% - \pxcz@inspect@font@tribe@a{?SourceHanSans-}{.otf?}{sourcehan}% - \pxcz@inspect@font@tribe@a{?:0:SourceHanSerif-}{.ttc?}{sourcehanC}% - \pxcz@inspect@font@tribe@a{?:0:SourceHanSans-}{.ttc?}{sourcehanC}% - \pxcz@inspect@font@tribe@a{?NotoSerifCJKjp-}{.otf?}{noto}% - \pxcz@inspect@font@tribe@a{?NotoSansCJKjp-}{.otf?}{noto}% - \pxcz@inspect@font@tribe@a{?:0:NotoSerifCJK-}{.ttc?}{notoC}% - \pxcz@inspect@font@tribe@a{?:0:NotoSansCJK-}{.ttc?}{notoC}% - \pxcz@inspect@font@tribe@a{?yumin}{.ttf?}{yumin}% - \pxcz@inspect@font@tribe@a{?YUMIN}{.TTF?}{yuminU}% - \pxcz@inspect@font@tribe@a{:YuGoth}{.ttc?}{yugoth}% - \pxcz@inspect@font@tribe@a{:YUGOTH}{.TTC?}{yugoth}% \pxcz@inspect@font@tribe@a{:moga}{.ttc?}{mogamobo}% \pxcz@inspect@font@tribe@a{:mobo}{.ttc?}{mogamobo}% \fi\fi @@ -919,7 +1025,7 @@ %% \pxcz@switch@font@for{<feature>} % Modifies \pxcz@font, assuming \pxcz@font@tribe is properly set. \pxcz@onlypreamble@def\pxcz@switch@font@for#1{% - \pxcz@csletcs{pxcz@tmpb}{pxcz@switch@font@@\pxcz@font@tribe @#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}% @@ -1085,11 +1191,9 @@ \fi\fi % output it \ifx\pxcz@font\pxcz@kill@mapping - \xdef\pxcz@spec{\pxcz@spec\noexpand\special{% - \pxcz@mapline{-#2}}}% + \pxcz@add@mapline{-#2}% \else\ifx\pxcz@font\@empty\else - \xdef\pxcz@spec{\pxcz@spec\noexpand\special{% - \pxcz@mapline{#2 \pxcz@cmap\space\pxcz@font\pxcz@mopts}}}% + \pxcz@add@mapline{#2 \pxcz@cmap\space\pxcz@font\pxcz@mopts}% \fi\fi} %% \pxcz@do@file@preset @@ -1116,13 +1220,7 @@ \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@addtospec@alt\pxcz@mapfile{#1.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} + \pxcz@add@mapfile{#1.map}} %--------------------------------------- map entry definitions @@ -1435,15 +1533,15 @@ \else \ifnum\pxcz@unicode<\pxcz@unicode@@simple\else \pxcz@diruni@oktrue % 'unicode=UTF' does not need otf - \AtBeginDocument{% loading otf later causes inconsistency + \g@addto@macro\pxcz@first@doc@hook{% + % loading otf later causes inconsistency \@ifpackageloaded{otf}{\pxcz@diruni@okfalse}{}}% \fi \fi \fi %%<*> \diruni -\newcommand*{\diruni}{\pxcz@diruni} -\DeclareRobustCommand*{\pxcz@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 @@ -1452,10 +1550,9 @@ } %%<*> \textdiruni{<text>} -\@ifdefinable{\textdiruni}{% - \DeclareRobustCommand*{\textdiruni}[1]{% - \relax\ifmmode\hbox\fi{\pxcz@diruni#1}% - }} +\pxcz@Z\newrobustcmd*\textdiruni[1]{% + \relax\ifmmode\hbox\fi{\diruni#1}% +} %% \pxcz@du@UTF \def\pxcz@du@UTF#1{% @@ -1476,7 +1573,7 @@ \ifcase\pxcz@unicode with 'unicode' option% \else pxchfon after 'otf' package% \fi .\MessageBreak\@ehc}} -\AtBeginDocument{% +\g@addto@macro\pxcz@first@doc@hook{% \ifpxcz@diruni@ok \let\pxcz@err@diruni\relax \else \let\pxcz@diruni\pxcz@err@diruni \fi} @@ -1526,7 +1623,7 @@ \fi \fi\fi\fi -\AtBeginDocument{% +\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{% @@ -1547,25 +1644,25 @@ \fi %---- </diruni-ok> %--------------------------------------- 'glyphid' +\ifnum\pxcz@glyphid>0 %---- <*glyphid> -%% \pxcz@geta -\chardef\pxcz@geta=\jis"222E\relax - -\ifnum\pxcz@glyphid=2 %---- <*glyphid> +\ifnum\pxcz@glyphid=2 %---- <*glyphid-ok> %% check integrity \ifpxcz@otf@loaded\else - \AtBeginDocument{% loading otf later causes inconsistency + \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\gid{\pxcz@gid@fb}}{}} + \def\pxcz@gid{\pxcz@gid@fb}% + \chardef\pxcz@glyphid=1 + }{}} \fi -%%<*> \gid{<number>} -\newcommand*{\gid}{\pxcz@gid} -\DeclareRobustCommand*{\pxcz@gid}[1]{% +%% \pxcz@gid{<number>} +\def\pxcz@gid#1{% \begingroup \kanjishape{dirgid}\selectfont \kchar#1\pxcz@gid@jfm@sync @@ -1608,108 +1705,38 @@ \pxcz@dg@decl@shape{gt}{bx}f{ssub*gt/m/dirgid}{}% \fi\fi\fi -\fi %---- </glyphid> - -\ifnum\pxcz@glyphid>0 - %% \pxcz@gid@fb - \providecommand*{\gid}{\pxcz@gid@fb} - \DeclareRobustCommand*{\pxcz@gid@fb}[1]{% - \begingroup \kchar\pxcz@geta \endgroup} - - % redefinition in PDF-strings - \begingroup \kansujichar1=\pxcz@geta \kcatcode\pxcz@geta=18 - \xdef\pxcz@hy@gid#1{\kansuji1} - \endgroup - \pxcz@hy@disable@commands{% - \let\gid\pxcz@hy@gid} -\fi - -%--------------------------------------- 'alphabet' option - -%% check for textcomp -\newif\ifpxcz@textcomp -\ifx\DeclareEncodingSubset\@undefined\else - \expandafter\ifx\csname T@TS1\endcsname\relax\else - \pxcz@textcomptrue -\fi\fi +\fi %---- </glyphid-ok> -%% \pxcz@afont@enc@list -\def\pxcz@afont@enc@list{OT1,T1} -\ifpxcz@textcomp \g@addto@macro\pxcz@afont@enc@list{,TS1}\fi -%% \pxcz@decl@family{<fam>} -\pxcz@onlypreamble@def\pxcz@decl@family#1{% - \ifpxcz@textcomp \DeclareEncodingSubset{TS1}{#1}{3}\fi - \@for\pxcz@x:=\pxcz@afont@enc@list\do{% - \DeclareFontFamily{\pxcz@x}{#1}{}}} -%% \pxcz@decl@shape{<fam>}{<ser>}<sw>{<font>} -\pxcz@onlypreamble@def\pxcz@decl@shape#1#2#3#4{% - \if s#3% - \@for\pxcz@x:=\pxcz@afont@enc@list\do{% - \DeclareFontShape{\pxcz@x}{#1}{#2}{n}{<->ssub*#4}{}}% +%%<*> \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 - \DeclareFontShape{OT1}{#1}{#2}{n}{<->#4-l5j}{}% - \DeclareFontShape {T1}{#1}{#2}{n}{<->#4-t1}{}% - \ifpxcz@textcomp - \DeclareFontShape{TS1}{#1}{#2}{n}{<->#4-ts1}{}% - \fi + \pxjahyperBadCharacter{GID+#1}% \fi - \@for\pxcz@x:=\pxcz@afont@enc@list\do{% - \DeclareFontShape{\pxcz@x}{#1}{#2}{it}{<->ssub*#1/#2/n}{}% - \DeclareFontShape{\pxcz@x}{#1}{#2}{sl}{<->ssub*#1/#2/n}{}}} - -\ifpxcz@alphafont %---- <*alphabet> -\ifpxcz@otf@deluxe %---- <*otfdx> : otf with deluxe option - % define families cfjar & cfjas -\pxcz@decl@family{cfjar}% -\pxcz@decl@shape{cfjar}{l}n{cfjar-l}% -\pxcz@decl@shape{cfjar}{m}n{cfjar-r}% -\pxcz@decl@shape{cfjar}{bx}n{cfjar-b}% -\pxcz@decl@family{cfjas}% -\pxcz@decl@shape{cfjas}{m}n{cfjas-r}% -\pxcz@decl@shape{cfjas}{bx}n{cfjas-b}% -\pxcz@decl@shape{cfjas}{eb}n{cfjas-x}% -\pxcz@decl@family{cfjam}% -\pxcz@decl@shape{cfjam}{m}n{cfjam-r}% - % 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> -\pxcz@decl@family{cfjar}% -\pxcz@decl@shape{cfjar}{m}n{cfjar-r}% -\pxcz@decl@shape{cfjar}{bx}s{cfjas/m/n}% -\pxcz@decl@family{cfjas}% -\pxcz@decl@shape{cfjas}{m}n{cfjas-r}% -\pxcz@decl@shape{cfjas}{bx}s{cfjas/m/n}% -\pxcz@onlypreamble@def\pxcz@err@dxotf#1{% - \PackageError\pxcz@pkgname - {Loaded before '#1' with 'deluxe'}% - {This package must be loaded after '#1' with 'deluxe' option - when using both.}} -\g@addto@macro\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@}{unicode}{HWid}}% - \fi\fi - \@ifpackagewith{otf}{deluxe}{\pxcz@err@dxotf{otf}}{}% } -\fi %---- </otfdx> -\fi %---- </alphabet> + \pxcz@hy@disable@commands{% + \let\gid\pxcz@hy@gid} -%--------------------------------------- begin-document hook +\fi %---- </glyphid> +%--------------------------------------- 'pxchfon0' submodule +\ifpxcz@lite@mode\else -%% variables -\let\pxcz@afont@enc\relax +%% load the submodule +\input{pxchfon0.def} -%% \pxcz@mgfamily@hook -\def\pxcz@mgfamily@hook{\romanfamily{cfjam}} +\fi +%--------------------------------------- begin-document hook %% \pxcz@set@page@hook{<text>} \ifpxcz@old@hook@system %---- @@ -1740,37 +1767,14 @@ \expandafter\ifx\csname pxcz@FS/\pxcz@x\endcsname\@empty \pxcz@okfalse \fi}} -%% \pxcz@decl@relfont{<fam>}{<afam>}{<ser>,...} -\pxcz@onlypreamble@def\pxcz@decl@relfont#1#2#3{% - \@for\pxcz@x:={#3}\do{% - \expandafter\ifx\csname\k@encoding/#1/\pxcz@x/n\endcsname\relax\else - \edef\pxcz@tmpa{\noexpand\DeclareRelationFont - {\k@encoding}{#1}{\pxcz@x}{}{\pxcz@afont@enc}{#2}{\pxcz@x}{}% - }\pxcz@tmpa - \fi}% - \PackageInfo\pxcz@pkgname - {Relation font set for \k@encoding/#1}} - -%% \pxcz@check@afont@enc -\pxcz@onlypreamble@def\pxcz@check@afont@enc{% - \pxcz@oktrue % OT1 is always okay - \expandafter\ifx\csname\pxcz@afont@enc+cfjar\endcsname\relax - \pxcz@okfalse \fi - % if not okay, use OT1 instead - \ifpxcz@ok\else \def\pxcz@afont@enc{OT1}\fi} - -%% \pxcz@set@bfdefault@to@bx{<doc-ser>} -\pxcz@onlypreamble@let\pxcz@set@bfdefault@to@bx\@gobble -\ifx\DeclareFontSeriesDefault\@undefined\else - \def\pxcz@set@bfdefault@to@bx#1{% - \DeclareFontSeriesDefault[#1]{bf}{bx}} -\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 @@ -1782,44 +1786,11 @@ \pxcz@inspect@flavor@all \fi \if t\pxcz@alphabet % 'alphabet' - \pxcz@check@alldefined{mnl,mnr,mnb}\ifpxcz@ok - \renewcommand\rmdefault{cfjar}% - \pxcz@set@bfdefault@to@bx{rm}% - \fi - \pxcz@check@alldefined{gtr,gtb,gtx}\ifpxcz@ok - \renewcommand\sfdefault{cfjas}% - \pxcz@set@bfdefault@to@bx{sf}% - \fi - % attach hook to \mgfamily if mgr font is defined - \pxcz@check@alldefined{mgr}\ifpxcz@ok\ifpxcz@otf@deluxe - \begingroup - \def\pxcz@x##1{\toks@\expandafter{##1}% - \xdef##1{\noexpand\pxcz@mgfamily@hook\the\toks@}% - }\expandafter\pxcz@x\csname mgfamily \endcsname - \endgroup - \fi\fi - % decide alphabet font encoding - \edef\pxcz@afont@enc{\encodingdefault}% - \pxcz@check@afont@enc\ifpxcz@ok\else - \PackageWarningNoLine\pxcz@pkgname - {Default encoding is changed to 'OT1' because% - \MessageBreak'alphabet' option is in effect}% - \renewcommand\encodingdefault{OT1}% - \fi - \normalfont + \pxcz@setup@alphabet \pxcz@addtospec{ALPHA}% \fi \if r\pxcz@alphabet % 'relfont' - \edef\pxcz@afont@enc{\encodingdefault}% - \pxcz@check@afont@enc - \pxcz@check@alldefined{mnl,mnr,mnb}% - \ifpxcz@ok \pxcz@decl@relfont\mcdefault{cfjar}{m,bx,l}\fi - \pxcz@check@alldefined{gtr,gtb,gtx}% - \ifpxcz@ok \pxcz@decl@relfont\gtdefault{cfjas}{m,bx,eb}\fi - \pxcz@check@alldefined{mgr}% - \ifpxcz@ok\ifpxcz@otf@deluxe - \pxcz@decl@relfont\mgdefault{cfjam}{m}% - \fi\fi + \pxcz@setup@relfont \pxcz@addtospec{ALPHA}% \fi \ifpxcz@uptex\else @@ -1843,24 +1814,34 @@ \ifpxcz@utf \pxcz@addtospec{UTF}% \fi % warn if some weights are not substituted, and if necessaty - \ifpxcz@warn@unless@all@defined - \ifpxcz@otf@deluxe + \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 - {Some font weights are not substituted.\MessageBreak - So some features of pxchfon might not work\MessageBreak - properly when applied to such weights}% + {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 - \ifpxcz@warn@unless@all@embedded \ifpxcz@noembed@used + \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 might not work\MessageBreak - properly when applied to such weights}% + 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 @@ -1868,7 +1849,7 @@ \ifpxcz@enabled \pxcz@set@page@hook{\pxcz@spec}% \else\ifx\pxcz@spec\@empty\else - \PackageWarningNoLine\pxcz@pkgname + \pxcz@PackageNoteNoLine\pxcz@pkgname {Font mapping is disabled, since the driver in use\MessageBreak is not dvipdfmx}% \fi\fi @@ -2090,7 +2071,7 @@ \ifpxcz@autojfmsync %---- <*autojfmsync> % Makes \git/\CID/\UTF do automatically jfmsync \let\pxcz@gid@jfm@sync\pxcz@jfm@sync -\AtBeginDocument{% +\g@addto@macro\pxcz@first@doc@hook{% \ifx\put@character\@undefined\else \g@addto@macro\put@character{\pxcz@jfm@sync}% \fi diff --git a/Master/texmf-dist/tex/platex/pxchfon/pxchfon0.def b/Master/texmf-dist/tex/platex/pxchfon/pxchfon0.def index 1be68f098f3..1a78b75eb9d 100644 --- a/Master/texmf-dist/tex/platex/pxchfon/pxchfon0.def +++ b/Master/texmf-dist/tex/platex/pxchfon/pxchfon0.def @@ -1,4 +1,235 @@ -% pxchfon0.def -% This file does nothing; it exists for check for full installation. -\relax -% EOF +%% +%% This is file 'pxchfon0.def'. +%% +%% 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} +\ProvidesFile{pxchfon0.def}[2024/08/22 v2.2] +\providecommand{\bxDebug}[1]{} + +%--------------------------------------- general + +%% variables +\newif\ifpxcz@textcomp + +%--------------------------------------- 'alphabet' option +\ifpxcz@alphafont + +%% check for textcomp +\ifx\DeclareEncodingSubset\@undefined\else + \expandafter\ifx\csname T@TS1\endcsname\relax\else + \pxcz@textcomptrue +\fi\fi + +%% \pxcz@afont@enc@list +\def\pxcz@afont@enc@list{OT1,T1} +\ifpxcz@textcomp \g@addto@macro\pxcz@afont@enc@list{,TS1}\fi +%% \pxcz@decl@family{<fam>} +\pxcz@onlypreamble@def\pxcz@decl@family#1{% + \ifpxcz@textcomp \DeclareEncodingSubset{TS1}{#1}{3}\fi + \@for\pxcz@x:=\pxcz@afont@enc@list\do{% + \DeclareFontFamily{\pxcz@x}{#1}{}}} +%% \pxcz@decl@shape{<fam>}{<ser>}<sw>{<font>} +\pxcz@onlypreamble@def\pxcz@decl@shape#1#2#3#4{% + \if s#3% + \@for\pxcz@x:=\pxcz@afont@enc@list\do{% + \DeclareFontShape{\pxcz@x}{#1}{#2}{n}{<->ssub*#4}{}}% + \else + \DeclareFontShape{OT1}{#1}{#2}{n}{<->#4-l5j}{}% + \DeclareFontShape {T1}{#1}{#2}{n}{<->#4-t1}{}% + \ifpxcz@textcomp + \DeclareFontShape{TS1}{#1}{#2}{n}{<->#4-ts1}{}% + \fi + \fi + \@for\pxcz@x:=\pxcz@afont@enc@list\do{% + \DeclareFontShape{\pxcz@x}{#1}{#2}{it}{<->ssub*#1/#2/n}{}% + \DeclareFontShape{\pxcz@x}{#1}{#2}{sl}{<->ssub*#1/#2/n}{}}} + +\if d\pxcz@otf@weight %---- <*otfdx> : otf with deluxe option + % define families cfjar & cfjas +\pxcz@decl@family{cfjar}% +\pxcz@decl@shape{cfjar}{l}n{cfjar-l}% +\pxcz@decl@shape{cfjar}{m}n{cfjar-r}% +\pxcz@decl@shape{cfjar}{bx}n{cfjar-b}% +\pxcz@decl@family{cfjas}% +\pxcz@decl@shape{cfjas}{m}n{cfjas-r}% +\pxcz@decl@shape{cfjas}{bx}n{cfjas-b}% +\pxcz@decl@shape{cfjas}{eb}n{cfjas-x}% +\pxcz@decl@family{cfjam}% +\pxcz@decl@shape{cfjam}{m}n{cfjam-r}% + % 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> +\pxcz@decl@family{cfjar}% +\pxcz@decl@shape{cfjar}{m}n{cfjar-r}% +\pxcz@decl@shape{cfjar}{bx}s{cfjas/m/n}% +\pxcz@decl@family{cfjas}% +\pxcz@decl@shape{cfjas}{m}n{cfjas-r}% +\pxcz@decl@shape{cfjas}{bx}s{cfjas/m/n}% +\pxcz@onlypreamble@def\pxcz@err@dxotf#1{% + \PackageError\pxcz@pkgname + {Loaded before '#1' with 'deluxe'}% + {This package must be loaded after '#1' with 'deluxe' option + when using both.}} +\g@addto@macro\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@}{unicode}{HWid}}% + \fi\fi + \@ifpackagewith{otf}{deluxe}{\pxcz@err@dxotf{otf}}{}% +} +\fi %---- </otfdx> + +\fi +%--------------------------------------- begin-document hook +\ifpxcz@alphafont + +%% variables +\let\pxcz@afont@enc\relax + +%% \pxcz@mgfamily@hook +\def\pxcz@mgfamily@hook{\romanfamily{cfjam}} + +%% \pxcz@decl@relfont{<fam>}{<afam>}{<ser>,...} +\pxcz@onlypreamble@def\pxcz@decl@relfont#1#2#3{% + \@for\pxcz@x:={#3}\do{% + \expandafter\ifx\csname\k@encoding/#1/\pxcz@x/n\endcsname\relax\else + \edef\pxcz@tmpa{\noexpand\DeclareRelationFont + {\k@encoding}{#1}{\pxcz@x}{}{\pxcz@afont@enc}{#2}{\pxcz@x}{}% + }\pxcz@tmpa + \fi}% + \PackageInfo\pxcz@pkgname + {Relation font set for \k@encoding/#1}} + +%% \pxcz@check@afont@enc +\pxcz@onlypreamble@def\pxcz@check@afont@enc{% + \pxcz@oktrue % OT1 is always okay + \expandafter\ifx\csname\pxcz@afont@enc+cfjar\endcsname\relax + \pxcz@okfalse \fi + % if not okay, use OT1 instead + \ifpxcz@ok\else \def\pxcz@afont@enc{OT1}\fi} + +%% \pxcz@set@bfdefault@to@bx{<doc-ser>} +\pxcz@onlypreamble@let\pxcz@set@bfdefault@to@bx\@gobble +\ifx\DeclareFontSeriesDefault\@undefined\else + \def\pxcz@set@bfdefault@to@bx#1{% + \DeclareFontSeriesDefault[#1]{bf}{bx}} +\fi + +%% \pxcz@setup@alphabet +\pxcz@onlypreamble@def\pxcz@setup@alphabet{% + \pxcz@check@alldefined{mnl,mnr,mnb}\ifpxcz@ok + \renewcommand\rmdefault{cfjar}% + \pxcz@set@bfdefault@to@bx{rm}% + \fi + \pxcz@check@alldefined{gtr,gtb,gtx}\ifpxcz@ok + \renewcommand\sfdefault{cfjas}% + \pxcz@set@bfdefault@to@bx{sf}% + \fi + % attach hook to \mgfamily if mgr font is defined + \pxcz@check@alldefined{mgr}\ifpxcz@ok\if d\pxcz@otf@weight + \begingroup + \def\pxcz@x##1{\toks@\expandafter{##1}% + \xdef##1{\noexpand\pxcz@mgfamily@hook\the\toks@}% + }\expandafter\pxcz@x\csname mgfamily \endcsname + \endgroup + \fi\fi + % decide alphabet font encoding + \edef\pxcz@afont@enc{\encodingdefault}% + \pxcz@check@afont@enc\ifpxcz@ok\else + \PackageWarningNoLine\pxcz@pkgname + {Default encoding is changed to 'OT1' because% + \MessageBreak'alphabet' option is in effect}% + \renewcommand\encodingdefault{OT1}% + \fi + \normalfont +} + +%% \pxcz@setup@relfont +\pxcz@onlypreamble@def\pxcz@setup@relfont{% + \edef\pxcz@afont@enc{\encodingdefault}% + \pxcz@check@afont@enc + \pxcz@check@alldefined{mnl,mnr,mnb}% + \ifpxcz@ok \pxcz@decl@relfont\mcdefault{cfjar}{m,bx,l}\fi + \pxcz@check@alldefined{gtr,gtb,gtx}% + \ifpxcz@ok \pxcz@decl@relfont\gtdefault{cfjas}{m,bx,eb}\fi + \pxcz@check@alldefined{mgr}% + \ifpxcz@ok\if d\pxcz@otf@weight + \pxcz@decl@relfont\mgdefault{cfjam}{m}% + \fi\fi +} + +\fi +%--------------------------------------- 'usefontmaplines' + +%%<*> \begin{usefontmaplines} +% <map-line> +% ... +% \end{usefontmaplines} +\@onlypreamble\usefontmaplines +\newenvironment{usefontmaplines}{% + \catcode`\{=12 \catcode`\}=12 \catcode`\&=12 \catcode`\#=12 + \catcode`\^=12 \catcode`\~=12 \catcode`\%=12 \catcode13=12 + \catcode32=10 \endlinechar=13 + \let\pxcz@tmp@end\end \let\begin\relax \let\end\relax + \let\par\@empty \let\ \space \def\pxcz@tmp@end@{\end}% + \pxcz@maplines@a +}{} +\@onlypreamble\pxcz@maplines@a +\long\def\pxcz@maplines@a#1{% + \def\pxcz@tmpa{#1}\pxcz@cond\ifx\pxcz@tmpa\pxcz@tmp@end@\fi{% + \catcode`\{=1 \catcode`\}=2 + \pxcz@tmp@end + }{%else + \pxcz@maplines@b#1% + }% +} +\@onlypreamble\pxcz@maplines@b +\begingroup \catcode13=12 +\long\gdef\pxcz@maplines@b#1^^M{% + \pxcz@maplines@line#1\pxcz@mk% + \pxcz@maplines@a% +}% +\endgroup +\@onlypreamble\pxcz@maplines@line +\long\def\pxcz@maplines@line#1\pxcz@mk{% + \edef\pxcz@tmpa{#1}% + \pxcz@split{\@percentchar}{\pxcz@tmpa}% + \ifx\pxcz@pre\relax\else \let\pxcz@tmpa\pxcz@pre \fi + \pxcz@split{\end}{\pxcz@tmpa}% + \ifx\pxcz@pre\relax + \pxcz@split{\space\pxcz@mk}{\pxcz@tmpa\pxcz@mk}% + \ifx\pxcz@pre\relax\else \let\pxcz@tmpa\pxcz@pre \fi + \ifx\pxcz@tmpa\@empty\else + \expandafter\usefontmapline\expandafter{\pxcz@tmpa}% + \fi + \else % '\end' found inside the line + \pxcz@maplines@err + \fi +} +\pxcz@onlypreamble@def\pxcz@maplines@err{% + \PackageError\pxcz@pkgname + {'\string\end{usefontmaplines}' must be put at the top\MessageBreak + of a line}% + {\@ehc}% + \def\pxcz@maplines@a{\pxcz@tmp@end{usefontmaplines}}% +} + +%--------------------------------------- all done +\endinput +%% EOF diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def index 331dcd32f22..803a78c2cd5 100644 --- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def +++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def @@ -1,7 +1,7 @@ %% %% This is file 'pxjahyper-ajm.def'. %% -%% Copyright (c) 2012-2023 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2012-2024 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -11,7 +11,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesFile{pxjahyper-ajm.def}[2023/03/01 v1.3] +\ProvidesFile{pxjahyper-ajm.def}[2024/08/25 v1.5] %% avoid multiple loading \csname pxjahyperajmLoaded\endcsname @@ -104,6 +104,12 @@ \fi } +%% \pxhy@cc@anchor@string{<macro-name>}{<number>} +% Expands to "anchor-string form" of a CC macro. +\def\pxhy@cc@anchor@string#1#2{% + \pxjahyperBadCharacter{aj#1+\number#2}% +} + %--------------------------------------- \pdfstringdef hook \pdfstringdefDisableCommands{% @@ -209,6 +215,45 @@ \let\pxhy@two@digits\relax \let\pxhy@knumeral\relax +%--------------------------------------- for counter commands + +%% \pxhy@cc@macro@name@list +\let\pxhy@cc@macro@name@list\@empty + +%% \pxhy@DeclareCCMacro{<macro-name>}...{<body>} +\def\pxhy@DeclareCCMacro#1{% + \eappto\pxhy@cc@macro@name@list{`\do{#1}}% + \pxhy@DeclareMacro{#1}% +} + +%% \pxhy@DeclareCCMacroVar{<macro-name>}...{<body-n>}{<body-v>} +% Variant of \pxhy@DeclareMacro, where the *-variant of the macro +% is declared. The parameter '...' will be shared with both forms. +\def\pxhy@DeclareCCMacroVar#1{% + \eappto\pxhy@cc@macro@name@list{`\do{#1@N}`\do{#1@V}}% + \pxhy@DeclareMacroVar{#1}% +} + +%% \pxhy@finish@declare@cc@macros +% Must be invoked after all CC macros are defined. +\def\pxhy@finish@declare@cc@macros{% + \let\do\pxhy@amend@cc@macro + \pxhy@cc@macro@name@list + \let\pxhy@cc@macro@name@list\@empty +} + +%% \pxhy@amend@cc@macro{<macro-name>} +\def\pxhy@amend@cc@macro#1{% + \expandafter\pxhy@amend@cc@macro@a + \csname\pxhy@#1\expandafter\endcsname + \csname\pxhy@#1@A\expandafter\endcsname + \csname\pxhy@#1@D\endcsname{#1}% +} +\def\pxhy@amend@cc@macro@a#1#2#3#4{% + \gdef#2{\pxhy@cc@anchor@string{#4}}% + \global\let#3#1% + \gdef#1{\pxhy@if@in@anchor#2#3}% +} %--------------------------------------- the redefinitions % A text command invoked in PDF-sttings must be "string-OK". @@ -242,7 +287,7 @@ % used as fallback (e.g. \ajKuroMaru{21}→“㉑)”. %%<!> \ajMaru[*]{<number>} -\pxhy@DeclareMacroVar{Maru}#1{%N +\pxhy@DeclareCCMacroVar{Maru}#1{%N \pxhy@fallback{0}{51}{100}{% \pxhy@rshift{0/8224,1/7554,21/8070,22/8080,32/10212,101}% }{\pxhy@numeral{#1}}% @@ -252,7 +297,7 @@ }{`\ajMaru{#1}}% } %%<!> \ajKuroMaru[*]{<number>} -\pxhy@DeclareMacroVar{KuroMaru}#1{%N +\pxhy@DeclareCCMacroVar{KuroMaru}#1{%N \pxhy@fallback{0}{21}{100}{% \pxhy@rshift{0/10503,1/8285,10/10504,101}% }{`\ajMaru{#1}}% @@ -262,7 +307,7 @@ }{`\ajKuroMaru{#1}}% } %%<!> \ajKaku[*]{<number>} -\pxhy@DeclareMacroVar{Kaku}#1{%N +\pxhy@DeclareCCMacroVar{Kaku}#1{%N \pxhy@fallback{0}{0}{100}{% \pxhy@twirange{10764}{10774}% }{`\ajMaru{#1}}% @@ -272,7 +317,7 @@ }{`\ajMaru{#1}}% } %%<!> \ajKuroKaku[*]{<number>} -\pxhy@DeclareMacroVar{KuroKaku}#1{%N +\pxhy@DeclareCCMacroVar{KuroKaku}#1{%N \pxhy@fallback{0}{0}{100}{% \pxhy@twirange{11037}{11047}% }{`\ajMaru{#1}}% @@ -282,7 +327,7 @@ }{`\ajMaru{#1}}% } %%<!> \ajMaruKaku[*]{<number>} -\pxhy@DeclareMacroVar{MaruKaku}#1{%N +\pxhy@DeclareCCMacroVar{MaruKaku}#1{%N \pxhy@fallback{0}{0}{100}{% \pxhy@twirange{11307}{11317}% }{`\ajMaru{#1}}% @@ -293,7 +338,7 @@ }{`\ajMaru{#1}}% } %%<!> \ajKuroMaruKaku[*]{<number>} -\pxhy@DeclareMacroVar{KuroMaruKaku}#1{%N +\pxhy@DeclareCCMacroVar{KuroMaruKaku}#1{%N \pxhy@fallback{0}{0}{100}{% \pxhy@twirange{11576}{11586}% }{`\ajMaru{#1}}% @@ -303,7 +348,7 @@ }{`\ajMaru{#1}}% } %%<!> \ajKakko[*]{<number>} -\pxhy@DeclareMacroVar{Kakko}#1{%N +\pxhy@DeclareCCMacroVar{Kakko}#1{%N \pxhy@fallback{0}{21}{100}{% \pxhy@rshift{0/8227,1/8070,21/9873,101}% }{(\pxhy@numeral{#1})}% @@ -313,7 +358,7 @@ }{`\ajKakko{#1}}% } %%<!> \ajRoman[*]{<number>} -\pxhy@DeclareMacroVar{Roman}#1{%N +\pxhy@DeclareCCMacroVar{Roman}#1{%N \pxhy@fallback{1}{13}{15}{% \pxhy@rshift{1/7574,11/8214,13/8282,16}% }{`\@Roman{#1}}% @@ -323,132 +368,132 @@ }{`\ifnum#1=\#{4}IIII`\else`\ajRoman{#1}`\fi}% } %%<!> \ajroman{<number>} -\pxhy@DeclareMacro{roman}#1{% +\pxhy@DeclareCCMacro{roman}#1{% \pxhy@fallback{1}{13}{15}{% \pxhy@rshift{1/8091,11/8287,16}% }{`\@roman{#1}}% } %%<!> \ajPeriod{<number>} -\pxhy@DeclareMacro{Period}#1{% +\pxhy@DeclareCCMacro{Period}#1{% \pxhy@fallback{0}{1}{11}{% 0.% }{\pxhy@rshift{0/8061,10/20577,12}}% } %%<!> \ajKakkoYobi{<number>} -\pxhy@DeclareMacro{KakkoYobi}#1{\pxhy@rshift{1/8196,10}} +\pxhy@DeclareCCMacro{KakkoYobi}#1{\pxhy@rshift{1/8196,10}} %%<!> \ajKakkoroman{<number>} -\pxhy@DeclareMacro{Kakkoroman}#1{% +\pxhy@DeclareCCMacro{Kakkoroman}#1{% \pxhy@fallback{1}{1}{15}{% \pxhy@rshift{1/9973,16}% }{(`\ajroman{#1})}% } %%<!> \ajKakkoRoman{<number>} -\pxhy@DeclareMacro{KakkoRoman}#1{% +\pxhy@DeclareCCMacro{KakkoRoman}#1{% \pxhy@fallback{1}{1}{15}{% \pxhy@rshift{1/9988,16}% }{(`\ajRoman{#1})}% } %%<!> \ajKakkoalph{<number>} -\pxhy@DeclareMacro{Kakkoalph}#1{\pxhy@rshift{1/8111,27}} +\pxhy@DeclareCCMacro{Kakkoalph}#1{\pxhy@rshift{1/8111,27}} %%<!> \ajKakkoAlph{<number>} -\pxhy@DeclareMacro{KakkoAlph}#1{\pxhy@rshift{1/10003,27}} +\pxhy@DeclareCCMacro{KakkoAlph}#1{\pxhy@rshift{1/10003,27}} %%<!> \ajKakkoHira{<number>} -\pxhy@DeclareMacro{KakkoHira}#1{% +\pxhy@DeclareCCMacro{KakkoHira}#1{% \pxhy@fallback{1}{1}{48}{% \pxhy@rshift{1/10029,49}% }{(\pxhy@rshift{1/10029,49})}% with parens } %%<!> \ajKakkoKata{<number>} -\pxhy@DeclareMacro{KakkoKata}#1{% +\pxhy@DeclareCCMacro{KakkoKata}#1{% \pxhy@fallback{1}{1}{48}{% \pxhy@rshift{1/10077,49}% }{(\pxhy@rshift{1/10077,49})}% with parens } %%<!> \ajKakkoKansuji{<number>} -\pxhy@DeclareMacro{KakkoKansuji}#1{% +\pxhy@DeclareCCMacro{KakkoKansuji}#1{% \pxhy@fallback{1}{11}{20}{% \pxhy@rshift{1/10125,21}% }{(\pxhy@knumeral{#1})}% } %%<!> \ajMaruKansuji{<number>} -\pxhy@DeclareMacro{MaruKansuji}#1{\pxhy@rshift{1/10460,11}} +\pxhy@DeclareCCMacro{MaruKansuji}#1{\pxhy@rshift{1/10460,11}} %%<!> \ajMarualph{<number>} -\pxhy@DeclareMacro{Marualph}#1{\pxhy@rshift{1/10312,27}} +\pxhy@DeclareCCMacro{Marualph}#1{\pxhy@rshift{1/10312,27}} %%<!> \ajMaruAlph{<number>} -\pxhy@DeclareMacro{MaruAlph}#1{\pxhy@rshift{1/10338,27}} +\pxhy@DeclareCCMacro{MaruAlph}#1{\pxhy@rshift{1/10338,27}} %%<!> \ajMaruHira{<number>} -\pxhy@DeclareMacro{MaruHira}#1{\pxhy@rshift{1/10364,49}} +\pxhy@DeclareCCMacro{MaruHira}#1{\pxhy@rshift{1/10364,49}} %%<!> \ajMaruKata{<number>} -\pxhy@DeclareMacro{MaruKata}#1{\pxhy@rshift{1/10412,49}} +\pxhy@DeclareCCMacro{MaruKata}#1{\pxhy@rshift{1/10412,49}} %%<!> \ajMaruYobi{<number>} -\pxhy@DeclareMacro{MaruYobi}#1{% +\pxhy@DeclareCCMacro{MaruYobi}#1{% \pxhy@rshift{1/10470,8/10484,9/10478,10}% } %%<!> \ajKuroMarualph{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMarualph}#1{`\ajMarualph{#1}} +\pxhy@DeclareCCMacro{KuroMarualph}#1{`\ajMarualph{#1}} %%<!> \ajKuroMaruAlph{<number>} -\pxhy@DeclareMacro{KuroMaruAlph}#1{\pxhy@rshift{1/10630,27}} +\pxhy@DeclareCCMacro{KuroMaruAlph}#1{\pxhy@rshift{1/10630,27}} %%<!> \ajKuroMaruHira{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMaruHira}#1{`\ajMaruHira{#1}} +\pxhy@DeclareCCMacro{KuroMaruHira}#1{`\ajMaruHira{#1}} %%<!> \ajKuroMaruKata{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMaruKata}#1{`\ajMaruKata{#1}} +\pxhy@DeclareCCMacro{KuroMaruKata}#1{`\ajMaruKata{#1}} %%<!> \ajKuroMaruYobi{<number>} : Fallback. % fallback to \ajKakuYobi, which is simpler. -\pxhy@DeclareMacro{KuroMaruYobi}#1{`\ajKakuYobi{#1}} +\pxhy@DeclareCCMacro{KuroMaruYobi}#1{`\ajKakuYobi{#1}} %%<!> \ajKakualph{<number>} : Fallback. -\pxhy@DeclareMacro{Kakualph}#1{`\ajMarualph{#1}} +\pxhy@DeclareCCMacro{Kakualph}#1{`\ajMarualph{#1}} %%<!> \ajKakuAlph{<number>} -\pxhy@DeclareMacro{KakuAlph}#1{\pxhy@rshift{1/10900,27}} +\pxhy@DeclareCCMacro{KakuAlph}#1{\pxhy@rshift{1/10900,27}} %%<!> \ajKakuHira{<number>} : Fallback. -\pxhy@DeclareMacro{KakuHira}#1{`\ajMaruHira{#1}} +\pxhy@DeclareCCMacro{KakuHira}#1{`\ajMaruHira{#1}} %%<!> \ajKakuKata{<number>} : Fallback. -\pxhy@DeclareMacro{KakuKata}#1{`\ajMaruKata{#1}} +\pxhy@DeclareCCMacro{KakuKata}#1{`\ajMaruKata{#1}} %%<!> \ajKakuYobi{<number>} -\pxhy@DeclareMacro{KakuYobi}#1{\pxhy@rshift{1/11022,8}} +\pxhy@DeclareCCMacro{KakuYobi}#1{\pxhy@rshift{1/11022,8}} %%<!> \ajKuroKakualph{<number>} : Fallback. -\pxhy@DeclareMacro{KuroKakualph}#1{`\ajMarualph{#1}} +\pxhy@DeclareCCMacro{KuroKakualph}#1{`\ajMarualph{#1}} %%<!> \ajKuroKakuAlph{<number>} -\pxhy@DeclareMacro{KuroKakuAlph}#1{\pxhy@rshift{1/11173,27}} +\pxhy@DeclareCCMacro{KuroKakuAlph}#1{\pxhy@rshift{1/11173,27}} %%<!> \ajKuroKakuHira{<number>} : Fallback. -\pxhy@DeclareMacro{KuroKakuHira}#1{`\ajMaruHira{#1}} +\pxhy@DeclareCCMacro{KuroKakuHira}#1{`\ajMaruHira{#1}} %%<!> \ajKuroKakuKata{<number>} : Fallback. -\pxhy@DeclareMacro{KuroKakuKata}#1{`\ajMaruKata{#1}} +\pxhy@DeclareCCMacro{KuroKakuKata}#1{`\ajMaruKata{#1}} %%<!> \ajKuroKakuYobi{<number>} : Fallback. -\pxhy@DeclareMacro{KuroKakuYobi}#1{`\ajKakuYobi{#1}} +\pxhy@DeclareCCMacro{KuroKakuYobi}#1{`\ajKakuYobi{#1}} %%<!> \ajMaruKakualph{<number>} : Fallback. -\pxhy@DeclareMacro{MaruKakualph}#1{`\ajMarualph{#1}} +\pxhy@DeclareCCMacro{MaruKakualph}#1{`\ajMarualph{#1}} %%<!> \ajMaruKakuAlph{<number>} -\pxhy@DeclareMacro{MaruKakuAlph}#1{\pxhy@rshift{1/11443,27}} +\pxhy@DeclareCCMacro{MaruKakuAlph}#1{\pxhy@rshift{1/11443,27}} %%<!> \ajMaruKakuHira{<number>} : Fallback. -\pxhy@DeclareMacro{MaruKakuHira}#1{`\ajMaruHira{#1}} +\pxhy@DeclareCCMacro{MaruKakuHira}#1{`\ajMaruHira{#1}} %%<!> \ajMaruKakuKata{<number>} : Fallback. -\pxhy@DeclareMacro{MaruKakuKata}#1{`\ajMaruKata{#1}} +\pxhy@DeclareCCMacro{MaruKakuKata}#1{`\ajMaruKata{#1}} %%<!> \ajMaruKakuYobi{<number>} : Fallback. -\pxhy@DeclareMacro{MaruKakuYobi}#1{`\ajKakuYobi{#1}} +\pxhy@DeclareCCMacro{MaruKakuYobi}#1{`\ajKakuYobi{#1}} %%<!> \ajKuroMaruKakualph{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMaruKakualph}#1{`\ajMarualph{#1}} +\pxhy@DeclareCCMacro{KuroMaruKakualph}#1{`\ajMarualph{#1}} %%<!> \ajKuroMaruKakuAlph{<number>} -\pxhy@DeclareMacro{KuroMaruKakuAlph}#1{\pxhy@rshift{1/11712,27}} +\pxhy@DeclareCCMacro{KuroMaruKakuAlph}#1{\pxhy@rshift{1/11712,27}} %%<!> \ajKuroMaruKakuHira{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMaruKakuHira}#1{`\ajMaruHira{#1}} +\pxhy@DeclareCCMacro{KuroMaruKakuHira}#1{`\ajMaruHira{#1}} %%<!> \ajKuroMaruKakuKata{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMaruKakuKata}#1{`\ajMaruKata{#1}} +\pxhy@DeclareCCMacro{KuroMaruKakuKata}#1{`\ajMaruKata{#1}} %%<!> \ajKuroMaruKakuYobi{<number>} : Fallback. -\pxhy@DeclareMacro{KuroMaruKakuYobi}#1{`\ajKakuYobi{#1}} +\pxhy@DeclareCCMacro{KuroMaruKakuYobi}#1{`\ajKakuYobi{#1}} %%<!> \ajNijuMaru{<number>} -\pxhy@DeclareMacro{NijuMaru}#1{\pxhy@rshift{1/16222,11}} +\pxhy@DeclareCCMacro{NijuMaru}#1{\pxhy@rshift{1/16222,11}} %%<!> \ajRecycle{<number>} -\pxhy@DeclareMacro{Recycle}#1{\pxhy@rshift{0/16314,12}} +\pxhy@DeclareCCMacro{Recycle}#1{\pxhy@rshift{0/16314,12}} %%<!> \ajHasenKakuAlph{<number>} -\pxhy@DeclareMacro{HasenKakuAlph}#1{\pxhy@rshift{1/20496,7}} +\pxhy@DeclareCCMacro{HasenKakuAlph}#1{\pxhy@rshift{1/20496,7}} %%<!> \ajCross{<number>} -\pxhy@DeclareMacro{Cross}#1{% +\pxhy@DeclareCCMacro{Cross}#1{% \pxhy@fallback{0}{0}{9}{% \pxhy@rshift{0/20523,10}% }{\pxhy@numeral{#1}\UTF{00D7}}% } %%<!> \ajSlanted[*]{<number>} -\pxhy@DeclareMacroVar{Slanted}#1{%N +\pxhy@DeclareCCMacroVar{Slanted}#1{%N \pxhy@fallback{0}{0}{59}{% \pxhy@rshift{0/9460,10/20589,60}% }{\pxhy@numeral{#1}}% @@ -459,7 +504,7 @@ } %%<!> \ajApostrophe{<number>} %%<!> \ajYear{<number>} (alias) -\pxhy@DeclareMacro{Apostrophe}#1{% +\pxhy@DeclareCCMacro{Apostrophe}#1{% \pxhy@fallback{0}{0}{99}{% \pxhy@rshift{0/20649,100}% }{\UTF{2019}\pxhy@two@digits{#1}}% @@ -467,13 +512,15 @@ \pxhy@DeclareAlias{Year}{Apostrophe} %%<!> \ajSquareMark[*]{<number>} % Note: +-variant is unsupported. -\pxhy@DeclareMacroVar{SquareMark}#1{%N +\pxhy@DeclareCCMacroVar{SquareMark}#1{%N \pxhy@rshift{1/12229,13}% }{%V \pxhy@rshift{1/12241,10}% } %%<!> \ajHishi{<number>} -\pxhy@DeclareMacro{Hishi}#1{\pxhy@rshift{1/12256,5}} +\pxhy@DeclareCCMacro{Hishi}#1{\pxhy@rshift{1/12256,5}} + +\pxhy@finish@declare@cc@macros %----------------------- diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty index 2d730c51511..e64fa701cb4 100644 --- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty +++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty @@ -1,7 +1,7 @@ %% %% This is file 'pxjahyper-enc.sty'. %% -%% Copyright (c) 2012-2023 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2012-2024 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxjahyper-enc}[2023/03/01 v1.3] +\ProvidesPackage{pxjahyper-enc}[2024/08/25 v1.5] \def\pxhe@pkgname{pxjahyper-enc} \providecommand{\bxDebug}[1]{} diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-uni.def b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-uni.def index 4ce0174a9e2..88ea2241c0c 100644 --- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-uni.def +++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-uni.def @@ -1,7 +1,7 @@ %% %% This is file 'pxjahyper-uni.def'. %% -%% Copyright (c) 2012-2023 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2012-2024 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesFile{pxjahyper-uni.def}[2023/03/01 v1.3] +\ProvidesFile{pxjahyper-uni.def}[2024/08/25 v1.5] \providecommand{\bxDebug}[1]{} %--------------------------------------- environment check diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty index 9c3652b29f1..8be4a409e80 100644 --- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty +++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty @@ -1,7 +1,7 @@ %% %% This is file 'pxjahyper.sty'. %% -%% Copyright (c) 2012-2023 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2012-2024 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxjahyper}[2023/03/01 v1.3] +\ProvidesPackage{pxjahyper}[2024/08/25 v1.5] \def\pxhy@pkgname{pxjahyper} \providecommand{\bxDebug}[1]{} @@ -51,16 +51,21 @@ \newif\ifpxhy@otfmacros \newif\ifpxhy@Uchar@avail \newif\ifpxhy@ucs@avail +\newif\ifpxhy@toucs@avail \let\pxhy@jsclasses@name\relax \newif\ifpxhy@jlreq@cls \newif\ifpxhy@fallback@geta +\newif\ifpxhy@fallback@warn +\newif\ifpxhy@fallback@cidm \newif\ifpxhy@extjis@map \newif\ifpxhy@extjis@use \newif\ifpxhy@ajhankaku@chars %%<*> \pxjahypersetup{<key>=<value>,...} -\newcommand*\pxjahypersetup{% - \setkeys{\pxhy@pkgname}% +\@ifdefinable\pxjahypersetup{% + \DeclareRobustCommand*\pxjahypersetup{% + \setkeys{\pxhy@pkgname}% + }% } %% \pxhy@handle@key{<key>}{<value>}{<name>} \def\pxhy@handle@key#1#2#3{% @@ -91,7 +96,7 @@ \DeclareOption{resetdvidriver}{% \let\pxhy@driver\@undefined } -\DeclareOption{autodvidriver}{% +\DeclareOption{autodvidriver}{% DEPRECATED \let\pxhy@driver\@undefined } \DeclareOption{auto}{% DEPRECATED @@ -171,14 +176,15 @@ \DeclareOption{nootfmacros}{% \pxhy@otfmacrosfalse } -\DeclareOption{fallback-geta}{% +\DeclareOption{fallback-geta}{% DEPRECATED \pxjahypersetup{fallback=geta}% } -\DeclareOption{fallback-delete}{% +\DeclareOption{fallback-delete}{% DEPRECATED \pxjahypersetup{fallback=delete}% } -\DeclareOption{force-unicode}{% - \let\pxhy@force@unicode=t +\DeclareOption{force-unicode}{% DEPRECATED + \PackageWarningNoLine\pxhy@pkgname + {'force-unicode' is DEPRECATED and ignored}% } \DeclareOption{disable-Ux}{% for debug \let\pxhy@disable@Ux=t @@ -194,6 +200,16 @@ } \let\pxhy@kv@fallback@@geta\pxhy@fallback@getatrue \let\pxhy@kv@fallback@@delete\pxhy@fallback@getafalse +% 'fallback-warn=<bool>' +\pxhy@fallback@warntrue +\define@key{\pxhy@pkgname}{fallback-warn}[true]{% + \pxhy@handle@key{fallback-warn}{#1}{fallback@warn#1}% +} +% 'fallback-cidm=<bool>' +\pxhy@fallback@cidmtrue +\define@key{\pxhy@pkgname}{fallback-cidm}[true]{% + \pxhy@handle@key{fallback-cidm}{#1}{fallback@cidm#1}% +} % 'extjis=<bool>' \pxhy@extjis@usetrue \define@key{\pxhy@pkgname}{extjis}[true]{% @@ -289,6 +305,8 @@ \pxhy@check\Uchar{\pxhy@Uchar@availtrue} %% pxhy@ucs@avail switch \pxhy@check\ucs{\pxhy@ucs@availtrue} +%% pxhy@toucs@avail switch +\pxhy@check\toucs{\pxhy@toucs@availtrue} %% pxhy@extjis@map switch % Note that 'tounicode' is necessary. @@ -311,6 +329,8 @@ \@ifl@t@r\fmtversion{2021/11/15}{% \chardef\pxhy@hook@system=2 }{\@ifl@t@r\fmtversion{2020/02/02}{% + % NB. We need to support this intermediate version, because + % the hook order matters here. \chardef\pxhy@hook@system=1 }{}} @@ -328,16 +348,25 @@ \pxhy@uniescapetrue \fi\fi -% hyperref 'unicode' is allowed only on upLaTeX. -\ifnum0\ifpxhy@hy@unicode\ifpxhy@uptex\else - \ifx t\pxhy@force@unicode\else1\fi\fi\fi>\z@ -% \PackageWarningNoLine\pxhy@pkgname -% {The support for the hyperref 'unicode' mode\MessageBreak -% on the pTeX engine is currently experimental}% -\fi +%% \pxhy@if@really@unicode{<true>}{<false>} +% Tests if hyperref unicode-mode is *currently* in effect. +% (Assuming unicode-mode is enabled by the settings.) +\let\pxhy@if@really@unicode\@undefined + +% hyperref 'unicode' mode \ifpxhy@hy@unicode \pxhy@uniescapefalse %\pxhy@otfutftrue + % placed at the top of the hook + \AtEndOfPackage{\ltx@GlobalPrependToMacro\pdfstringdefPreHook{% + \ifx\ifpdfstringunicode\@undefined + \ifHy@unicode \let\pxhy@if@really@unicode\@firstoftwo + \else \let\pxhy@if@really@unicode\@secondoftwo + \fi + \else % '\ifpdfstringunicode' is provided by hyperref + \let\pxhy@if@really@unicode\ifpdfstringunicode + \fi + }} \fi % otfcid requrires otfutf. \ifpxhy@otfutf \else \ifpxhy@otfcid @@ -429,8 +458,7 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \fi %% \pxhy@geta : GETA MARK -\pxhy@get@jchar{\jis"222E} -\let\pxhy@geta\pxhy@jchar +\pxhy@let@jchar@jc\pxhy@geta{222E} %% \pxhy@print@geta \def\pxhy@print@geta{% @@ -472,12 +500,42 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi } +%% \pxhy@ifempty{<text>}{<true>}{<false>} +\def\pxhy@ifempty#1{% + \pxhy@cond\ifx\pxhy@mt#1\pxhy@mt\fi +} + +%% \pxhy@E\newrobustcmd*\CS... +% Does \newrobustcmd* if etoolbox is available; +% does \DeclareRobustCommand* otherwise. +\def\pxhy@E\newrobustcmd*#1{% + \def\pxhy@next{\providecommand*\pxhy@next}% + \@ifdefinable#1{\def\pxhy@next{\DeclareRobustCommand*#1}}% + \pxhy@next +} + +%% \pxhy@read@num{<text>}\CScont +\def\pxhy@read@num#1{% + \expandafter\pxhy@read@num@a\number#1\pxhy@mk#1\pxhy@mk#1\pxhy@mk +} +\def\pxhy@read@num@a#1#2\pxhy@mk{% + \expandafter\pxhy@read@num@b\romannumeral\if-#1\else-\fi +} +\def\pxhy@read@num@b#1\pxhy@mk#2\pxhy@mk{% + \expandafter\pxhy@read@num@c\number\pxhy@ifempty{#1}{#2}{}\pxhy@mk +} +\def\pxhy@read@num@c#1\pxhy@mk#2{% + \pxhy@cond\ifnum#1<\z@\fi{#2{0}}{#2{#1}}% +} + %--------------------------------------- Helpers (e-TeX) \ifpxhy@etex %% packages \ifpxhy@etoolbox \RequirePackage{etoolbox}[2011/01/03]%v2.1 + \robustify\pxjahypersetup + \let\pxhy@E\relax \fi %% \pxhy@if@star{<varient>}{<normal>} @@ -709,7 +767,7 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \pxhy@cond \ifpxhy@utfXVI \fi{% \pxhy@uchex@big#1"000000\pxhy@end }{%else - \pxhy@uchex@out{#1}% + \pxhy@uchex@out@pre{#1}% }% }{%else \pxhy@uchex@small#1"0000\pxhy@end @@ -719,7 +777,7 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \pxhy@uchex@small@a#1#2#3#4#5\pxhy@end } \def\pxhy@uchex@small@a#1"#2\pxhy@end{% - \pxhy@uchex@out{#2#1}% + \pxhy@uchex@out@pre{#2#1}% } \def\pxhy@uchex@big#1#2#3#4#5#6#7#8\pxhy@end{% \pxhy@uchex@big@a#1#2#3#4#5#6#7\pxhy@end @@ -741,18 +799,93 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \csname pxhy@qh/3#6\endcsname } \def\pxhy@uchex@big@d#1#2#3#4#5\pxhy@end{% - \pxhy@uchex@out{D#1#2#3}% - \pxhy@uchex@out{D#4#5}% + \pxhy@uchex@out@pre{D#1#2#3}% + \pxhy@uchex@out@pre{D#4#5}% } \edef\pxhy@uchex@error{% - \noexpand\pxhy@uchex@out{\pxhy@uc@REPL}% + \noexpand\pxhy@uchex@out@pre{\pxhy@uc@REPL}% +} +\def\pxhy@uchex@out@pre#1{% + \pxhy@if@in@anchor{% then Unicode does not work + \pxjahyperBadCharacter{U+#1}% + }{%else + \pxhy@uchex@out{#1}% + }% +} + +%--------------------------------------- Unavailable characters + +%%<+> \pxjahyperBadCharacter{<label>} +\newcommand*\pxjahyperBadCharacter[1]{% + \pxhy@if@in@anchor{% + #1;% label is output as-is + }{%else + \ifpxhy@fallback@warn + % issue a warning + \pxhy@bad@character@a{#1}% + \fi + \pxhy@print@geta + }% +} +\def\pxhy@bad@character@a#1{% + % Here the control sequence with name <label> is supposed to be + % undefined. This token is intentionally left in the stream. + % Then this unknown token will be detected by the hyperref process + % and cause it to issue an warning + % "Token not allowed in a PDF string (... removing `\<label>'". + \expandafter\ifx\csname<#1>\endcsname\relax + \csname<#1>\endcsname + % If the token should be defined, it is replaced for safety. + \else \csname pxhy@<#1>\endcsname + \fi +} + +%% \pxhy@fallback@num{<prefix>}<fast>{<number>} +% Makes a bad character with label '<prefix><number>', after parsing +% the given number input. +\def\pxhy@fallback@num#1#2#3{% + \if \ifpxhy@fallback@warn T\else \pxhy@if@in@anchor{T}{F}\fi T% + \if t#2% + \expandafter\pxhy@fallback@num@a\expandafter{\number#3}{#1}% + \else + \pxhy@read@num{#3}\pxhy@fallback@num@a{#1}% + \fi + \else + \pxjahyperBadCharacter{}% + \fi } +\def\pxhy@fallback@num@a#1#2{% + \pxjahyperBadCharacter{#2#1}% +} + +%--------------------------------------- Stuffs for anchor strings + +% Sometimes \pdfstringdef is invoked to form anchor strings. +% There "unicode-mode" of hyperref is temporarily disabled; +% moreover, ToUnicode specials are not applied to such strings. +% Consequently, only ASCII characters can be used there. +% Anchor strings are for identification and not presentation; +% so special fallback for special characters are needed. + +%% \pxhy@if@in@anchor{<true>}{<false>} +% Tests if we are inside anchors. +\let\pxhy@if@in@anchor\@secondoftwo +\ifx\Hy@PageAnchorSlide\@undefined\else + % We resort to some heuristics.... + \g@addto@macro\Hy@PageAnchorSlide{% + \let\pxhy@if@in@anchor\@firstoftwo + } +\fi %--------------------------------------- Hooks to pdfstringdef %% variables \let\pxhy@str\relax +%%<+> \Ux{<hex>} +% (This is a dummy declaration.) +\ifodd\z@ \providecommand*\Ux[1]{} \fi + %% \pxhy@Ux % The definition of \Ux in PDF strings. \let\pxhy@Ux\@undefined @@ -760,16 +893,22 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \ifpxhy@hy@unicode %<*unicode> %% \pxhy@Ux + % In hyperref "unicode" mode, \unichar is used. \def\pxhy@Ux{\pxhy@uchex}% \pxhy@utfXVIfalse \def\pxhy@uchex@out#1{% - \unichar{"#1}% + \pxhy@if@really@unicode{% + \unichar{"#1}% + }{%else % something wrong! + \pxjahyperBadCharacter{U+#1}% + }% } \else\ifpxhy@Uchar@avail %<*Uchar> \ifpxhy@uptex %% \pxhy@Ux + % On upTeX with \Uchar, \Uchar is used. \def\pxhy@Ux{\pxhy@uchex} \pxhy@utfXVIfalse \def\pxhy@uchex@out#1{\Uchar"#1 } @@ -777,29 +916,31 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \else\ifpxhy@ucs@avail %% \pxhy@Ux + % On pTeX with \Uchar and \ucs, we convert the Unicode value to + % an internal-code value (using \ucs) and apply \Uchar to it. \def\pxhy@Ux{\pxhy@uchex} \pxhy@utfXVIfalse \def\pxhy@uchex@out#1{% \expandafter\pxhy@uchex@out@a\ucs"#1\pxhy@mk{#1}% } \chardef\pxhy@max@asc="7F - \def\pxhy@uchex@out@a#1\pxhy@mk#2{% - \ifnum#1<\z@ - \ifnum"#2>\pxhy@max@asc + \def\pxhy@uchex@out@a#1\pxhy@mk#2{% #1:internal #2:Unicode + \ifnum#1<\z@ % not in internal (or JIS) + \ifnum"#2>\pxhy@max@asc % not ASCII \ifpxhy@extjis@use + % try special conversion \expandafter\pxhy@uchex@out@b\csname pxhy@uc/\number"#2\endcsname{#2}% \else \pxhy@uchex@out@b\relax{#2}% \fi - \else \Uchar"#2 + \else \Uchar"#2 % ASCII \fi - \else \Uchar#1 + \else \Uchar#1 % in internal-code \fi } - \def\pxhy@uchex@out@b#1#2{% - \ifx#1\relax - \@nameuse{U+#2}% - \pxhy@print@geta + \def\pxhy@uchex@out@b#1#2{% #2:Unicode + \ifx#1\relax % not supported + \pxjahyperBadCharacter{U+#2}% \else #1% \fi } @@ -808,6 +949,9 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \else\ifpxhy@uptex %<*upTeX> %% \pxhy@Ux + % On upTeX without \Uchar, we convert the Unicode value to a ja-char + % token using \pxhy@get@jchar, which is not fully expandable. + % So we need \pdfstringdefPostHook. \def\pxhy@Ux{\pxhy@uchex}% \pxhy@utfXVIfalse @@ -912,7 +1056,7 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \fi %--------------------------------------- Fix for high-byte protection -\ifpxhy@etex +\ifpxhy@hy@unicode\else \ifpxhy@etex \begingroup % Check for high-byte protection. \catcode"EF=\active \catcode`\^=7 @@ -949,7 +1093,7 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \fi \endgroup -\fi +\fi\fi %--------------------------------------- Support for 'otfutf' \ifpxhy@otfutf @@ -960,8 +1104,7 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \def\pxhy@UTF{\pxhy@uchex} \pxhy@utfXVIfalse \def\pxhy@uchex@out#1{% - \@nameuse{U+#1}% issue a warning - \pxhy@print@geta + \pxjahyperBadCharacter{U+#1}% } \else \let\pxhy@UTF\pxhy@Ux @@ -999,26 +1142,22 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% %% \pxhy@CID{<cid>} \def\pxhy@CID#1{% - \expandafter\expandafter\expandafter\pxhy@cid@aux - \bxjaCidToUcsHex{#1}\pxhy@mk{\pxhy@xdetokenize{#1}}% + \pxhy@triexpandafter\pxhy@cid@aux\bxjaCidToUcsHex{#1}@f{#1}% } %% \pxhy@fast@CID{<cid>} \def\pxhy@fast@CID#1{% - \expandafter\expandafter\expandafter\pxhy@cid@aux - \bxjaFastCidToUcsHex{#1}\pxhy@mk{\number#1}% + \pxhy@triexpandafter\pxhy@cid@aux\bxjaFastCidToUcsHex{#1}@t{#1}% } \ifx\pxhy@Ux\@undefined - \def\pxhy@cid@aux#1\pxhy@mk#2{% - \@nameuse{CID+#2}% issue a warning - \pxhy@print@geta + \def\pxhy@cid@aux#1@#2#3{% + \pxhy@fallback@num{CID+}#2{#3}% } \else -\def\pxhy@cid@aux#1\pxhy@mk#2{% +\def\pxhy@cid@aux#1@#2#3{% \ifnum"#1>\z@ \pxhy@Ux{#1}% \else - \@nameuse{CID+#2}% - \pxhy@print@geta + \pxhy@fallback@num{CID+}#2{#3}% \fi } \fi @@ -1059,11 +1198,30 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% \fi } +%% \pxhy@CIDC{<cid>} / \pxhy@CIDK{<cid>} / \pxhy@CIDT{<cid>} +\def\pxhy@CIDC{\pxhy@fallback@num{CIDC+}f} +\def\pxhy@CIDK{\pxhy@fallback@num{CIDK+}f} +\def\pxhy@CIDT{\pxhy@fallback@num{CIDT+}f} + +%% \pxhy@dispatch@fallback@cidm +\@onlypreamble\pxhy@dispatch@fallback@cidm +\def\pxhy@dispatch@fallback@cidm{% + \global\let\pxhy@dispatch@fallback@cidm\relax + \ltx@GlobalPrependToMacro\pdfstringdefPreHook{% + \ifpxhy@fallback@cidm + \let\CIDC\pxhy@CIDC + \let\CIDK\pxhy@CIDK + \let\CIDT\pxhy@CIDT + \fi + }% +} + %% enable hooks \pxhy@hook@after@package{otf}{\pxhy@dispatch@otfcid} \ifpxhy@otfmacros \pxhy@hook@after@package{ajmacros}{\pxhy@dispatch@otfmacros} \fi +\pxhy@hook@after@package{mlcid}{\pxhy@dispatch@fallback@cidm} \fi %--------------------------------------- Extended JIS mapping @@ -1160,7 +1318,8 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% %%<+> \pxDeclarePdfTextCommand{\CS}{<jis>}{<ucs>} \@onlypreamble\pxDeclarePdfTextCommand -\newcommand*\pxDeclarePdfTextCommand[3]{% +\pxhy@E\newrobustcmd*\pxDeclarePdfTextCommand[3]{% + \pxhy@prepare@txtcmd#1% \pxhy@decl@pdf@tc{#2}{#3}% {\DeclareTextCommand{#1}{\pxhy@pdfenc}}% {\pxhy@revoke@pdf@tc{#1}}% @@ -1168,7 +1327,8 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% %%<+> \pxDeclarePdfTextComposite{\CS}{<arg>}{<jis>}{<ucs>} \@onlypreamble\pxDeclarePdfTextComposite -\newcommand*\pxDeclarePdfTextComposite[4]{% +\pxhy@E\newrobustcmd*\pxDeclarePdfTextComposite[4]{% + \pxhy@prepare@txtcmd#1% \pxhy@decl@pdf@tc{#3}{#4}% {\DeclareTextCompositeCommand{#1}{\pxhy@pdfenc}{#2}}% {\pxhy@revoke@pdf@tcc{#1}{#2}}% @@ -1202,8 +1362,8 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% %% \pxhy@decl@pdf@tc \@onlypreamble\pxhy@decl@pdf@tc \def\pxhy@decl@pdf@tc#1#2{% - \edef\pxhy@next{{#1}{\ifx\pxhy@mt#2\pxhy@mt FFFD\else#2\fi}}% - \expandafter\pxhy@get@body\pxhy@next + \edef\pxhy@next{{#1}{#2}}% + \uppercase\expandafter{\expandafter\pxhy@get@body\pxhy@next}% \ifx\pxhy@body\@undefined \let\pxhy@next\@secondoftwo \else @@ -1217,21 +1377,60 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% #2{#1}% } +%% \pxhy@prepare@txtcmd\CS +% If \CS is defined and not an encoding-aware command, +% let \[?\CS] be equivalent to \CS, so that doing +% \DeclareTextCommand\CS... will keep the original meaning of \CS. +\@onlypreamble\pxhy@prepare@txtcmd +\def\pxhy@next#1#2\pxhy@end{%#1='\',#2='cmd' + \def\pxhy@prepare@txtcmd##1{% + \ifx##1\@undefined\else + \def\pxhy@tmpb{\pxhy@prepare@txtcmd@c##1}% + \expandafter\pxhy@prepare@txtcmd@a\meaning##1{}->#1 \pxhy@end + \fi + }% + \def\pxhy@prepare@txtcmd@a##1->#1##2 ##3\pxhy@end{% + \pxhy@prepare@txtcmd@b##2_{}-#2_\pxhy@end + }% + \def\pxhy@prepare@txtcmd@b##1-#2_##2\pxhy@end{% + % if not an encoding-aware command... + \ifx\pxhy@mt##2\pxhy@mt \pxhy@tmpb \fi + }% +}\expandafter\pxhy@next\string\cmd\pxhy@end +\def\pxhy@prepare@txtcmd@c#1{% + \expandafter\let\csname?\string#1\endcsname#1% +} + %% \pxhy@get@body{<jis>}{<ucs>} \@onlypreamble\pxhy@get@body +\@onlypreamble\pxhy@get@body@a +\def\pxhy@get@body#1#2{% + \edef\pxhy@next{% + {\ifx\pxhy@mt#1\pxhy@mt -1\else \jis"#1\fi}% + {\ifx\pxhy@mt#2\pxhy@mt + \ifx\pxhy@mt#1\pxhy@mt -1% + \else\ifpxhy@uptex \jis"#1% + \else\ifpxhy@toucs@avail \toucs\jis"#1% + \else -1\fi\fi\fi + \else \number"#2% + \fi}}% + \expandafter\pxhy@get@body@a\pxhy@next +} \ifpxhy@uptex %<*upTeX> - \def\pxhy@get@body#1#2{% - \pxhy@get@jchar{\ucs"#2}% + \def\pxhy@get@body@a#1#2{% + \pxhy@get@jchar{\ifnum#2<\z@ "FFFD\else#2\fi}% \let\pxhy@body\pxhy@jchar }% \else\ifpxhy@hy@unicode %<*unicode> - \def\pxhy@get@body#1#2{% - \def\pxhy@body{\unichar{"#2}}% + \def\pxhy@get@body@a#1#2{% + \edef\pxhy@body{% + \noexpand\unichar{\ifnum#2<\z@ "FFFD\else#2\fi}}% }% \else\ifpxhy@uniescape %<*uniescape> \def\pxhy@get@body#1#2{% \ifx\pxhy@mt#1\pxhy@mt - \def\pxhy@body{\0x#2}% + \edef\pxhy@body{\noexpand\0x% + \ifx\pxhy@mt#2\pxhy@mt FFFD\else#2\fi}% \else \pxhy@get@jchar{\jis"#1}% \let\pxhy@body\pxhy@jchar @@ -1239,14 +1438,14 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% }% \else %<*!> \chardef\pxhy@cc@jis@only=1 - \def\pxhy@get@body#1#2{% - \ifx\pxhy@mt#1\pxhy@mt - \let\pxhy@body\@undefined - \else - \pxhy@get@jchar{\jis"#1}% - \let\pxhy@body\pxhy@jchar - \fi - }% + \def\pxhy@get@body@a#1#2{% + \ifnum#1<\z@ + \let\pxhy@body\@undefined + \else + \pxhy@get@jchar{#1}% + \let\pxhy@body\pxhy@jchar + \fi + }% \fi\fi\fi %</> %%%%%%%%%%%%%%%%%%%% the definitions @@ -1695,14 +1894,14 @@ pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J% %% register to 'disable' list \ltx@GlobalPrependToMacro\pdfstringdefPreHook{\pxhy@disable@tc@commands} -\else %<*!textcmd> +\else %<*!charcmds> \@onlypreamble\pxDeclarePdfTextCommand \newcommand*\pxDeclarePdfTextCommand[3]{} \@onlypreamble\pxDeclarePdfTextComposite \newcommand*\pxDeclarePdfTextComposite[4]{} -\fi %</textcmd> +\fi %</charcmds> %--------------------------------------- Enable hyperref unicode \ifpxhy@hy@unicode |