summaryrefslogtreecommitdiff
path: root/language/japanese/pxjahyper/pxjahyper.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-07 03:00:49 +0000
committerNorbert Preining <norbert@preining.info>2020-10-07 03:00:49 +0000
commit6a2f87148a137f5014278229a8175b7babf238cf (patch)
tree9dcfc63f084f80d07d68442a837f468630f71b98 /language/japanese/pxjahyper/pxjahyper.sty
parent2884d8fdd76b2def1d759c76c03141710c219ad7 (diff)
CTAN sync 202010070300
Diffstat (limited to 'language/japanese/pxjahyper/pxjahyper.sty')
-rw-r--r--language/japanese/pxjahyper/pxjahyper.sty63
1 files changed, 43 insertions, 20 deletions
diff --git a/language/japanese/pxjahyper/pxjahyper.sty b/language/japanese/pxjahyper/pxjahyper.sty
index 120cc9697e..0a79f7fe03 100644
--- a/language/japanese/pxjahyper/pxjahyper.sty
+++ b/language/japanese/pxjahyper/pxjahyper.sty
@@ -10,7 +10,7 @@
%% package declaration
\NeedsTeXFormat{pLaTeX2e}
-\ProvidesPackage{pxjahyper}[2020/09/27 v0.5a]
+\ProvidesPackage{pxjahyper}[2020/10/05 v0.6-pre]
%% error messages
\def\pxhy@pkgname{pxjahyper}
@@ -25,7 +25,6 @@
\providecommand{\bxDebug}[1]{}
%% packages
-\RequirePackage{atbegshi}
\RequirePackage{ltxcmds}[2011/08/22]% v1.21
%% globals
@@ -33,6 +32,7 @@
\newif\ifpxhy@uptex
\newif\ifpxhy@etex
\newif\ifpxhy@etoolbox
+\newif\ifpxhy@new@hook@system
\let\pxhy@jcode\@undefined
\newif\ifpxhy@tounicode
\newif\ifpxhy@zerox
@@ -102,8 +102,10 @@
\DeclareOption{nootfcid}{%
\pxhy@otfcidfalse
}
+\pxhy@otfmacrostrue
\DeclareOption{otfmacros}{%
\pxhy@otfmacrostrue
+ \let\pxhy@otfcid@given=t
}
\DeclareOption{nootfmacros}{%
\pxhy@otfmacrosfalse
@@ -168,6 +170,9 @@
\expandafter\endinput
\fi
+%% Check for the new hook system.
+\@ifl@t@r\fmtversion{2020/10/01}{\pxhy@new@hook@systemtrue}{}
+
%% Check the internal jcode.
\ifnum \jis"2121="8140
\let\pxhy@jcode=s\relax
@@ -215,7 +220,6 @@
\fi
% otfmacros forces use of otfcid.
\ifpxhy@otfmacros
- \let\pxhy@otfcid@given=t
\pxhy@otfcidtrue
\fi
% otfcid requires upTeX or out2uni.
@@ -228,16 +232,17 @@
\fi
\fi\fi
-\iffalse
-\typeout{%
+\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@new@hook@system = \ifpxhy@new@hook@system true\else false\fi^^J%
pxhy@jcode = \meaning\pxhy@jcode^^J%
pxhy@tounicode = \ifpxhy@tounicode true\else false\fi^^J%
pxhy@zerox = \ifpxhy@zerox true\else false\fi^^J%
pxhy@driver = \the\pxhy@driver^^J%
}
-\fi
%--------------------------------------- Helpers
@@ -246,20 +251,35 @@ pxhy@driver = \the\pxhy@driver^^J%
\let\pxhy@mk\indent % unexpandable
%% \pxhy@out@special{<text>}
-\ifx\AddToHook\@undefined %------- without hook system
\def\pxhy@out@special#1{%
+ \edef\pxhy@tmpa{%
+ \noexpand\pxhy@begin@dvi@enc@hook{\special{#1}}%
+ }\pxhy@tmpa
+}
+
+%% \pxhy@begin@dvi@hook{<text>}
+%% \pxhy@begin@dvi@enc@hook{<text>}
+\ifpxhy@new@hook@system
+ \def\pxhy@begin@dvi@hook#1{%
+ \AddToHook{shipout/firstpage}{#1}%
+ }
+ \DeclareHookRule{shipout/firstpage}{.}{>}{hyperref}
+ \def\pxhy@begin@dvi@enc@hook#1{% only once
+ \AddToHook{shipout/firstpage}[./enc]{#1}%
+ \DeclareHookRule{shipout/firstpage}{./enc}{<}{hyperref}%
+ }
+\else
+ \RequirePackage{atbegshi}[2011/10/05]% v1.16
+\def\pxhy@begin@dvi@enc@hook#1{%
\begingroup
- \toks\z@{\special{#1}}%
+ \toks\z@{#1}%
\toks\tw@\expandafter{\AtBegShi@HookFirst}%
\xdef\AtBegShi@HookFirst{\the\toks@\the\toks\tw@}%
\endgroup
}
-\else %------- with hook system
-\def\pxhy@out@special#1{%
- \AddToHook{shipout/firstpage}[./urgent]{\special{#1}}%
-}
-\DeclareHookRule{shipout/firstpage}{./urgent}{<}{hyperref}
-\DeclareHookRule{shipout/firstpage}{.}{>}{hyperref}
+ \def\pxhy@begin@dvi@hook#1{%
+ \AtBeginShipoutFirst{#1}%
+ }
\fi
%% \pxhy@get@jchar{<num>}
@@ -311,6 +331,10 @@ pxhy@driver = \the\pxhy@driver^^J%
\ifnum\pxhy@driver=\pxhy@driver@dvipdfmx %<*dvipdfmx>
%% dvipdfmx
+ \IfFileExists{pxjahyper-enc.sty}{% FIXME: TRANSIENT CODE
+ \RequirePackage{pxjahyper-enc}[]%
+ \ifpxhy@bigcode\else \suppressbigcode \fi
+ }{%else
\if e\pxhy@jcode % euc
\pxhy@out@special{pdf:tounicode EUC-UCS2}
\else\if s\pxhy@jcode % sjis
@@ -320,6 +344,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\else
\pxhy@out@special{pdf:tounicode UTF8-UCS2}
\fi\fi\fi
+ }%
\fi %</dvipdfmx>
\fi
@@ -345,12 +370,10 @@ pxhy@driver = \the\pxhy@driver^^J%
\expandafter\pxhy@next\the\@tempcnta\relax
\paperwidth=\pxhy@tmpa\paperwidth
\paperheight=\pxhy@tmpa\paperheight
- \xdef\pxhy@spec@papersize{%
- papersize=\the\paperwidth,\the\paperheight
- }%
- \AtBeginShipoutFirst{%
- \special{\pxhy@spec@papersize}%
- }
+ \edef\pxhy@tmpa{%
+ \noexpand\pxhy@begin@dvi@hook{%
+ \special{papersize=\the\paperwidth,\the\paperheight}}%
+ }\pxhy@tmpa
\endgroup
\fi\fi
\fi