summaryrefslogtreecommitdiff
path: root/language/japanese/pxjahyper/pxjahyper.sty
diff options
context:
space:
mode:
Diffstat (limited to 'language/japanese/pxjahyper/pxjahyper.sty')
-rw-r--r--language/japanese/pxjahyper/pxjahyper.sty428
1 files changed, 328 insertions, 100 deletions
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{<package-name>}{<code>}
\@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<arg>\fi{<true>}{<false>}
+% Does the test "\ifXXX<arg>", 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 %</papersize>
-%--------------------------------------- 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{<hex>}
-% 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 %<!*unicode>
+ %% \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 %</unicode>
+\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 %</uniescape>
+
+%% 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 %</upTeX>
+%--------------------------------------- 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}{<jis>}{<ucs>}
\@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 %</dvipdfmx>
+\fi %</textcmd>
%% \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 %</pTeX>
%% disable the verification of bxjscls
\let\jsCheckHyperrefUnicode\@empty