summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty')
-rw-r--r--Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty156
1 files changed, 115 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
index 9cf9d4cacf2..772be814d49 100644
--- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
+++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
@@ -10,7 +10,7 @@
%% package declaration
\NeedsTeXFormat{pLaTeX2e}
-\ProvidesPackage{pxjahyper}[2022/04/15 v1.0a]
+\ProvidesPackage{pxjahyper}[2022/05/10 v1.1]
\def\pxhy@pkgname{pxjahyper}
\providecommand{\bxDebug}[1]{}
@@ -37,7 +37,7 @@
\newif\ifpxhy@bigcode
\let\pxhy@bigcode@given\relax
\newif\ifpxhy@papersize
-\newif\ifpxhy@textcmd
+\newif\ifpxhy@charcmds
\chardef\pxhy@driver@none=0
\chardef\pxhy@driver@dvipdfmx=1
\chardef\pxhy@driver@dvips=2
@@ -48,8 +48,11 @@
\newif\ifpxhy@otfutf
\newif\ifpxhy@otfcid
\newif\ifpxhy@otfmacros
+\newif\ifpxhy@Uchar@avail
+\newif\ifpxhy@ucs@avail
\let\pxhy@jsclasses@name\relax
\newif\ifpxhy@jlreq@cls
+\newif\ifpxhy@fallback@geta
%--------------------------------------- Package options
@@ -66,13 +69,16 @@
\DeclareOption{nodvidriver}{%
\let\pxhy@driver\pxhy@driver@none
}
+\DeclareOption{resetdvidriver}{%
+ \let\pxhy@driver\@undefined
+}
\DeclareOption{autodvidriver}{%
\let\pxhy@driver\@undefined
}
-%% modes
-\DeclareOption{auto}{%
- \let\pxhy@driver\@undefined %FIXME
+\DeclareOption{auto}{% DEPRECATED
+ \let\pxhy@driver\@undefined
}
+%% operation modes
\DeclareOption{tounicode}{%
\pxhy@tounicodetrue
}
@@ -100,6 +106,12 @@
\DeclareOption{nopapersize}{%
\pxhy@papersizefalse
}
+\DeclareOption{charcmds}{%
+ \pxhy@charcmdstrue
+}
+\DeclareOption{nocharcmds}{%
+ \pxhy@charcmdsfalse
+}
\pxhy@bigcodetrue
\DeclareOption{bigcode}{%
\pxhy@bigcodetrue
@@ -140,12 +152,22 @@
\DeclareOption{nootfmacros}{%
\pxhy@otfmacrosfalse
}
+\DeclareOption{fallback-geta}{%
+ \pxhy@fallback@getatrue
+}
+\DeclareOption{fallback-delete}{%
+ \pxhy@fallback@getafalse
+}
\DeclareOption{force-unicode}{%
\let\pxhy@force@unicode=t
}
+\DeclareOption{disable-Ux}{% for debug
+ \let\pxhy@disable@Ux=t
+}
%% dispatch
\ExecuteOptions{%
- auto,tounicode,papersize,jacommentline,disablecmds,otfutf,otfcid%
+ resetdvidriver,tounicode,papersize,charcmds,jacommentline,%
+ disablecmds,otfutf,otfcid,fallback-geta%
}
\ProcessOptions*
@@ -188,6 +210,10 @@
\ifx\Hy@driver\pxhy@tmpa
\let\pxhy@driver\pxhy@driver@dvips
\fi
+ \ifnum\pxhy@driver=\pxhy@driver@none \ifx\Hy@driver\@undefined\else
+ \PackageWarningNoLine\pxhy@pkgname
+ {Unknown hyperref driver: \Hy@driver}
+ \fi\fi
\fi
%% Check the engine.
@@ -220,6 +246,11 @@
\expandafter\endinput
\fi
+%% pxhy@Uchar@avail switch
+\pxhy@check\Uchar{\pxhy@Uchar@availtrue}
+%% pxhy@ucs@avail switch
+\pxhy@check\ucs{\pxhy@ucs@availtrue}
+
%% Check the document class.
% jlreq
\ifpxhy@etex
@@ -247,16 +278,6 @@
{bigcode is invalid without upTeX}
\fi
\fi\fi
-%% pxhy@papersize switch
-\ifnum\pxhy@driver=\pxhy@driver@none
- \pxhy@papersizefalse
-\fi
-%% pxhy@textcmd switch
-\ifnum\pxhy@driver=\pxhy@driver@none
- \pxhy@textcmdfalse
-\else
- \pxhy@textcmdtrue
-\fi
%% pxhy@uniescape switch
\ifnum\pxhy@driver=\pxhy@driver@dvips \ifx t\pxhy@nouniescape@given\else
\pxhy@uniescapetrue
@@ -271,17 +292,8 @@
\fi
\ifpxhy@hy@unicode
\pxhy@uniescapefalse
- \pxhy@otfutftrue
+ %\pxhy@otfutftrue
\fi
-% otfmacros requires upTeX or out2uni.
-\ifpxhy@uptex\else\ifpxhy@uniescape\else\ifpxhy@hy@unicode\else
- \pxhy@otfmacrosfalse
- \ifx t\pxhy@otfmacros@given
- \PackageWarningNoLine\pxhy@pkgname
- {Option 'otfmacros' is invalid\MessageBreak
- unless upTeX is used or 'out2uni' is specified}
- \fi
-\fi\fi\fi
% otfcid requrires otfutf.
\ifpxhy@otfutf \else \ifpxhy@otfcid
\PackageInfo\pxhy@pkgname
@@ -297,19 +309,31 @@
\pxhy@otfmacrosfalse
\fi\fi
+%% in nodvidriver mode
+\ifnum\pxhy@driver=\pxhy@driver@none
+ \pxhy@papersizefalse
+ \pxhy@charcmdsfalse
+\fi
+
\bxDebug{****pxjahyper env^^J%
pxhy@ptex = \ifpxhy@ptex true\else false\fi^^J%
pxhy@uptex = \ifpxhy@uptex true\else false\fi^^J%
pxhy@etex = \ifpxhy@etex true\else false\fi^^J%
pxhy@etoolbox = \ifpxhy@etoolbox true\else false\fi^^J%
pxhy@hook@system = \the\pxhy@hook@system^^J%
-ifpxhy@hy@unicode = \ifpxhy@hy@unicode true\else false\fi^^J%
-pxhy@bigcode = \ifpxhy@bigcode true\else false\fi^^J%
-pxhy@driver = \the\pxhy@driver^^J%
pxhy@tounicode = \ifpxhy@tounicode true\else false\fi^^J%
pxhy@uniescape = \ifpxhy@uniescape true\else false\fi^^J%
+pxhy@bigcode = \ifpxhy@bigcode true\else false\fi^^J%
pxhy@papersize = \ifpxhy@papersize true\else false\fi^^J%
-pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
+pxhy@charcmds = \ifpxhy@charcmds true\else false\fi^^J%
+pxhy@driver = \the\pxhy@driver^^J%
+ifpxhy@hy@unicode = \ifpxhy@hy@unicode true\else false\fi^^J%
+pxhy@jacommentline = \ifpxhy@jacommentline true\else false\fi^^J%
+pxhy@disablecmds = \ifpxhy@disablecmds true\else false\fi^^J%
+pxhy@otfutf = \ifpxhy@otfutf true\else false\fi^^J%
+pxhy@otfcid = \ifpxhy@otfcid true\else false\fi^^J%
+pxhy@otfmacros = \ifpxhy@otfmacros true\else false\fi^^J%
+pxhy@fallback@geta = \ifpxhy@fallback@geta true\else false\fi^^J%
}
%--------------------------------------- Helpers
@@ -363,6 +387,13 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\pxhy@get@jchar{\jis"222E}
\let\pxhy@geta\pxhy@jchar
+%% \pxhy@print@geta
+\ifpxhy@fallback@geta
+ \def\pxhy@print@geta{\pxhy@geta}
+\else
+ \let\pxhy@print@geta\@empty
+\fi
+
%% \pxhy@hook@after@package{<package-name>}{<code>}
\@onlypreamble\pxhy@hook@after@package
\def\pxhy@hook@after@package#1#2{%
@@ -418,6 +449,12 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\def\pxhy@if@opt@a#1@[@#2#3\pxhy@mk{#2}
\def\pxhy@if@opt@b#1#2]{#1{#2}}
+%% \pxhy@xdetokenize{<text>}
+\let\pxhy@xdetokenize\detokenize
+\pxhy@check\expanded{%
+ \def\pxhy@xdetokenize#1{\detokenize\expandafter{\expanded{#1}}}%
+}
+
\fi
%--------------------------------------- Load bxjatoucs
@@ -428,7 +465,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\let\pxhy@bxjatoucs@failure\relax
%% \pxhy@try@load@bxjatoucs
-% Tries to load bxjatoucs. If it failed, then it sets the reason
+% Tries to load bxjatoucs. If that fails, then it sets the reason
% message to \pxhy@bxjatoucs@failure.
\@onlypreamble\pxhy@try@load@bxjatoucs
\def\pxhy@try@load@bxjatoucs{%
@@ -487,7 +524,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
% When the magnification is in effect (i.e. \mag<>1000), hyperref
% emits a papersize special with wrong value. (dvipdfmx interprets
-% the lengths in the special as 'true' length.) So here a papersize
+% the lengths in the special as 'true' lengths.) So here a papersize
% special with adjusted values will be output.
\ifnum\mag=1000 \else
\expandafter\ifx\csname ifHy@setpagesize\expandafter\endcsname
@@ -677,6 +714,31 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\unichar{"#1}%
}
+\else\ifpxhy@Uchar@avail %<*Uchar>
+ \ifpxhy@uptex
+
+ %% \pxhy@Ux
+ \def\pxhy@Ux{\pxhy@uchex}
+ \pxhy@utfXVIfalse
+ \def\pxhy@uchex@out#1{\Uchar"#1 }
+
+ \else\ifpxhy@ucs@avail
+
+ %% \pxhy@Ux
+ \def\pxhy@Ux{\pxhy@uchex}
+ \pxhy@utfXVIfalse
+ \def\pxhy@uchex@out#1{%
+ \expandafter\pxhy@uchex@out@a\ucs"#1\pxhy@mk{#1}%
+ }
+ \def\pxhy@uchex@out@a#1\pxhy@mk#2{%
+ \ifnum#1<\z@
+ \@nameuse{U+#2}%
+ \pxhy@print@geta
+ \else \Uchar#1
+ \fi
+ }
+
+ \fi\fi
\else\ifpxhy@uptex %<*upTeX>
%% \pxhy@Ux
@@ -723,6 +785,11 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\expandafter\pxhy@next\pxhy@marker
%END--
+\fi\fi\fi %</>
+
+\AtEndOfPackage{%
+\ifx\pxhy@posthook\@undefined\else
+ \bxDebug{add to \string\pdfstringdefPostHook}%
% Add \pxhy@posthook to \pdfstringdefPostHook.
\begingroup
\toks@\expandafter{\pdfstringdefPostHook{#1}}
@@ -734,11 +801,12 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
}%
\pxhy@next
\endgroup
-
-\fi\fi %</>
+\fi
+}
\ifpxhy@uniescape %<*uniescape>
+ \let\pxhy@posthook\@undefined
%% \pxhy@Ux
\def\pxhy@Ux{\pxhy@uchex}%
% \pxhy@uchex converts to UTF-16
@@ -750,6 +818,12 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\fi %</uniescape>
+%% 'disable-Ux' (for debug)
+\ifx t\pxhy@disable@Ux
+ \let\pxhy@Ux\@undefined
+ \let\pxhy@posthook\@undefined
+\fi
+
%% Makes \Ux be the code input command in PDF strings.
\ifx\pxhy@Ux\@undefined\else
\pdfstringdefDisableCommands{%
@@ -782,7 +856,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\pxhy@utfXVIfalse
\def\pxhy@uchex@out#1{%
\@nameuse{U+#1}% issue a warning
- \pxhy@geta
+ \pxhy@print@geta
}
\else
\let\pxhy@UTF\pxhy@Ux
@@ -821,7 +895,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
%% \pxhy@CID{<cid>}
\def\pxhy@CID#1{%
\expandafter\expandafter\expandafter\pxhy@cid@aux
- \bxjaCidToUcsHex{#1}\pxhy@mk{\detokenize{#1}}%
+ \bxjaCidToUcsHex{#1}\pxhy@mk{\pxhy@xdetokenize{#1}}%
}
%% \pxhy@fast@CID{<cid>}
\def\pxhy@fast@CID#1{%
@@ -831,7 +905,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\ifx\pxhy@Ux\@undefined
\def\pxhy@cid@aux#1\pxhy@mk#2{%
\@nameuse{CID+#2}% issue a warning
- \pxhy@geta
+ \pxhy@print@geta
}
\else
\def\pxhy@cid@aux#1\pxhy@mk#2{%
@@ -839,7 +913,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\pxhy@Ux{#1}%
\else
\@nameuse{CID+#2}%
- \pxhy@geta
+ \pxhy@print@geta
\fi
}
\fi
@@ -894,7 +968,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\ifpxhy@hy@unicode PU\else PD1\fi
}
-\ifpxhy@textcmd %<*textcmd>
+\ifpxhy@charcmds %<*charcmds>
%%<+> \pxDeclarePdfTextCommand{\CS}{<jis>}{<ucs>}
\@onlypreamble\pxDeclarePdfTextCommand
@@ -1395,7 +1469,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
\fi %</unicode>
%%%%%%%%%%%%%%%%%%%% done
-\ifpxhy@textcmd %<*textcmd>
+\ifpxhy@charcmds %<*charcmds>
%% \pxhy@disable@tc@commands
\def\pxhy@disable@tc@commands{%
@@ -1446,7 +1520,7 @@ pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J%
%--------------------------------------- 'jacommentline'
\ifpxhy@jacommentline
-% The 'jacomemntline' feature outputs at the top of the
+% The 'jacommentline' feature outputs at the top of the
% hyperref outline file (*.out) a comment line including
% some Japanese characters.