From 959bfd3e34f66df3f1392701684e2b04133ed6f9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 Oct 2020 21:58:35 +0000 Subject: pxjahyper (6oct20) git-svn-id: svn://tug.org/texlive/trunk@56573 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/platex/pxjahyper/pxjahyper-ajm.def | 2 +- .../tex/platex/pxjahyper/pxjahyper-enc.sty | 147 +++++++++++++++++++++ .../texmf-dist/tex/platex/pxjahyper/pxjahyper.sty | 63 ++++++--- 3 files changed, 191 insertions(+), 21 deletions(-) create mode 100644 Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty (limited to 'Master/texmf-dist/tex/platex') diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def index 48b6e14216d..a8897d9c5ca 100644 --- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def +++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def @@ -11,7 +11,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesFile{pxjahyper-ajm.def}[2020/09/27 v0.5a] +\ProvidesFile{pxjahyper-ajm.def}[2020/10/04 v0.5b] %% avoid multiple loading \csname pxjahyperajmLoaded\endcsname diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty new file mode 100644 index 00000000000..51468dc23ca --- /dev/null +++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty @@ -0,0 +1,147 @@ +%% +%% This is file 'pxjahyper-enc.sty'. +%% +%% Copyright (c) 2012-2020 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} +\ProvidesPackage{pxjahyper-enc}[2020/10/05 v0.6-pre] +\def\pxhe@pkgname{pxjahyper-enc} +\providecommand{\bxDebug}[1]{} + +%--------------------------------------- package options + +%% variables +\let\pxhe@driver=d + +% driver options +\DeclareOption{dvipdfmx}{% + \let\pxhe@driver=d\relax +} +\DeclareOption{dvips}{% + \let\pxhe@driver=s\relax +} +\DeclareOption{nodvidriver}{% + \let\pxhe@driver=0\relax +} +% dispatch +\ProcessOptions* + +%--------------------------------------- user interface + +%% variables +\let\pxhe@bigcode=t +\let\pxhe@default@tounicode=t + +%%<*> \suppressbigcode +\@onlypreamble\suppressbigcode +\newcommand*\suppressbigcode{% + \global\let\pxhe@bigcode=f\relax +} + +%%<*> \suppressdefaulttounicode +\@onlypreamble\suppressdefaulttounicode +\newcommand*\suppressdefaulttounicode{% + \global\let\pxhe@default@tounicode=f\relax +} + +%%<+> \pxjahyperToUnicodeSpecial{} +\newcommand*\pxjahyperToUnicodeSpecial[1]{% + \edef\pxhe@tmpa{% + \noexpand\pxhe@begin@dvi@hook{\special{pdf:tounicode #1}}% + }\pxhe@tmpa +} + +%--------------------------------------- environment + +%% check +\ifx d\pxhe@driver\else + \ifx 0\pxhe@driver\else + \PackageError\pxhe@pkgname + {Bad driver option} + {Package loading is aborted right now.} + \fi + \let\pxhe@begin@dvi@hook\@gobble +\expandafter\endinput\fi\relax + +%% switch 'pxhe@new@hook@system' +\newif\ifpxhe@new@hook@system +\@ifl@t@r\fmtversion{2020/10/01}{\pxhe@new@hook@systemtrue}{} + +%% \pxhe@jcode +\ifnum \jis"2121="8140 + \let\pxhe@jcode=s\relax +\else\ifnum\jis"2121="A1A1 + \let\pxhe@jcode=e\relax +\else\ifnum\jis"2121="3000 + \let\pxhe@jcode=u\relax +\fi\fi\fi +\ifx\pxhe@jcode\@undefined + \PackageError\pxhe@pkgname + {Unknown internal kanji code} + {Package loading is aborted right now.} + \expandafter\endinput +\fi + +%--------------------------------------- begin-dvi hook (new) +\ifpxhe@new@hook@system + +%% \pxhe@hook@label +\def\pxhe@hook@label{pxjahyper/enc} + +%% \pxhe@begin@dvi@hook{} +\def\pxhe@begin@dvi@hook#1{% + \AddToHook{shipout/firstpage}[\pxhe@hook@label]{#1}% +} + +%% declare necessary rules +\DeclareHookRule{shipout/firstpage}{\pxhe@hook@label}{<}{hyperref} + +\fi +%--------------------------------------- begin-dvi hook (old) +\ifpxhe@new@hook@system\else + +%% packages +\RequirePackage{atbegshi}[2011/10/05]% v1.16 + +%% \pxhe@begin@dvi@hook{} +\def\pxhe@begin@dvi@hook#1{% + \begingroup + \toks\z@{#1}% + \toks\tw@\expandafter{\AtBegShi@HookFirst}% + \xdef\AtBegShi@HookFirst{\the\toks@\the\toks\tw@}% + \endgroup +} + +\fi +%--------------------------------------- default tounicode special + +%% \pxhe@cmap@name +\def\pxhe@cmap@name{% + \if e\pxhe@jcode % euc + EUC-UCS2% + \else\if s\pxhe@jcode % sjis + 90ms-RKSJ-UCS2% + \else\if t\pxhe@bigcode % ucs, bigcode + UTF8-UTF16% + \else % ucs, no bigcode + UTF8-UCS2% + \fi\fi\fi +} + +%% \pxhe@do@default@tounicode +\def\pxhe@do@default@tounicode{% + \if t\pxhe@default@tounicode + \special{pdf:tounicode \pxhe@cmap@name}% + \fi +} +\pxhe@begin@dvi@hook{\pxhe@do@default@tounicode} + +%--------------------------------------- done +\endinput +%% EOF diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty index 120cc9697e1..0a79f7fe03e 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}[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{} -\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{} +%% \pxhy@begin@dvi@enc@hook{} +\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{} @@ -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 % \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 -- cgit v1.2.3