summaryrefslogtreecommitdiff
path: root/language/japanese/pxjahyper/pxjahyper.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-14 03:02:26 +0000
committerNorbert Preining <norbert@preining.info>2020-06-14 03:02:26 +0000
commit893b65e5d4c0b7cb8ebbfca9ee6b090b9a4a182c (patch)
treef6b0cff2cf2f8e30ef3edbfa6c7205e588e81515 /language/japanese/pxjahyper/pxjahyper.sty
parent2d0067edb74f15b431d7a1e3a42b4f525986cef0 (diff)
CTAN sync 202006140302
Diffstat (limited to 'language/japanese/pxjahyper/pxjahyper.sty')
-rw-r--r--language/japanese/pxjahyper/pxjahyper.sty137
1 files changed, 122 insertions, 15 deletions
diff --git a/language/japanese/pxjahyper/pxjahyper.sty b/language/japanese/pxjahyper/pxjahyper.sty
index 66b070c713..4d83b2a351 100644
--- a/language/japanese/pxjahyper/pxjahyper.sty
+++ b/language/japanese/pxjahyper/pxjahyper.sty
@@ -10,7 +10,7 @@
%% package declaration
\NeedsTeXFormat{pLaTeX2e}
-\ProvidesPackage{pxjahyper}[2020/04/24 v0.4b]
+\ProvidesPackage{pxjahyper}[2020/06/13 v0.5]
%% error messages
\def\pxhy@pkgname{pxjahyper}
@@ -26,11 +26,13 @@
%% packages
\RequirePackage{atbegshi}
+\RequirePackage{ltxcmds}[2011/08/22]% v1.21
%% globals
\newif\ifpxhy@ptex
\newif\ifpxhy@uptex
\newif\ifpxhy@etex
+\newif\ifpxhy@etoolbox
\let\pxhy@jcode\@undefined
\newif\ifpxhy@tounicode
\newif\ifpxhy@zerox
@@ -41,6 +43,7 @@
\let\pxhy@driver\@undefined
\newif\ifpxhy@hy@unicode
\newif\ifpxhy@jacommentline
+\newif\ifpxhy@disablecmds
\newif\ifpxhy@otfcid
\newif\ifpxhy@otfmacros
@@ -85,6 +88,12 @@
\DeclareOption{nojacommentline}{%
\pxhy@jacommentlinefalse
}
+\DeclareOption{disablecmds}{%
+ \pxhy@disablecmdstrue
+}
+\DeclareOption{nodisablecmds}{%
+ \pxhy@disablecmdsfalse
+}
\pxhy@otfcidtrue
\DeclareOption{otfcid}{%
\pxhy@otfcidtrue
@@ -95,13 +104,12 @@
}
\DeclareOption{otfmacros}{%
\pxhy@otfmacrostrue
- \let\pxhy@otfcid@given=t
}
\DeclareOption{nootfmacros}{%
\pxhy@otfmacrosfalse
}
\ExecuteOptions{%
- auto,tounicode,noout2uni,jacommentline%
+ auto,tounicode,noout2uni,jacommentline,disablecmds%
}
\ProcessOptions*
@@ -150,7 +158,9 @@
\ifx\pxhy@tmpa\pxhy@tmpb #2\fi
}
\pxhy@check\eTeXversion{%
- \IfFileExists{etoolbox.sty}{\pxhy@etextrue}{}}
+ \pxhy@etextrue
+ \IfFileExists{etoolbox.sty}{\pxhy@etoolboxtrue}{}%
+}
\pxhy@check\kanjiskip{\pxhy@ptextrue}
\pxhy@check\forcecjktoken{\pxhy@uptextrue}
\ifpxhy@ptex\else
@@ -203,13 +213,18 @@
\pxhy@fatal{hyperref 'unicode' mode is not supported}{}%
\expandafter\endinput
\fi
+% otfmacros forces use of otfcid.
+\ifpxhy@otfmacros
+ \let\pxhy@otfcid@given=t
+ \pxhy@otfcidtrue
+\fi
% otfcid requires upTeX or out2uni.
\ifpxhy@uptex\else\ifpxhy@zerox\else
\pxhy@otfcidfalse
\ifx t\pxhy@otfcid@given
\PackageWarningNoLine\pxhy@pkgname
- {Option 'otfcid' is invalid unless upTeX is used\MessageBreak
- or 'out2uni' is specified}
+ {Option 'otfcid'/'otfmacros' is invalid\MessageBreak
+ unless upTeX is used or 'out2uni' is specified}
\fi
\fi\fi
@@ -226,11 +241,6 @@ pxhy@driver = \the\pxhy@driver^^J%
%--------------------------------------- Helpers
-%% packages
-\ifpxhy@etex
- \RequirePackage{etoolbox}[2011/01/03]%v2.1
-\fi
-
%% unique tokens
\def\pxhy@end{\pxhy@end@}
\let\pxhy@mk\indent % unexpandable
@@ -262,6 +272,32 @@ pxhy@driver = \the\pxhy@driver^^J%
\let\pxhy@forcecjktoken\relax
\fi
+%--------------------------------------- Helpers (e-TeX)
+\ifpxhy@etex
+
+%% packages
+\ifpxhy@etoolbox
+ \RequirePackage{etoolbox}[2011/01/03]%v2.1
+\fi
+
+%% \pxhy@if@star{<varient>}{<normal>}
+% Expands to <varient> if followed by *, otherwise to <normal>.
+\def\pxhy@if@star#1#2#3{% #3=next-arg
+ \expandafter\pxhy@if@star@a\expandafter @\detokenize{#3}@%
+ {#1}@*@{#2{#3}}\pxhy@mk
+}
+\def\pxhy@if@star@a#1@*@#2#3\pxhy@mk{#2}
+
+%% \pxhy@if@opt{<true>}{<false>}
+% Expands to <true>{<opt>} if followed by [<opt>], otherwise to <false>.
+\def\pxhy@if@opt#1#2#3{% #3=next-arg
+ \expandafter\pxhy@if@opt@a\expandafter @\detokenize{#3}@%
+ {\pxhy@if@opt@b{#1}}@[@{#2{#3}}\pxhy@mk%]
+}
+\def\pxhy@if@opt@a#1@[@#2#3\pxhy@mk{#2}
+\def\pxhy@if@opt@b#1#2]{#1{#2}}
+
+\fi
%--------------------------------------- Output 'tounicode' special
\ifpxhy@tounicode
@@ -445,7 +481,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\let\pxhy@otfcid@disabled\relax
%% preparation
-\ifpxhy@etex
+\ifpxhy@etoolbox
% check if bxjatoucs is available
\IfFileExists{bxjatoucs.sty}{%
\let\bxjatoucsCheckAvail=t
@@ -457,11 +493,15 @@ pxhy@driver = \the\pxhy@driver^^J%
package 'bxjatoucs' is unavailable%
}%
}{}
+\else\ifpxhy@etex
+ \def\pxhy@otfcid@disabled{%
+ package 'etoolbox' is unavailable%
+ }
\else
\def\pxhy@otfcid@disabled{%
- e-TeX extension (or 'etoolbox') is unavailable%
+ e-TeX extension is unavailable%
}
-\fi
+\fi\fi
%% annihilate the ajmacros's own pdfstring process
\ifpxhy@otfmacros\ifx\pxhy@otfcid@disabled\relax
\let\ajRedefine@ajCommands\relax
@@ -514,7 +554,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\pxhy@dispatch@otfcid
\else
\PackageWarningNoLine\pxhy@pkgname
- {Option 'otfcid' is disabled, because\MessageBreak
+ {Option 'otfcid'/'otfmacros' is disabled, because\MessageBreak
\pxhy@otfcid@disabled}%
\pxhy@otfcidfalse
\fi
@@ -1112,6 +1152,73 @@ pxhy@driver = \the\pxhy@driver^^J%
\fi
\fi
+%--------------------------------------- 'disablecmds'
+\ifpxhy@disablecmds
+
+%% \pxhy@rensuji
+\ifpxhy@etex
+ \def\pxhy@rensuji{%
+ \pxhy@if@star\pxhy@rensuji@a\pxhy@rensuji@a
+ }
+ \def\pxhy@rensuji@a{%
+ \pxhy@if@opt\@secondoftwo\@firstofone
+ }
+\else
+ \let\pxhy@rensuji\relax % freeze
+\fi
+
+%% \pxhy@ifdef@let\CSa\CSb
+\def\pxhy@ifdef@let#1#2{%
+ \ifx#1\@undefined\else
+ \let#1#2%
+ \fi
+}
+
+%% \pxhy@disable@commands
+\def\pxhy@disable@commands{%
+ % pTeX primitives
+ \let\autospacing\@empty
+ \let\autoxspacing\@empty
+ \let\inhibitglue\@empty
+ \let\noautospacing\@empty
+ \let\noautoxspacing\@empty
+ % pLaTeX core
+ \let\romanencoding\@gobble
+ \let\kanjiencoding\@gobble
+ \let\romanfamily\@gobble
+ \let\kanjifamily\@gobble
+ \let\romanseries\@gobble
+ \let\kanjiseries\@gobble
+ \let\romanshape\@gobble
+ \let\kanjishape\@gobble
+ \let\useroman\@gobblefour
+ \let\usekanji\@gobblefour
+ \let\textmc\@firstofone
+ \let\textgt\@firstofone
+ \let\mcfamily\@empty
+ \let\gtfamily\@empty
+ \let\userelfont\@empty
+ \let\<\@empty
+ % plext
+ \pxhy@ifdef@let\bou\@firstofone
+ \pxhy@ifdef@let\kasen\@firstofone
+ \pxhy@ifdef@let\rensuji\pxhy@rensuji
+ \pxhy@ifdef@let\prensuji\pxhy@rensuji
+ \pxhy@ifdef@let\Rensuji\pxhy@rensuji
+ % japanese-otf
+ \pxhy@ifdef@let\textmg\@firstofone
+ \pxhy@ifdef@let\mgfamily\@empty
+ \pxhy@ifdef@let\ltseries\@empty
+ \pxhy@ifdef@let\ebseries\@empty
+ \pxhy@ifdef@let\propshape\@empty
+}
+
+%% register to 'disable' list
+% This registration should be of lower priority than others,
+% and thus is prepended to pdfstringdefPreHook.
+\ltx@GlobalPrependToMacro\pdfstringdefPreHook{\pxhy@disable@commands}
+
+\fi
%--------------------------------------- All done
\endinput
%% EOF