[latex3-commits] [git/LaTeX3-latex3-hyperref] master: pdfmajorversion (2d3a583)
David Carlisle
d.p.carlisle at gmail.com
Sat Jan 18 18:04:31 CET 2020
Repository : https://github.com/latex3/hyperref
On branch : master
Link : https://github.com/latex3/hyperref/commit/2d3a5830b41e21b9db90270063b1e1c268e13636
>---------------------------------------------------------------
commit 2d3a5830b41e21b9db90270063b1e1c268e13636
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Sat Jan 18 17:04:31 2020 +0000
pdfmajorversion
>---------------------------------------------------------------
2d3a5830b41e21b9db90270063b1e1c268e13636
ChangeLog.txt | 1 +
hluatex.dtx | 30 ++++++++++--------
hyperref.dtx | 73 +++++++++++++++++++++++++++++---------------
testfiles/87-pdf2.luatex.tlg | 8 +++++
4 files changed, 76 insertions(+), 36 deletions(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 4888122..3e1a713 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -2,6 +2,7 @@
* Test for newer GhostScript releases in dvips output
https://tex.stackexchange.com/a/524163/1090
* Delete doc/options.pdf
+ * Add start of support for setting pdfversion to 2.0
2019-11-10 7,00c David Carlisle
* adjust vtex guards for issue #108
diff --git a/hluatex.dtx b/hluatex.dtx
index 6d94245..52f1c0e 100644
--- a/hluatex.dtx
+++ b/hluatex.dtx
@@ -143,13 +143,15 @@
}
\edef\Hy at pdfminorversion{\pdfvariable minorversion}%
- \ifHy at ocgcolorlinks
- \ifnum\Hy at pdfminorversion<5 %
+\edef\Hy at pdfmajorversion{\pdfvariable majorversion}%
+
+\ifHy at ocgcolorlinks
+ \ifnum\Hy at pdfmajorminor@version<105 %
\kvsetkeys{Hyp}{pdfversion=1.5}%
\fi
\fi
\ifHy at setpdfversion
- \ifnum\Hy at pdfversion<5 %
+ \ifnum\Hy at pdf@majorminor at version<105 %
\ltx at IfUndefined{pdfobjcompresslevel}{%
}{%
\ifHy at verbose
@@ -157,13 +159,13 @@
PDF object streams are disabled, because they are%
\MessageBreak
not supported in requested PDF version %
- 1.\Hy at pdfversion
+ \Hy at pdf@majorversion.\Hy at pdf@minorversion
}%
\fi
\pdfobjcompresslevel=\ltx at zero
}%
\fi
- \ifnum\Hy at pdfminorversion=\Hy at pdfversion\relax
+ \ifnum\Hy at pdfmajorminor@version=\Hy at pdf@majorminor at version\relax
\else
\let\Hy at temp\ltx at empty
\def\Hy at temp@A#1#2{%
@@ -186,10 +188,11 @@
\Hy at temp@A\pdflastlink{link}%
}%
\ifx\Hy at temp\ltx at empty
- \Hy at pdfminorversion=\Hy at pdfversion\relax
+ \Hy at pdfmajorversion=\Hy at pdf@majorversion\relax
+ \Hy at pdfminorversion=\Hy at pdf@minorversion\relax
\else
\let\Hy at temp@A\ltx at empty
- \ifnum\Hy at pdfversion=4 %
+ \ifnum\Hy at pdf@majorminor at version=104 %
\IfFileExists{pdf14.sty}{%
\def\Hy at temp@A{%
\MessageBreak
@@ -207,9 +210,10 @@
The version should be set as early as possible:%
\MessageBreak
\space\space
- \expandafter\string\Hy at pdfminorversion=\Hy at pdfversion
+ \expandafter\string\Hy at pdfmajorversion=\Hy at pdf@majorversion, %
+ \expandafter\string\Hy at pdfminorversion=\Hy at pdf@minorversion
\string\relax
- \ifnum\Hy at pdfversion<5 %
+ \ifnum\Hy at pdf@majorminor at version<105 %
\ltx at ifundefined{pdfobjcompresslevel}{%
}{%
\MessageBreak
@@ -222,11 +226,13 @@
\fi
\fi
\PackageInfo{hyperref}{%
+ \expandafter\string\Hy at pdfmajorversion.%
\expandafter\string\Hy at pdfminorversion
- :=\number\Hy at pdfversion\space
+ :=\number\Hy at pdf@majorversion.\number\Hy at pdf@minorversion\space
}%
\fi
- \edef\Hy at pdfversion{\number\Hy at pdfminorversion}%
+ \edef\Hy at pdf@majorversion{\number\Hy at pdfmajorversion}%
+ \edef\Hy at pdf@minorversion{\number\Hy at pdfminorversion}%
\Hy at DisableOption{pdfversion}%
\ifHy at ocgcolorlinks
@@ -1353,7 +1359,7 @@
}
\def\PDFForm@@Name#1{%
\begingroup
- \ifnum\Hy at pdfversion<5 % implementation note 117, PDF spec 1.7
+ \ifnum\Hy at pdf@majorminor at version<105 % implementation note 117, PDF spec 1.7
\ifHy at unicode
\Hy at unicodefalse
\fi
diff --git a/hyperref.dtx b/hyperref.dtx
index 5a4055d..077b733 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -5281,22 +5281,43 @@
\@ifundefined{Hy at pdfversion@#1}{%
\PackageWarning{hyperref}{%
Unsupported PDF version `#1'.\MessageBreak
- Valid values: 1.2 until 1.9%
+ Valid values: 1.2-1.7, 2.0%
}%
}{%
\Hy at setpdfversiontrue
- \edef\Hy at pdfversion{\@nameuse{Hy at pdfversion@#1}}%
+ \@nameuse{Hy at pdfversion@#1}%
}%
}
-\@namedef{Hy at pdfversion@1.2}{2}%
-\@namedef{Hy at pdfversion@1.3}{3}%
-\@namedef{Hy at pdfversion@1.4}{4}%
-\@namedef{Hy at pdfversion@1.5}{5}%
-\@namedef{Hy at pdfversion@1.6}{6}%
-\@namedef{Hy at pdfversion@1.7}{7}%
-\@namedef{Hy at pdfversion@1.8}{8}%
-\@namedef{Hy at pdfversion@1.9}{9}%
-\def\Hy at pdfversion{5}
+% \end{macrocode}
+% \verb|\Hy at pdfminorversion| already used elsewhere to denote \verb|\pdfminorversion|
+% or \verb|\pdfvariable majorversion}| so introduce new names here.
+% \begin{macrocode}
+\@namedef{Hy at pdfversion@1.2}{\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{2}}%
+\@namedef{Hy at pdfversion@1.3}{\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{3}}%
+\@namedef{Hy at pdfversion@1.4}{\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{4}}%
+\@namedef{Hy at pdfversion@1.5}{\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{5}}%
+\@namedef{Hy at pdfversion@1.6}{\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{6}}%
+\@namedef{Hy at pdfversion@1.7}{\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{7}}%
+\@namedef{Hy at pdfversion@2.0}{\def\Hy at pdf@majorversion{2}\def\Hy at pdf@minorversion{0}}%
+\def\Hy at pdf@majorversion{1}\def\Hy at pdf@minorversion{5}
+% \end{macrocode}
+% Legacy name, earlier releases assumed 1.x
+% \begin{macrocode}
+\let\Hy at pdfversion\Hy at pdf@minorversion
+\def\Hy at pdf@majorminor at version{\numexpr100*\Hy at pdf@majorversion+\Hy at pdf@minorversion\relax}
+\def\Hy at pdfmajorminor@version{\numexpr100*\Hy at pdfmajorversion+\Hy at pdfminorversion\relax}
+% \end{macrocode}
+% if \verb|pdfminorversion| is defined, make sure \verb|pdfmajorversion| is too.
+% \begin{macrocode}
+\@ifundefined{pdfminorversion}{}{%
+\@ifundefined{pdfmajorversion}{%
+\newcount\pdfmajorversion
+\pdfmajorversion=1
+}{}%
+}
+\ifx\pdfmajorversion\@undefined\else
+\def\Hy at pdfmajorversion{\pdfmajorversion}
+\fi
% \end{macrocode}
%
% \section{Options for different drivers}\label{drivers}
@@ -7202,7 +7223,7 @@
%
% \begin{macrocode}
\ifHy at pdfa
- \ifnum \Hy at pdfversion < 4
+ \ifnum \Hy at pdf@majorminor at version< 104
\kvsetkeys{Hyp}{pdfversion=1.4}%
\fi
\Hy at DisableOption{pdfversion}%
@@ -9125,7 +9146,7 @@
\kv at parse{#1}{%
\Hy at pdfstringdef\kv at key\kv at key
\ifx\kv at value\relax
- \ifnum\Hy at pdfversion<3 % implementation note 122, PDF spec 1.7
+ \ifnum\Hy at pdf@majorminor at version<103 % implementation note 122, PDF spec 1.7
\xdef\Fld at choices{\Fld at choices[(\kv at key)(\kv at key)]}%
\else
\xdef\Fld at choices{\Fld at choices(\kv at key)}%
@@ -13669,12 +13690,12 @@
}%
}{%
\ifHy at ocgcolorlinks
- \ifnum\Hy at pdfminorversion<5 %
+ \ifnum\Hy at pdfmajorminor@version<105 %
\kvsetkeys{Hyp}{pdfversion=1.5}%
\fi
\fi
\ifHy at setpdfversion
- \ifnum\Hy at pdfversion<5 %
+ \ifnum\Hy at pdf@majorminor at version<105 %
\ltx at IfUndefined{pdfobjcompresslevel}{%
}{%
\ifHy at verbose
@@ -13682,13 +13703,13 @@
PDF object streams are disabled, because they are%
\MessageBreak
not supported in requested PDF version %
- 1.\Hy at pdfversion
+ \Hy at pdf@majorversion.\Hy at pdf@minorversion
}%
\fi
\pdfobjcompresslevel=\ltx at zero
}%
\fi
- \ifnum\Hy at pdfminorversion=\Hy at pdfversion\relax
+ \ifnum\Hy at pdfmajorminor@version=\Hy at pdf@majorminor at version\relax
\else
\let\Hy at temp\ltx at empty
\def\Hy at temp@A#1#2{%
@@ -13711,10 +13732,11 @@
\Hy at temp@A\pdflastlink{link}%
}%
\ifx\Hy at temp\ltx at empty
- \Hy at pdfminorversion=\Hy at pdfversion\relax
+ \Hy at pdfmajorversion=\Hy at pdf@majorversion\relax
+ \Hy at pdfminorversion=\Hy at pdf@minorversion\relax
\else
\let\Hy at temp@A\ltx at empty
- \ifnum\Hy at pdfversion=4 %
+ \ifnum\Hy at pdf@majorminor at version=104 %
\IfFileExists{pdf14.sty}{%
\def\Hy at temp@A{%
\MessageBreak
@@ -13732,9 +13754,10 @@
The version should be set as early as possible:%
\MessageBreak
\space\space
- \expandafter\string\Hy at pdfminorversion=\Hy at pdfversion
+ \expandafter\string\Hy at pdfmajorversion=\Hy at pdf@majorversion, %
+ \expandafter\string\Hy at pdfminorversion=\Hy at pdf@minorversion
\string\relax
- \ifnum\Hy at pdfversion<5 %
+ \ifnum\Hy at pdf@majorminor at version<105 %
\ltx at ifundefined{pdfobjcompresslevel}{%
}{%
\MessageBreak
@@ -13747,11 +13770,13 @@
\fi
\fi
\PackageInfo{hyperref}{%
+ \expandafter\string\Hy at pdfmajorversion.%
\expandafter\string\Hy at pdfminorversion
- :=\number\Hy at pdfversion\space
+ :=\number\Hy at pdf@majorversion.\number\Hy at pdf@minorversion\space
}%
\fi
- \edef\Hy at pdfversion{\number\Hy at pdfminorversion}%
+ \edef\Hy at pdf@majorversion{\number\Hy at pdfmajorversion}%
+ \edef\Hy at pdf@minorversion{\number\Hy at pdfminorversion}%
}
\Hy at DisableOption{pdfversion}%
% \end{macrocode}
@@ -19802,7 +19827,7 @@
% \begin{macrocode}
\def\PDFForm@@Name#1{%
\begingroup
- \ifnum\Hy at pdfversion<5 % implementation note 117, PDF spec 1.7
+ \ifnum\Hy at pdf@majorminor at version<105 % implementation note 117, PDF spec 1.7
\ifHy at unicode
\Hy at unicodefalse
\fi
diff --git a/testfiles/87-pdf2.luatex.tlg b/testfiles/87-pdf2.luatex.tlg
new file mode 100644
index 0000000..70d1cb3
--- /dev/null
+++ b/testfiles/87-pdf2.luatex.tlg
@@ -0,0 +1,8 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+> 2.
+<recently read> [internal backend integer]
+l. ... \expandafter\showthe\pdfvariable majorversion
+> 0.
+<recently read> [internal backend integer]
+l. ... \expandafter\showthe\pdfvariable minorversion
More information about the latex3-commits
mailing list