summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/platex/pxbase/pxbabel.sty')
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxbabel.sty47
1 files changed, 45 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty b/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty
index 345e2c90006..1ef550c54ab 100644
--- a/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty
+++ b/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty
@@ -10,7 +10,7 @@
%% package declaration
\NeedsTeXFormat{pLaTeX2e}
-\ProvidesPackage{pxbabel}[2021/05/22 v1.2 PX Babel interface for CJK]
+\ProvidesPackage{pxbabel}[2021/05/31 v1.3 PX Babel interface for CJK]
\def\pxbb@pkgname{pxbabel}
%--------------------------------------- general
@@ -97,6 +97,9 @@
\bxIfExpToEqualX{\mcdefault}{mc}{}{\pxbb@stdjaencodingtrue}% default
\DeclareOption{stdjaencoding}{\pxbb@stdjaencodingtrue}
\DeclareOption{nostdjaencoding}{\pxbb@stdjaencodingfalse}
+\newbool{pxbb@patchutfcmds}\pxbb@patchutfcmdstrue
+\DeclareOption{patchutfcmds}{\pxbb@patchutfcmdstrue}
+\DeclareOption{nopatchutfcmds}{\pxbb@patchutfcmdsfalse}
\newbool{pxbb@forcedeluxemulti}
\DeclareOption{forcedeluxemulti}{\pxbb@forcedeluxemultitrue}
\DeclareOption{noforcedeluxemulti}{\pxbb@forcedeluxemultifalse}
@@ -127,10 +130,13 @@
%--------------------------------------- Resolving settings
+%% \ifpxbb@otf
%% \ifpxbb@otfmulti
%% \ifpxbb@pxotf
+\newbool{pxbb@otf}
\newbool{pxbb@otfmulti}
\newbool{pxbb@pxotf}
+\@ifpackageloaded{otf}{\pxbb@otftrue}{}
\@ifpackageloaded{mlutf}{\pxbb@otfmultitrue}{}
\@ifpackageloaded{pxotf}{\pxbb@otfmultitrue\pxbb@pxotftrue}{}
@@ -148,8 +154,18 @@
\ifpxbb@otfmulti\else
\ifupTeX\else
\pxbb@warn@nocjk
+ \pxbb@switchfontfalse
\fi\fi\fi
-
+% Check if 'patchutfcmds' is available.
+\if \ifpxbb@switchfont
+ \ifupTeX
+ \ifpxbb@otf
+ \ifx\patchcmd\@undefined F\else T\fi
+ \else F\fi
+ \else F\fi
+ \else F\fi F%
+ \pxbb@patchutfcmdsfalse
+\fi
% Check if 'forcedeluxemulti' is available.
\ifpxbb@forcedeluxemulti
\ifupTeX\else
@@ -521,6 +537,33 @@
\fi %----</upTeX>
+%--------------------------------------- Patch to '\UTF' etc.
+\ifpxbb@patchutfcmds
+
+%% \pxbb@set@encoding
+\edef\pxbb@set@encoding{%
+ \noexpand\iftdir \noexpand\kanjiencoding{\cy@encoding}%
+ \noexpand\else \noexpand\kanjiencoding{\ct@encoding}%
+ \noexpand\fi
+}
+
+%% apply the patch
+\@for\pxbb@tmpa:={%
+ UTF,UTFK,UTFC,UTFT,UTFM,CID,CIDK,CIDC,CIDT%
+}\do{%
+ \ifcsdef{\pxbb@tmpa\space}{%then
+ \expandafter\patchcmd\csname \pxbb@tmpa\space\endcsname{%from
+ \begingroup\edef\reserved@a
+ }{%to
+ \begingroup\pxbb@set@encoding\edef\reserved@a
+ }{}{%failure
+ \PackageWarningNoLine\pxbb@pkgname
+ {Cannot patch to '\@backslashchar\pxbb@tmpa_'}%
+ }%
+ }{}%
+}
+
+\fi
%--------------------------------------- Other user commands
%%<*> \cjklanguagename{<lang_id>}