summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-17 20:42:12 +0000
committerKarl Berry <karl@freefriends.org>2017-10-17 20:42:12 +0000
commit03f20039bcdf72fadefcb9fe0c27508b31daa325 (patch)
tree355f2e1754c84900cb65b644a7a2c4ea32703c0e /Master/texmf-dist/tex
parent9df137556556db6a7bd7daf3c66201b3f49aeb3f (diff)
pxjahyper (17oact17)
git-svn-id: svn://tug.org/texlive/trunk@45554 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty101
1 files changed, 82 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
index 6ba7380378c..691f0f3efcc 100644
--- a/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
+++ b/Master/texmf-dist/tex/platex/pxjahyper/pxjahyper.sty
@@ -1,10 +1,16 @@
-%
-% pxjahyper.sty
-%
+%%
+%% This is file 'pxjahyper.sty'.
+%%
+%% Copyright (c) 2017 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}[2012/05/27 v0.2]
+\ProvidesPackage{pxjahyper}[2017/10/17 v0.3a]
%% error messages
\def\pxhy@pkgname{pxjahyper}
@@ -14,6 +20,7 @@
\def\pxhy@fatal#1#2{%
\pxhy@error{#1}{#2Package loading is aborted right now.}%
}
+\providecommand{\bxDebug}[1]{}
%% packages
\RequirePackage{atbegshi}
@@ -28,8 +35,9 @@
\chardef\pxhy@driver@none=0
\chardef\pxhy@driver@dvipdfmx=1
\let\pxhy@driver\@undefined
+\newif\ifpxhy@hy@unicode
-%------------------- option handling
+%--------------------------------------- Package options
\DeclareOption{dvipdfmx}{%
\let\pxhy@driver\pxhy@driver@dvipdfmx
@@ -37,6 +45,9 @@
\DeclareOption{dvipdfm}{%
\let\pxhy@driver\pxhy@driver@dvipdfmx
}
+\DeclareOption{nodvidriver}{%
+ \let\pxhy@driver\pxhy@driver@none
+}
\DeclareOption{none}{%
\let\pxhy@driver\pxhy@driver@none
}
@@ -62,22 +73,22 @@
\pxhy@bigcodefalse
}
\ExecuteOptions{%
- auto,tounicode,noout2uni,nobigcode%
+ auto,tounicode,noout2uni,bigcode%
}
\ProcessOptions*
-%------------------- environment check
+%--------------------------------------- Environment check
%% The hyperref package must be loaded in advance.
\@ifpackageloaded{hyperref}{}{%else
\pxhy@fatal{'hyperref' not yet loaded}{}%
\endinput
}
-%% hyperref option 'unicode' must not be set.
+
+%% Check for the hyperref option 'unicode'.
\expandafter\ifx\csname ifHy@unicode\expandafter\endcsname
- \csname iftrue\endcsname
- \pxhy@fatal{hyperref 'unicode' mode is not supported}{}%
- \expandafter\endinput
+ \csname iftrue\endcsname
+ \pxhy@hy@unicodetrue
\fi
%% Check hyperref driver.
@@ -135,6 +146,11 @@
\ifpxhy@zerox
\pxhy@tounicodefalse
\fi
+% hyperref 'unicode' is allowed only on upLaTeX.
+\ifpxhy@hy@unicode\ifpxhy@uptex\else
+ \pxhy@fatal{hyperref 'unicode' mode is not supported}{}%
+ \expandafter\endinput
+\fi\fi
\iffalse
\typeout{%
@@ -147,7 +163,7 @@ pxhy@driver = \the\pxhy@driver^^J%
}
\fi
-%------------------- helpers
+%--------------------------------------- Helpers
%% pxhy@end
\def\pxhy@end{\pxhy@end@}
@@ -179,7 +195,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\let\pxhy@forcecjktoken\relax
\fi
-%------------------- output 'tounicode' special
+%--------------------------------------- Output 'tounicode' special
\ifpxhy@tounicode
\ifnum\pxhy@driver=\pxhy@driver@dvipdfmx %<*dvipdfmx>
@@ -196,7 +212,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\fi %</dvipdfmx>
\fi
-%------------------- papersize special adjustment
+%--------------------------------------- Papersize special adjustment
% When the magnification is in effect (i.e. \mag<>1000), hyperref
% emits a papersize special with wrong value. (dvipdfmx interprets
@@ -229,8 +245,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\fi
\fi
-%-------------------
-
+%--------------------------------------- Hooks to pdfstringdef
\def\pxhy@uc@REPL{FFFD}
\def\pxhy@uc@XNAC{FDD1} % not-a-char codepoint used as marker
@@ -355,7 +370,7 @@ pxhy@driver = \the\pxhy@driver^^J%
%Note: if out2uni is off then \Ux remains undefined.
\fi\fi %</upTeX>
-%------------------- Redefine text commands for PD1
+%--------------------------------------- Redefine text commands for PD1
\ifnum\pxhy@driver=\pxhy@driver@dvipdfmx %<*dvipdfmx>
@@ -443,7 +458,7 @@ pxhy@driver = \the\pxhy@driver^^J%
\fi
\fi %</upTeX>
-%-------------------
+%%%%%%%%%%%%%%%%%%%% the definitions
% JIS X 0213 does not distinguish the following pairs:
% - circumflex(U+02C6) and asciicircum(U+005E)
@@ -612,6 +627,54 @@ pxhy@driver = \the\pxhy@driver^^J%
\fi
\fi
-%------------------- all done
+%--------------------------------------- Enable hyperref unicode
+\ifpxhy@hy@unicode
+
+\bxDebug{Setup for hyperref 'unicode'}
+
+%% The following code is taken from hyperref.sty.
+%%%%BEGIN
+ \def\HyPsd@Char#1{%
+ \ifnum`#1<128 %
+ \@backslashchar 000#1%
+ \else
+ \ifnum`#1<65536 %
+ \expandafter\HyPsd@CharTwoByte\number`#1!%
+ \else
+ \expandafter\expandafter\expandafter\HyPsd@CharSurrogate
+ \intcalcSub{`#1}{65536}!%
+ \fi
+ \fi
+ }%
+ \def\HyPsd@CharTwoByte#1!{%
+ \expandafter\expandafter\expandafter\HyPsd@CharOctByte
+ \IntCalcDiv#1!256!!%
+ \expandafter\expandafter\expandafter\HyPsd@CharOctByte
+ \IntCalcMod#1!256!!%
+ }%
+ \def\HyPsd@CharOctByte#1!{%
+ \@backslashchar
+ \IntCalcDiv#1!64!%
+ \intcalcDiv{\IntCalcMod#1!64!}{8}%
+ \IntCalcMod#1!8!%
+ }%
+ \def\HyPsd@CharSurrogate#1!{%
+ \@backslashchar 33%
+ \IntCalcDiv#1!262144!%
+ \expandafter\expandafter\expandafter\HyPsd@CharOctByte
+ \intcalcDiv{\IntCalcMod#1!262144!}{1024}!%
+ \@backslashchar 33%
+ \expandafter\expandafter\expandafter\IntCalcAdd
+ \intcalcDiv{\IntCalcMod#1!1024!}{256}!4!%
+ \expandafter\expandafter\expandafter\HyPsd@CharOctByte
+ \IntCalcMod#1!256!!%
+ }%
+%%%%END
+
+%% disable the verification of bxjscls
+\let\jsCheckHyperrefUnicode\@empty
+
+\fi
+%--------------------------------------- All done
\endinput
%% EOF