From 4a8a25f4c6acac624cf323115db94d934b19d6b1 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 11 May 2021 03:01:31 +0000 Subject: CTAN sync 202105110301 --- language/japanese/pxjahyper/README-ja.md | 10 + language/japanese/pxjahyper/README.md | 2 + language/japanese/pxjahyper/pxjahyper-ajm.def | 7 +- language/japanese/pxjahyper/pxjahyper-enc.sty | 2 +- language/japanese/pxjahyper/pxjahyper.pdf | Bin 116446 -> 127012 bytes language/japanese/pxjahyper/pxjahyper.sty | 428 ++++++++++++++++++++------ language/japanese/pxjahyper/pxjahyper.tex | 166 +++++++--- 7 files changed, 463 insertions(+), 152 deletions(-) (limited to 'language/japanese') diff --git a/language/japanese/pxjahyper/README-ja.md b/language/japanese/pxjahyper/README-ja.md index 2cdec2a99d..14c1a44e1c 100644 --- a/language/japanese/pxjahyper/README-ja.md +++ b/language/japanese/pxjahyper/README-ja.md @@ -70,6 +70,16 @@ pxjahyper-enc パッケージ ー 文字コード設定 更新履歴 -------- + * Version 0.9a 〈2021/05/11〉 + - バグ修正。 + + * Version 0.9 〈2021/05/10〉 + - パッケージオプションの整理:`(no)papersize`、`convbkmk`、 + `(no)otfutf` を追加。 + - out2uni のエスケープ出力で UTF-16 を正しく扱う。 + - pLaTeX で tounicode 前提の動作をするときに、`\Ux` 等の Unicode + 符号入力についてフォールバック(ゲタ文字出力)を行う。 + * Version 0.8 〈2021/05/05〉 - japanese-otf パッケージに対する実行のタイミングをパッケージ読込 の直後に変更した。 diff --git a/language/japanese/pxjahyper/README.md b/language/japanese/pxjahyper/README.md index 280544dfc6..439a0629b1 100644 --- a/language/japanese/pxjahyper/README.md +++ b/language/japanese/pxjahyper/README.md @@ -52,6 +52,8 @@ the PDF strings in the output DVI file. Revision History ---------------- + * Version 0.9a 〈2021/05/11〉 + * Version 0.9 〈2021/05/10〉 * Version 0.8 〈2021/05/05〉 * Version 0.7b 〈2021/02/26〉 * Version 0.7a 〈2021/02/23〉 diff --git a/language/japanese/pxjahyper/pxjahyper-ajm.def b/language/japanese/pxjahyper/pxjahyper-ajm.def index 2ad165c9c3..60a00b1058 100644 --- a/language/japanese/pxjahyper/pxjahyper-ajm.def +++ b/language/japanese/pxjahyper/pxjahyper-ajm.def @@ -11,7 +11,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesFile{pxjahyper-ajm.def}[2021/05/05 v0.8] +\ProvidesFile{pxjahyper-ajm.def}[2021/05/11 v0.9a] %% avoid multiple loading \csname pxjahyperajmLoaded\endcsname @@ -35,11 +35,6 @@ %% \pxhy@ : the prefix \def\pxhy@{pxhy@aj@@} -%% \pxhy@cond\ifXXX...\fi{}{} -\@gobbletwo\if\if \def\pxhy@cond#1\fi{% - #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi -} - %% \pxhy@cond@both\ifXXX...\fi\ifYYY...\fi{}{} % Checks whether \ifXXX and \ifYYY both hold. \@gobbletwo\if\if\@gobbletwo\if\if \def\pxhy@cond@both#1\fi#2\fi{% diff --git a/language/japanese/pxjahyper/pxjahyper-enc.sty b/language/japanese/pxjahyper/pxjahyper-enc.sty index 7c392984b0..30fb2845b7 100644 --- a/language/japanese/pxjahyper/pxjahyper-enc.sty +++ b/language/japanese/pxjahyper/pxjahyper-enc.sty @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxjahyper-enc}[2021/05/05 v0.8] +\ProvidesPackage{pxjahyper-enc}[2021/05/11 v0.9a] \def\pxhe@pkgname{pxjahyper-enc} \providecommand{\bxDebug}[1]{} diff --git a/language/japanese/pxjahyper/pxjahyper.pdf b/language/japanese/pxjahyper/pxjahyper.pdf index 2876e23aeb..586bdacd1f 100644 Binary files a/language/japanese/pxjahyper/pxjahyper.pdf and b/language/japanese/pxjahyper/pxjahyper.pdf differ diff --git a/language/japanese/pxjahyper/pxjahyper.sty b/language/japanese/pxjahyper/pxjahyper.sty index b5d470951c..62705205c7 100644 --- a/language/japanese/pxjahyper/pxjahyper.sty +++ b/language/japanese/pxjahyper/pxjahyper.sty @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxjahyper}[2021/05/05 v0.8] +\ProvidesPackage{pxjahyper}[2021/05/11 v0.9a] \def\pxhy@pkgname{pxjahyper} \providecommand{\bxDebug}[1]{} @@ -33,35 +33,43 @@ \newif\ifpxhy@etoolbox \newif\ifpxhy@new@hook@system \newif\ifpxhy@tounicode -\newif\ifpxhy@zerox +\newif\ifpxhy@uniescape \newif\ifpxhy@bigcode \let\pxhy@bigcode@given\relax \newif\ifpxhy@papersize +\newif\ifpxhy@textcmd \chardef\pxhy@driver@none=0 \chardef\pxhy@driver@dvipdfmx=1 +\chardef\pxhy@driver@dvips=2 \let\pxhy@driver\@undefined \newif\ifpxhy@hy@unicode \newif\ifpxhy@jacommentline \newif\ifpxhy@disablecmds +\newif\ifpxhy@otfutf \newif\ifpxhy@otfcid \newif\ifpxhy@otfmacros %--------------------------------------- Package options +%% DVI drivers \DeclareOption{dvipdfmx}{% \let\pxhy@driver\pxhy@driver@dvipdfmx } \DeclareOption{dvipdfm}{% \let\pxhy@driver\pxhy@driver@dvipdfmx } +\DeclareOption{dvips}{% + \let\pxhy@driver\pxhy@driver@dvips +} \DeclareOption{nodvidriver}{% \let\pxhy@driver\pxhy@driver@none } +%% modes \DeclareOption{none}{% - \let\pxhy@driver\pxhy@driver@none + \let\pxhy@driver\pxhy@driver@none %FIXME } \DeclareOption{auto}{% - \let\pxhy@driver\@undefined + \let\pxhy@driver\@undefined %FIXME } \DeclareOption{tounicode}{% \pxhy@tounicodetrue @@ -70,11 +78,20 @@ \pxhy@tounicodefalse } \DeclareOption{out2uni}{% - \pxhy@zeroxtrue + \pxhy@uniescapetrue } \DeclareOption{noout2uni}{% - \pxhy@zeroxfalse + \pxhy@uniescapefalse + \let\pxhy@nouniescape@given=t +} +\DeclareOption{convbkmk}{% + \pxhy@uniescapetrue +} +\DeclareOption{noconvbkmk}{% + \pxhy@uniescapefalse + \let\pxhy@nouniescape@given=t } +%% others \DeclareOption{papersize}{% \pxhy@papersizetrue } @@ -101,10 +118,14 @@ \DeclareOption{nodisablecmds}{% \pxhy@disablecmdsfalse } -\pxhy@otfcidtrue +\DeclareOption{otfutf}{% + \pxhy@otfutftrue +} +\DeclareOption{nootfutf}{% + \pxhy@otfutffalse +} \DeclareOption{otfcid}{% \pxhy@otfcidtrue - \let\pxhy@otfcid@given=t } \DeclareOption{nootfcid}{% \pxhy@otfcidfalse @@ -112,13 +133,17 @@ \pxhy@otfmacrostrue \DeclareOption{otfmacros}{% \pxhy@otfmacrostrue - \let\pxhy@otfcid@given=t + \let\pxhy@otfmacros@given=t } \DeclareOption{nootfmacros}{% \pxhy@otfmacrosfalse } +\DeclareOption{force-unicode}{% + \let\pxhy@force@unicode=t +} +%% dispatch \ExecuteOptions{% - auto,tounicode,noout2uni,jacommentline,disablecmds% + auto,tounicode,papersize,jacommentline,disablecmds,otfutf,otfcid% } \ProcessOptions* @@ -152,11 +177,14 @@ %% Check hyperref driver. \ifx\pxhy@driver\@undefined + \let\pxhy@driver\pxhy@driver@none \def\pxhy@tmpa{hdvipdfm} \ifx\Hy@driver\pxhy@tmpa \let\pxhy@driver\pxhy@driver@dvipdfmx - \else - \let\pxhy@driver\pxhy@driver@none + \fi + \def\pxhy@tmpa{hdvips} + \ifx\Hy@driver\pxhy@tmpa + \let\pxhy@driver\pxhy@driver@dvips \fi \fi @@ -187,12 +215,6 @@ \ifnum\jis"2121="3000 \else \pxhy@uptexfalse \fi -% out2uni cannot be used with upTeX. -\ifpxhy@uptex \ifpxhy@zerox - \PackageWarningNoLine\pxhy@pkgname - {out2uni is invalid in upTeX} - \pxhy@zeroxfalse -\fi\fi % bigcode cannot be used without upTeX. \ifpxhy@bigcode \ifpxhy@uptex\else \pxhy@bigcodefalse @@ -201,34 +223,56 @@ {bigcode is invalid without upTeX} \fi \fi\fi -% out2uni disables tounicode. -\ifpxhy@zerox - \pxhy@tounicodefalse -\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 +\fi\fi + % hyperref 'unicode' is allowed only on upLaTeX. -\ifnum0\ifpxhy@hy@unicode\ifpxhy@uptex\else1\fi\fi>\z@ +\ifnum0\ifpxhy@hy@unicode\ifpxhy@uptex\else + \ifx t\pxhy@force@unicode\else1\fi\fi\fi>\z@ \PackageError\pxhy@pkgname {The hyperref 'unicode' mode is not supported\MessageBreak on the pTeX engine}% {\pxhy@eh@fatal}% \expandafter\endinput \fi -% otfmacros forces use of otfcid. -\ifpxhy@otfmacros - \pxhy@otfcidtrue +\ifpxhy@hy@unicode + \pxhy@uniescapefalse + \pxhy@otfutftrue \fi -% otfcid requires upTeX or out2uni. -\ifpxhy@uptex\else\ifpxhy@zerox\else - \pxhy@otfcidfalse - \ifx t\pxhy@otfcid@given +% 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 'otfcid'/'otfmacros' is invalid\MessageBreak + {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 + {Option 'nootfcid' is assumed\MessageBreak + because 'nootfutf' is effective\@gobble} + \pxhy@otfcidfalse +\fi\fi +% otfmacros requrires otfcid. +\ifpxhy@otfcid \else \ifpxhy@otfmacros + \PackageInfo\pxhy@pkgname + {Option 'nootfmacros' is assumed\MessageBreak + because 'nootfcid' is effective\@gobble} + \pxhy@otfmacrosfalse \fi\fi \bxDebug{****pxjahyper env^^J% @@ -239,9 +283,11 @@ pxhy@etoolbox = \ifpxhy@etoolbox true\else false\fi^^J% pxhy@new@hook@system = \ifpxhy@new@hook@system true\else false\fi^^J% ifpxhy@hy@unicode = \ifpxhy@hy@unicode true\else false\fi^^J% pxhy@bigcode = \ifpxhy@bigcode true\else false\fi^^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% +pxhy@tounicode = \ifpxhy@tounicode true\else false\fi^^J% +pxhy@uniescape = \ifpxhy@uniescape true\else false\fi^^J% +pxhy@papersize = \ifpxhy@papersize true\else false\fi^^J% +pxhy@textcmd = \ifpxhy@textcmd true\else false\fi^^J% } %--------------------------------------- Helpers @@ -282,6 +328,10 @@ pxhy@driver = \the\pxhy@driver^^J% \let\pxhy@forcecjktoken\relax \fi +%% \pxhy@geta : GETA MARK +\pxhy@get@jchar{\jis"222E} +\let\pxhy@geta\pxhy@jchar + %% \pxhy@hook@after@package{}{} \@onlypreamble\pxhy@hook@after@package \def\pxhy@hook@after@package#1#2{% @@ -296,6 +346,18 @@ pxhy@driver = \the\pxhy@driver^^J% \fi } +%% \pxhy@triexpandafter +\def\pxhy@triexpandafter{% + \expandafter\expandafter\expandafter +} + +%% \pxhy@cond\ifXXX\fi{}{} +% Does the test "\ifXXX", with immediate exit from the +% induced if-level. +\@gobbletwo\if\if \def\pxhy@cond#1\fi{% + #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi +} + %--------------------------------------- Helpers (e-TeX) \ifpxhy@etex @@ -365,85 +427,184 @@ pxhy@driver = \the\pxhy@driver^^J% \fi \fi % -%--------------------------------------- Hooks to pdfstringdef +%--------------------------------------- Code input processor %% constants \def\pxhy@uc@REPL{FFFD} \def\pxhy@uc@XNAC{FDD1} % not-a-char codepoint used as marker -%% variables -\let\pxhy@str\relax +%% switch 'pxhy@utfXVI' +% Whether or not to convert to UTF-16. +\newif\ifpxhy@utfXVI + +%% Generate tables +% - \pxhy@qh/XY -> Z ; \pxhy@hq/Z -> XY +% means XY (base-4) = Z (base-16) +% - \pxhy@lhq/ZW -> XY +% ZW (base-16) - 1 = XY (base-4) +% - \pxhy@hd/X +% uppercase of X if X is a (lower/uppercase) hexadecimal +% digit; otherwise undefined +\def\pxhy@next#1#2#3#4#5{% + \@namedef{pxhy@qh/#1#2}{#3}% + \@namedef{pxhy@hq/#3}{#1#2}% + \@namedef{pxhy@lhq/#4#5}{#1#2}% +} +\@for\pxhy@tmpa:={% + 00001,01102,02203,03304,10405,11506,12607,13708,% + 20809,2190A,22A0B,23B0C,30C0D,31D0E,32E0F,33F10}\do{% + \expandafter\pxhy@next\pxhy@tmpa +} +\def\pxhy@next#1{% + \lowercase{\def\pxhy@tmpb{#1}}% + \@namedef{pxhy@hd/#1}{#1}% + \@namedef{pxhy@hd/\pxhy@tmpb}{#1}% +} +\@tfor\pxhy@tmpa:=0123456789ABCDEF\do{% + \expandafter\pxhy@next\pxhy@tmpa +} %% \pxhy@burst-`>... \let\pxhy@burst\romannumeral %% \pxhy@uchex{} -% The entity of the code-value input function. If the input -% is a valid code value in hex then it passes the value to -% \pxhy@uchex@res in 4-6 digits; otherwise passes FFFD to -% \pxhy@uchex@res. +% "Distills" the code-value input. If the input is a hex notation of +% a valid code point of Unicode, then it passes the value to +% \pxhy@uchex@out in zero-padded 4-6 digits; otherwise passes FFFD +% to \pxhy@uchex@out. +% Moreover, when the switch pxhy@utfXVI is true, then conversion into +% UTF-16 is performed and each unit is passed to \pxhy@uchex@out +% in zero-padded 4 digits. \def\pxhy@uchex#1{% - \expandafter\pxhy@uchex@a\pxhy@burst-`>#1\pxhy@mk + \pxhy@uchex@pre@a#1\relax{}\pxhy@mk\pxhy@end } -\edef\pxhy@uchex@err{% - \noexpand\pxhy@uchex@res{\pxhy@uc@REPL}% +\def\pxhy@uchex@pre@a{% + \expandafter\pxhy@uchex@pre@b\pxhy@burst-`>% } -\def\pxhy@uchex@a#1#2\pxhy@mk{% - \ifnum2<"1#1 - \expandafter\pxhy@uchex@b\romannumeral-"#1#2\pxhy@mk{#1#2}% - \else \pxhy@uchex@err - \fi +\def\pxhy@uchex@pre@b#1#{% + \pxhy@cond \ifx\pxhy@mt#1\pxhy@mt \fi{% + \pxhy@uchex@bombout + }{%else + \pxhy@uchex@pre@c#1% + }% } -\def\pxhy@uchex@b#1\pxhy@mk#2{% - \ifx\pxhy@mt#1\pxhy@mt - \ifnum"#2>"10FFFF - \pxhy@uchex@err - \else\ifnum"#2>"FFF - \pxhy@uchex@res{#2}% - \else - \pxhy@uchex@c#2"000\pxhy@end - \fi\fi - \else \pxhy@uchex@err - \fi +\def\pxhy@uchex@pre@c#1{% + \pxhy@cond \ifx#1\relax \fi{% + \pxhy@uchex@pre@end + }{%else + \pxhy@triexpandafter\pxhy@uchex@pre@d + \csname pxhy@hd/\string#1\endcsname + }% +} +\def\pxhy@uchex@pre@d#1{% + \pxhy@cond \ifx#1\relax \fi{% + \pxhy@uchex@bombout + }{%else + \pxhy@uchex@pre@e#1% + }% +} +\def\pxhy@uchex@pre@e#1#2\pxhy@mk#3\pxhy@end{% + \pxhy@cond \if 0#1\fi{% + \pxhy@cond \ifx\pxhy@mt#3\pxhy@mt \fi{% + \pxhy@uchex@pre@a#2\pxhy@mk#3\pxhy@end + }{%else + \pxhy@uchex@pre@a#2\pxhy@mk#3#1\pxhy@end + }% + }{%else + \pxhy@uchex@pre@a#2\pxhy@mk#3#1\pxhy@end + }% } -\def\pxhy@uchex@c#1#2#3#4#5#6\pxhy@end{% - \pxhy@uchex@d#1#2#3#4#5\pxhy@end +\def\pxhy@uchex@pre@end#1\pxhy@mk#2\pxhy@end{% + \pxhy@cond \ifx\pxhy@mt#1\pxhy@mt \fi{% + \pxhy@uchex@sw{#2}% + }{%else + \pxhy@uchex@error + }% } -\def\pxhy@uchex@d#1"#2\pxhy@end{% - \pxhy@uchex@res{#2#1}% +\def\pxhy@uchex@bombout#1\pxhy@end{% + \pxhy@uchex@error } -\ifpxhy@uptex %<*upTeX> +\def\pxhy@uchex@sw#1{% + \pxhy@cond \ifnum"0#1>"10FFFF \fi{% + \pxhy@uchex@error + }{\pxhy@cond \ifnum"0#1>"FFFF \fi{% + \pxhy@cond \ifpxhy@utfXVI \fi{% + \pxhy@uchex@big#1"000000\pxhy@end + }{%else + \pxhy@uchex@out{#1}% + }% + }{%else + \pxhy@uchex@small#1"0000\pxhy@end + }}% +} +\def\pxhy@uchex@small#1#2#3#4#5#6\pxhy@end{% + \pxhy@uchex@small@a#1#2#3#4#5\pxhy@end +} +\def\pxhy@uchex@small@a#1"#2\pxhy@end{% + \pxhy@uchex@out{#2#1}% +} +\def\pxhy@uchex@big#1#2#3#4#5#6#7#8\pxhy@end{% + \pxhy@uchex@big@a#1#2#3#4#5#6#7\pxhy@end +} +\def\pxhy@uchex@big@a#1"#2\pxhy@end{% + \pxhy@uchex@big@b#2#1\pxhy@end +} +\def\pxhy@uchex@big@b#1#2#3#4{% + \pxhy@triexpandafter\pxhy@uchex@big@c + \csname pxhy@lhq/#1#2\pxhy@triexpandafter\endcsname + \csname pxhy@hq/#3\pxhy@triexpandafter\endcsname + \csname pxhy@hq/#4\endcsname +} +\def\pxhy@uchex@big@c#1#2#3#4#5#6{% + \pxhy@triexpandafter\pxhy@uchex@big@d + \csname pxhy@qh/2#1\pxhy@triexpandafter\endcsname + \csname pxhy@qh/#2#3\pxhy@triexpandafter\endcsname + \csname pxhy@qh/#4#5\pxhy@triexpandafter\endcsname + \csname pxhy@qh/3#6\endcsname +} +\def\pxhy@uchex@big@d#1#2#3#4#5\pxhy@end{% + \pxhy@uchex@out{D#1#2#3}% + \pxhy@uchex@out{D#4#5}% +} +\edef\pxhy@uchex@error{% + \noexpand\pxhy@uchex@out{\pxhy@uc@REPL}% +} - %% \pxhy@marker: a not-a-char U+FDD1 - \pxhy@get@jchar{\ucs"\pxhy@uc@XNAC} - \edef\pxhy@marker{\pxhy@jchar} +%--------------------------------------- Hooks to pdfstringdef - %% Makes \Ux and \UTF be the code input command in PDF strings. - \pdfstringdefDisableCommands{% - \let\Ux\pxhy@uchex - \let\UTF\pxhy@uchex - \let\UTFM\pxhy@uchex - \let\UTFK\pxhy@uchex - \let\UTFC\pxhy@uchex - \let\UTFT\pxhy@uchex +%% variables +\let\pxhy@str\relax + +%% \pxhy@Ux +% The definition of \Ux in PDF strings. +\let\pxhy@Ux\@undefined + +\ifpxhy@hy@unicode %<*unicode> + + %% \pxhy@Ux + \def\pxhy@Ux{\pxhy@uchex}% + \pxhy@utfXVIfalse + \def\pxhy@uchex@out#1{% + \unichar{"#1}% } - \ifpxhy@hy@unicode %<*unicode> +\else\ifpxhy@uptex %<*upTeX> - %% \pxhy@uchex@res - \def\pxhy@uchex@res#1{% - \unichar{"#1}% - } + %% \pxhy@Ux + \def\pxhy@Ux{\pxhy@uchex}% + \pxhy@utfXVIfalse - \else % + %% \pxhy@marker: a not-a-char U+FDD1 + \pxhy@get@jchar{\ucs"\pxhy@uc@XNAC} + \edef\pxhy@marker{\pxhy@jchar} %BEGIN-- in the following block #1 means the marker \def\pxhy@next#1{% #1=marker - %% \pxhy@uchex@res + %% \pxhy@uchex@out % Expands to a tag string which will later be converted to % a real character in the postprocess. - \def\pxhy@uchex@res##1{#1##1>}% + \def\pxhy@uchex@out##1{#1##1>}% %% \pxhy@posthook % The postprocess of this package. It is registered to % \pdfstringdefPostHook. @@ -486,26 +647,62 @@ pxhy@driver = \the\pxhy@driver^^J% \pxhy@next \endgroup - \fi % +\fi\fi % -\else\ifpxhy@zerox %<*!upTeX> +\ifpxhy@uniescape %<*uniescape> - %% \pxhy@uchex@res - % Expands to \0x form. - \def\pxhy@uchex@res#1{% + %% \pxhy@Ux + \def\pxhy@Ux{\pxhy@uchex}% + % \pxhy@uchex converts to UTF-16 + \pxhy@utfXVItrue + \def\pxhy@uchex@out#1{% + % Expands to \0x form. \0x#1% } - %% Makes \Ux be the code input command in PDF strings. - % (If the otf package is loaded, then \UTF already does - % the same thing.) +\fi % + +%% Makes \Ux be the code input command in PDF strings. +\ifx\pxhy@Ux\@undefined\else \pdfstringdefDisableCommands{% - \let\Ux\pxhy@uchex + \let\Ux\pxhy@Ux } +\fi - %Note: if out2uni is off then \Ux remains undefined. -\fi\fi % +%--------------------------------------- Support for 'otfutf' +\ifpxhy@otfutf + +%% \pxhy@UTF +% The definition of \UTF in PDF strings. +\ifx\pxhy@Ux\@undefined + % Use a fallback definition. + \def\pxhy@UTF{\pxhy@uchex} + \pxhy@utfXVIfalse + \def\pxhy@uchex@out#1{% + \@nameuse{U+#1}% issue a warning + \pxhy@geta + } +\else + \let\pxhy@UTF\pxhy@Ux +\fi + +%% \pxhy@dispatch@otfutf +\@onlypreamble\pxhy@dispatch@otfutf +\def\pxhy@dispatch@otfutf{% + \global\let\pxhy@dispatch@otfutf\relax + \pdfstringdefDisableCommands{% + \let\UTF\pxhy@UTF + \let\UTFM\pxhy@UTF + \let\UTFK\pxhy@UTF + \let\UTFC\pxhy@UTF + \let\UTFT\pxhy@UTF + } +} + +%% enable hooks +\pxhy@hook@after@package{otf}{\pxhy@dispatch@otfutf} +\fi %--------------------------------------- Support for 'otfcid' \ifpxhy@otfcid @@ -551,13 +748,21 @@ pxhy@driver = \the\pxhy@driver^^J% \expandafter\expandafter\expandafter\pxhy@cid@aux \bxjaFastCidToUcsHex{#1}\pxhy@mk{\number#1}% } +\ifx\pxhy@Ux\@undefined + \def\pxhy@cid@aux#1\pxhy@mk#2{% + \@nameuse{CID+#2}% issue a warning + \pxhy@geta + } +\else \def\pxhy@cid@aux#1\pxhy@mk#2{% \ifnum"#1>\z@ - \pxhy@uchex{#1}% + \pxhy@Ux{#1}% \else \@nameuse{CID+#2}% + %\pxhy@geta %FIXME: future change \fi } +\fi %% \pxhy@dispatch@otfcid \@onlypreamble\pxhy@dispatch@otfcid @@ -609,7 +814,7 @@ pxhy@driver = \the\pxhy@driver^^J% \ifpxhy@hy@unicode PU\else PD1\fi } -\ifnum\pxhy@driver=\pxhy@driver@dvipdfmx %<*dvipdfmx> +\ifpxhy@textcmd %<*textcmd> %%<+> \pxDeclarePdfTextCommand{\CS}{}{} \@onlypreamble\pxDeclarePdfTextCommand @@ -627,14 +832,14 @@ pxhy@driver = \the\pxhy@driver^^J% {\pxhy@revoke@pdf@tcc{#1}{#2}}% } -\else %<*!dvipdfmx> +\else %<*!textcmd> \@onlypreamble\pxDeclarePdfTextCommand \newcommand*\pxDeclarePdfTextCommand[3]{} \@onlypreamble\pxDeclarePdfTextComposite \newcommand*\pxDeclarePdfTextComposite[4]{} -\fi % +\fi % %% \pxhy@revoke@pdf@tc \@onlypreamble\pxhy@revoke@pdf@tc @@ -685,7 +890,7 @@ pxhy@driver = \the\pxhy@driver^^J% \let\pxhy@body\pxhy@jchar }% \else %<*!upTeX> - \ifpxhy@zerox + \ifpxhy@uniescape \def\pxhy@get@body#1#2{% \ifx\pxhy@end#1\pxhy@end \def\pxhy@body{\0x#2}% @@ -1108,7 +1313,7 @@ pxhy@driver = \the\pxhy@driver^^J% % ligatures, since otherwise hyperref leaves some garbage in % output pdf-strings when such ligatures appear. \ifpxhy@uptex\else - \ifpxhy@zerox\else + \ifpxhy@uniescape\else \DeclareTextCommand{\textendash}{PD1}{--} \DeclareTextCommand{\textquestiondown}{PD1}{}% empty \DeclareTextCommand{\textexclamdown}{PD1}{}% empty @@ -1121,6 +1326,9 @@ pxhy@driver = \the\pxhy@driver^^J% %--------------------------------------- Enable hyperref unicode \ifpxhy@hy@unicode +%% check the current meaning +\def\pxhy@tmpa#1{\@backslashchar 000#1} +\ifx\HyPsd@Char\pxhy@tmpa \PackageInfo\pxhy@pkgname {The setup for hyperref 'unicode' is applied.\@gobbletwo} @@ -1162,6 +1370,26 @@ pxhy@driver = \the\pxhy@driver^^J% \IntCalcMod#1!256!!% }% %%%%END +\fi + +\ifpxhy@uptex\else %<*pTeX> + \RequirePackage{bxjatoucs}[] + \def\HyPsd@Char#1{% + \ifnum`#1<128 % + \@backslashchar 000#1% + \else\ifnum`#1<256 % + \expandafter\HyPsd@CharTwoByte\number`#1!% + \else + \expandafter\HyPsd@CharTwoByte\number\pxhy@to@ucs{`#1}!% + \fi\fi + }% + \def\pxhy@to@ucs#1{"FFFD} + \ifnum\jis"2121="8140 % sjis + \let\pxhy@to@ucs\bxjaSjisToUcs + \else\ifnum\jis"2121="A1A1 % euc + \let\pxhy@to@ucs\bxjaEucToUcs + \fi\fi +\fi % %% disable the verification of bxjscls \let\jsCheckHyperrefUnicode\@empty diff --git a/language/japanese/pxjahyper/pxjahyper.tex b/language/japanese/pxjahyper/pxjahyper.tex index cc3d182c66..f0f2fa15ca 100644 --- a/language/japanese/pxjahyper/pxjahyper.tex +++ b/language/japanese/pxjahyper/pxjahyper.tex @@ -6,12 +6,13 @@ \MakeShortVerb{\|} \usepackage{bxtexlogo} \bxtexlogoimport{*} -\newcommand{\PkgVersion}{0.8} -\newcommand{\PkgDate}{2021/05/05} +\newcommand{\PkgVersion}{0.9a} +\newcommand{\PkgDate}{2021/05/11} \newcommand{\Pkg}[1]{\textsf{#1}} \newcommand{\Meta}[1]{$\langle$\mbox{}#1\mbox{}$\rangle$} \newcommand{\Note}{\par\noindent ※} \newcommand{\Means}{:\quad} +\providecommand{\Strong}[1]{\textsf{#1}} %----------------------------------------------------------- \begin{document} \title{\Pkg{pxjahyper} パッケージ} @@ -30,7 +31,7 @@ 内部漢字コードに応じて適切なものを出力する。 \item PDF文字列の中でLICR(|\"a| や |\textsection| 等の 文字出力の命令)が正しく機能するようにする。 - ただし、エンジンが {\pTeX} の場合は、out2uni を利用 + ただし、エンジンが {\pTeX} の場合は、out2uni/convbkmk を利用 する場合を除き、JIS~X~0208にない文字は出力できない (hyperrefの警告が出る)。 \item {\TeX} の版面拡大機能が使われている @@ -52,26 +53,38 @@ 使用可能なオプションは以下の通り。 \begin{itemize} +\item \Strong{ドライバオプション}\Means + |dvipdfmx|、|dvips|、および |nodvidriver|% + (ドライバ依存動作の無効化を明示的に指示、 + 現状ではほとんどの動作が無効になる) + が指定できる。 + \Note 0.5版より、|nodvidriver| の別名の |none| は非推奨の扱いとする。 +\item |auto|(既定)\Means + ドライバオプションを\Pkg{hyperref}のドライバ指定から自動的に判定する。 \item |tounicode|(既定)\Means - dvipdfmx用の「tounicode special」を出力する。 + dvipdfmx用の「tounicode special」を発行し、 + それを前提にした出力を行う。 \item |notounicode|\Means - |tounicode| の否定。 + dvipdfmx用の「tounicode special」を発行しない。 \item |out2uni|\Means - out2uniフィルタ(角藤氏製作)を使うことを前提にした - 出力を行う。 - (|tounicode| が無効になる。) - {\upLaTeX} では使用不可。 -\item |noout2uni|(既定)\Means - |out2uni| の否定。 -\item |otfcid|(既定)\Means - \Pkg{japanese-otf}パッケージの |\CID| をPDF文字列中で + out2uniフィルタを使うことを前提にした出力を行う。 +\item |convbkmk|\Means + convbkmkフィルタを使うことを前提にした出力を行う。 + \Note ドライバがdvipsの場合は既定で有効になる。 +\item |otfutf|(既定)\Means + \Pkg{japanese-otf}パッケージの |\UTF| 命令をPDF文字列中で 使えるようにする。 - 具体的には、当該のAJ1のグリフに“対応”するUnicode文字が - あればそれを出力し、なければ(警告を出した上で)削除する。 + \Note 詳細は\ref{ssec:otf-package}節を参照。 +\item |nootfutf|\Means + |otfutf| の否定。 +\item |otfcid|(既定)\Means + \Pkg{japanese-otf}パッケージの |\CID| 命令をPDF文字列中で + “可能な限り”使えるようにする。 + \Note 詳細は\ref{ssec:otf-package}節を参照。 + \Note |otfcid| の利用には、エンジンの{\eTeX}拡張および + \Pkg{etoolbox}と\Pkg{bxjatoucs}パッケージのインストールが必要。 \item |nootfcid|\Means |otfcid| の否定。 - \Note |otfcid| の利用には、エンジンの{\eTeX}拡張および - \Pkg{etoolbox}と\Pkg{bxjatoucs}パッケージインストールが必要。 \item |disablecmds|(既定)\Means 「PDF文字列中のテキスト装飾命令の無効化」を有効にする。 \Note 詳細は\ref{ssec:disablecmds}節を参照。 @@ -81,14 +94,8 @@ \Pkg{japanese-otf}付属の\Pkg{ajmacros}パッケージが提供する 文字入力命令(|\ajMaru|、|\ajLig| 等)をPDF文字列中で “可能な限り”使えるようにする。 - \Note Unicode文字で表現可能であればそれを出力し、 - なければ代替表現を出力する。 - \Note |otfmacros| を指定する場合は |otfcid| も有効にする必要がある。 - \Note \Pkg{ajmacros}パッケージの多くの命令は“脆弱(fragile)”である。 - そのため、節見出し(|\section| 等の引数)で |\ajMaru| 等の命令を - 使いたい場合は、命令の前に |\protect| 付ける必要がある。 - \footnote{ちなみに、引数がPDF文字列として解釈される場合には、 - |\protect| は全く結果に影響しない。} + \Note 詳細は\ref{ssec:otf-package}節を参照。 + \Note |otfmacros| を有効にする場合は |otfcid| も有効にする必要がある。 \item |nootfmacros|\Means |otfmacros| の否定。 \Note 0.6版より既定を |otfmacros| に変更した。 @@ -99,15 +106,13 @@ \item |nobigcode|\Means |bigcode| の否定。 \Note 0.3a版より既定を |bigcode| に変更した。 -\item |dvipdfmx|\Means - dvipdfmxを前提とした動作を行う。 -\item |nodvidriver|\Means - dvipdfmxを前提とした動作を抑止する。 - \Note 現状では、この場合には本パッケージは実質的に何の動作も行わない。 - \Note 0.5版より、|nodvidriver| の別名の |none| は非推奨の扱いとする。 -\item |auto|(既定)\Means - \Pkg{hyperref}のドライバがdvipdfmx用ならば |dvipdfmx|、 - それ以外は |nodvidriver| の動作。 +\item |papersize|(既定)\Means + {\upTeX}でのToUnicode CMapとして既定のUTF8-UCSの代わりに\ + UTF8-UTF16を用いる。 + (当該のファイルが存在する必要がある。) +\item |nopapersize|\Means + |bigcode| の否定。 + \Note 0.3a版より既定を |bigcode| に変更した。 \end{itemize} %=========================================================== @@ -118,6 +123,7 @@ %------------------- \subsection{Unicode符号値による入力} +\label{ssec:ux-command} PDF文字列入力中で、|\Ux| が以下の意味になる。 PDF文字列以外では |\Ux| は以前の定義(または未定義)に戻る。 @@ -132,20 +138,93 @@ Unicode符号値入力用の命令が使っているものである。 こちらを使う方が無難かもしれない。} \begin{itemize} -\item |\Ux{|Unicode符号値|}|\Means +\item |\Ux{|Unicode符号値16進|}|\Means その符号値の文字を出力する。 + 具体的な動作は以下の通り: + \begin{itemize} + \item エンジンが{\upLaTeX}のときは、当該の文字自体を書いたのと + 同等になる。 + \item エンジンが{\pLaTeX}で |out2uni| または |convbkmk| が有効の + 場合は、エスケープ表記(|\0xUUUU|)を出力する。 + \end{itemize} + \item それ以外の場合は、|\Ux| は定義されない。 +\end{itemize} + +%------------------- +\subsection{\Pkg{japanese-otf}パッケージの文字入力命令への対応} +\label{ssec:otf-package} + +\paragraph{\textbackslash UTF命令} +|\UTF| 命令は、PDF文字列中では +out2uni用の出力を行うように設計されている。 +本パッケージで |otfutf| オプションを有効にした場合は、 +PDF文字列中の動作が以下のように変更される。 + +\begin{itemize} +\item |\Ux| 命令(\ref{ssec:ux-command}節参照)が有効の場合は、 + |\Ux| と同じ動作になる。 +\item それ以外の場合 + (エンジンが{\pLaTeX}でtounicodeを前提にする場合)は、 + 警告を出した上でゲタ記号を出力する。 + \Note {\pLaTeX}ではtounicodeの機能でUnicode文字を出力できないため。 +\end{itemize} + +\Note |\UTF| 命令の多言語版、 +すなわち |\UTFC|・|\UTFK|・|\UTFM|・|\UTFT| 命令も |\UTF| +と同じ扱いになる。 + +\paragraph{\textbackslash CID命令} +\Pkg{japanese-otf}パッケージの仕様では |\CID| 命令は、PDF文字列中では +サポートされない(未定義動作となる)。 +本パッケージで |otfcid| オプションを有効にした場合は、 +PDF文字列中で |\CID| が“可能な限り”使えるようにする。 +具体的な仕様は以下の通り。 + +\begin{itemize} +\item 当該のAJ1のグリフに“対応”する\textbf{単独の}Unicode文字が + あればそれを出力し、なければ + (警告を出した上で)削除する。 + \footnote{他の同様の場合と合わせてゲタ記号を出力するようにしたい。 + 1.0版において仕様を変更する予定。} +\item ただし |\Ux| 命令(\ref{ssec:ux-command}節参照)が + 無効になる場合は、そもそもUnicode文字も出力できないため、 + 常に(警告を出した上で)ゲタ記号を出力する。 + 結局情報は欠落するが、それでも未定義動作(エラーになりえる) + よりは好ましいであろう。 \end{itemize} -符号値は16進数で指定する。 +\Note |otfcid| の利用には、エンジンの{\eTeX}拡張および +\Pkg{etoolbox}と\Pkg{bxjatoucs}パッケージのインストールが必要。 +\Note |\CID| 命令の多言語版はサポートされない。 -なお、\Pkg{japanese-otf}パッケージの |\UTF| 命令は、PDF文字列中では -out2uni用の出力を行うように設計されているが、 -本パッケージを {\upLaTeX} で用いた場合は、 -|\UTF| も(PDF文字列中では)|\Ux| と同じ動作 -(つまりtounicode用の出力)になるように変更される。 +\paragraph{ajmacrosパッケージの命令} +本パッケージで |otfmacros| オプションを有効にした場合は、 +\Pkg{japanese-otf}付属の\Pkg{ajmacros}パッケージが提供する +文字入力命令(|\ajMaru|、|\ajLig| 等)をPDF文字列中で +“可能な限り”使えるようにする。 +具体的な仕様は以下の通り。 + +\begin{itemize} +\item 現状では、|\Ux| 命令が有効になる場合のみが + サポートされる。 + \Note それ以外の場合は |otfmacros| オプションは無効になる。 +\item Unicode文字で表現可能であればそれを出力し、 + なければ代替表現を出力する。 +\item Unicode文字を出力する場合の仕様は |\CID| と同じ。 + 代替表現の場合は文字自体が出力されることもある。 +\end{itemize} + +\Note |otfmacros| を有効にする場合は |otfcid| も有効にする必要がある。 +(従って |otfcid| と同じ前提条件が課される。) +|nootfcid| を指定した場合は |otfmacros| も無効になる。 +\Note \Pkg{ajmacros}パッケージの多くの命令は“脆弱(fragile)”である。 +そのため、節見出し(|\section| 等の引数)で |\ajMaru| 等の命令を +使いたい場合は、命令の前に |\protect| 付ける必要がある。 +\footnote{ちなみに、引数がPDF文字列として解釈される場合には、 + |\protect| は全く結果に影響しない。} %------------------- -\subsection{PDF文字列用の文字命令の定義} +\subsection{PDF文字列用の文字命令のユーザ定義} 以下の命令が提供される。(プリアンブルでのみ使用可能。) @@ -214,7 +293,4 @@ PDF文字列と版面出力の両方に使われるテキスト(節見出し |\textmg| |\mgfamily| |\ltseries| |\ebseries| |\propshape| \end{itemize} - - - \end{document} -- cgit v1.2.3