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 --- .../texmf-dist/doc/platex/pxjahyper/README-ja.md | 37 ++++++ Master/texmf-dist/doc/platex/pxjahyper/README.md | 12 ++ .../texmf-dist/doc/platex/pxjahyper/pxjahyper.pdf | Bin 116718 -> 116641 bytes .../texmf-dist/doc/platex/pxjahyper/pxjahyper.tex | 9 +- .../tex/platex/pxjahyper/pxjahyper-ajm.def | 2 +- .../tex/platex/pxjahyper/pxjahyper-enc.sty | 147 +++++++++++++++++++++ .../texmf-dist/tex/platex/pxjahyper/pxjahyper.sty | 63 ++++++--- 7 files changed, 245 insertions(+), 25 deletions(-) create mode 100644 Master/texmf-dist/tex/platex/pxjahyper/pxjahyper-enc.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/platex/pxjahyper/README-ja.md b/Master/texmf-dist/doc/platex/pxjahyper/README-ja.md index 2e79a6d60cc..bacc24b43fb 100644 --- a/Master/texmf-dist/doc/platex/pxjahyper/README-ja.md +++ b/Master/texmf-dist/doc/platex/pxjahyper/README-ja.md @@ -38,9 +38,46 @@ pxjahyper パッケージ ー 本体 詳細についてはマニュアル `pxjahyper.pdf` を参照されたい。 +pxjahyper-enc パッケージ ー 文字コード設定 +------------------------------------------ + +他のパッケージの内部で読み込むために pxjahyper から機能を抜粋して作った +パッケージであり、DVI ファイル中の PDF 文字列の漢字コードを指定するため +の「tounicode special」を出力する機能のみをもつ。 + +※文書作成者は pxjahyper を読み込むことが推奨される。 + +### パッケージオプション + +※オプション無しでの読込が望ましい。一応グローバルのドライバオプション +に反応するが、これについても「ドライバ指定が dvipdfmx である場合にのみ +読み込む」のが望ましい。 + + * ドライバオプション:`dvipdfmx`/`dvips`/`nodvidriver` があり、`dvips` + はエラーになり、`nodvidriver` はパッケージの機能を無効化する。 + +### 機能 + +パッケージを読み込むと、既定動作として、エンジンの内部漢字コードに基づき +適切な「tounicode special」を出力する。 + + * `\suppressbigcode`:内部漢字コードが Unicode のときに、`UTF8-UTF16` + ではなく `UTF8-UCS2` の CMap を指定する。 + * `\suppressdefaulttounicode`:既定動作を無効にする。 + * `\pxjahyperToUnicodeSpecial{<名前>}`:引数の CMap 名を指定して + 「tounicode special」を出力する。 + + 更新履歴 -------- + * Version 0.6 〈2020/10/05〉 + - pxjahyper-enc パッケージを追加した。 + - `otfmacros` オプションを既定で有効にする。 + + * Version 0.5b 〈2020/10/04〉 + - バグ修正。 + * Version 0.5a 〈2020/09/27〉 - LaTeX カーネル 2020/10/01 版への対応。 diff --git a/Master/texmf-dist/doc/platex/pxjahyper/README.md b/Master/texmf-dist/doc/platex/pxjahyper/README.md index 5b574a4526b..c7201e43d64 100644 --- a/Master/texmf-dist/doc/platex/pxjahyper/README.md +++ b/Master/texmf-dist/doc/platex/pxjahyper/README.md @@ -39,9 +39,21 @@ The pxjahyper Package ー main Please refer to the manual `pxjahyper.pdf` (in Japanese) for detail. +The pxjahyper-enc Package ー Encoding setting +--------------------------------------------- + +This is a single-feature package excerpted from the pxjahyper package, +and is provided for internal use from other packages. + +It only issues a "tounicode special” for specifying the encoding of +the PDF strings in the output DVI file. + + Revision History ---------------- + * Version 0.6 〈2020/10/05〉 + * Version 0.5b 〈2020/10/04〉 * Version 0.5a 〈2020/09/27〉 * Version 0.5 〈2020/06/13〉 * Version 0.4b 〈2020/04/24〉 diff --git a/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.pdf b/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.pdf index 0f5ecfe408e..74f354527f6 100644 Binary files a/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.pdf and b/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.pdf differ diff --git a/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.tex b/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.tex index 06067015166..c903300952b 100644 --- a/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.tex +++ b/Master/texmf-dist/doc/platex/pxjahyper/pxjahyper.tex @@ -6,8 +6,8 @@ \MakeShortVerb{\|} \usepackage{bxtexlogo} \bxtexlogoimport{*} -\newcommand{\PkgVersion}{0.5a} -\newcommand{\PkgDate}{2020/09/27} +\newcommand{\PkgVersion}{0.6} +\newcommand{\PkgDate}{2020/10/05} \newcommand{\Pkg}[1]{\textsf{#1}} \newcommand{\Meta}[1]{$\langle$\mbox{}#1\mbox{}$\rangle$} \newcommand{\Note}{\par\noindent ※} @@ -77,7 +77,7 @@ \Note 詳細は\ref{ssec:disablecmds}節を参照。 \item |nodisablecmds|\Means |disablecmds| の否定。 -\item |otfmacros|\Means +\item |otfmacros|(既定)\Means \Pkg{japanese-otf}付属の\Pkg{ajmacros}パッケージが提供する 文字入力命令(|\ajMaru|、|\ajLig| 等)をPDF文字列中で “可能な限り”使えるようにする。 @@ -89,8 +89,9 @@ 使いたい場合は、命令の前に |\protect| 付ける必要がある。 \footnote{ちなみに、引数がPDF文字列として解釈される場合には、 |\protect| は全く結果に影響しない。} -\item |nootfmacros|(既定)\Means +\item |nootfmacros|\Means |otfmacros| の否定。 + \Note 0.6版より既定を |otfmacros| に変更した。 \item |bigcode|(既定)\Means {\upTeX}でのToUnicode CMapとして既定のUTF8-UCSの代わりに\ UTF8-UTF16を用いる。 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