[latex3-commits] [git/LaTeX3-latex3-latex3] master: Support for link margins (a5437c2)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Apr 11 22:21:44 CEST 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/a5437c2d10e73d01864c746d81e528fb9e003850
>---------------------------------------------------------------
commit a5437c2d10e73d01864c746d81e528fb9e003850
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Thu Apr 11 21:21:44 2019 +0100
Support for link margins
>---------------------------------------------------------------
a5437c2d10e73d01864c746d81e528fb9e003850
l3kernel/l3drivers-pdf.dtx | 52 +++++++++++++++++++++++++++++++
l3kernel/l3drivers.dtx | 10 ++++++
l3kernel/testfiles/m3expl001.luatex.tlg | 1 +
l3kernel/testfiles/m3expl001.ptex.tlg | 1 +
l3kernel/testfiles/m3expl001.tlg | 1 +
l3kernel/testfiles/m3expl001.uptex.tlg | 1 +
l3kernel/testfiles/m3expl001.xetex.tlg | 1 +
l3kernel/testfiles/m3expl003.luatex.tlg | 1 +
l3kernel/testfiles/m3expl003.ptex.tlg | 1 +
l3kernel/testfiles/m3expl003.tlg | 1 +
l3kernel/testfiles/m3expl003.uptex.tlg | 1 +
l3kernel/testfiles/m3expl003.xetex.tlg | 1 +
12 files changed, 72 insertions(+)
diff --git a/l3kernel/l3drivers-pdf.dtx b/l3kernel/l3drivers-pdf.dtx
index b618835..91ad623 100644
--- a/l3kernel/l3drivers-pdf.dtx
+++ b/l3kernel/l3drivers-pdf.dtx
@@ -167,6 +167,21 @@
% In \texttt{dvips}, annotations have to be constructed manually. As such,
% we need the object code above for some definitions.
%
+% \begin{macro}{driver.dvi.pdf, driver.pdf.dvi, driver.linkmargin}
+% The link margin size has to be defined at the off: default as for
+% \pdfTeX{}. The size conversions have to be done in PostScript as
+% there can be a magnification active.
+% \begin{macrocode}
+\@@_literal:x
+ {
+ !
+ /driver.dvi.pdf ~ { 72.27 ~ mul ~ Resolution ~ div } ~ def ~
+ /driver.pdf.dvi ~ { 72.27 ~ div ~ Resolution ~ mul } ~ def ~
+ /driver.linkmargin ~ { 1 ~ driver.pdf.dvi } ~ def
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{variable}{\l_@@_tmp_box}
% A box for creating annotations.
% \begin{macrocode}
@@ -204,7 +219,9 @@
\@@_postscript:n
{
currentpoint ~
+ driver.linkmargin ~ add ~
/driver.lly ~ exch ~ def ~
+ driver.linkmargin ~ sub ~
/driver.llx ~ exch ~ def
}
}
@@ -217,7 +234,9 @@
\@@_postscript:n
{
currentpoint ~
+ driver.linkmargin ~ sub ~
/driver.ury ~ exch ~ def ~
+ driver.linkmargin ~ add ~
/driver.urx ~ exch ~ def
}
}
@@ -289,6 +308,19 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\driver_pdf_link_margin:n}
+% Convert to big points and pass to PostScript.
+% \begin{macrocode}
+\cs_new_protected:Npn \driver_pdf_link_margin:n #1
+ {
+ \@@_postscript:x
+ {
+ /driver.linkmargin ~ { \dim_to_decimal:n {#1} ~ driver.pdf.dvi } ~ def
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Structure}
%
% \begin{macro}{\driver_pdf_compresslevel:n}
@@ -389,6 +421,19 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\driver_pdf_link_margin:n}
+% A simple task: pass the data to the primitive.
+% \begin{macrocode}
+\cs_new_protected:Npx \driver_pdf_link_margin:n #1
+ {
+ \cs_if_exist:NTF \tex_pdfvariable:D
+ { \exp_not:N \tex_pdfvariable:D linkmargin }
+ { \exp_not:N \tex_pdflinkmargin:D }
+ \exp_not:N \dim_eval:n {#1} \scan_stop:
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Objects}
%
% \begin{variable}{\g_@@_pdf_object_prop}
@@ -674,6 +719,13 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\driver_pdf_link_margin:n}
+% Nope.
+% \begin{macrocode}
+\cs_new_protected:Npn \driver_pdf_link_margin:n #1 { }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Structure}
%
% \begin{macro}{\driver_pdf_compresslevel:n}
diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index 75dfe66..65770f4 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -499,6 +499,16 @@
% Expands to the object reference
% \end{function}
%
+% \begin{function}[EXP, added = 2019-04-11]{\driver_pdf_link_margin:n}
+% \begin{syntax}
+% \cs{driver_pdf_link_margin:} \Arg{dimen}
+% \end{syntax}
+% Sets the length of the margin between content and the border of a link.
+% Different back-ends treat the scoping of this value in different ways:
+% \pdfTeX{} and \LuaTeX{} treat it as scoped by \TeX{}, whilst with
+% \texttt{dvips} the scope is managed at the PostScript level.
+% \end{function}
+%
% \subsection{PDF Objects}
%
% Objects are used to provide a range of data structures in a PDF. At the
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 4616541..b1a1c66 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -6468,6 +6468,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link_begin:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \g__driver_pdf_object_prop on line ...
Defining \driver_pdf_object_new:nn on line ...
Defining \driver_pdf_object_ref:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index a5f292d..130459f 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -6525,6 +6525,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \driver_pdf_compresslevel:n on line ...
Defining \driver_pdf_objects_enable: on line ...
Defining \driver_pdf_objects_disable: on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index eab363c..e43db86 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -6809,6 +6809,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link_begin:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \g__driver_pdf_object_prop on line ...
Defining \driver_pdf_object_new:nn on line ...
Defining \driver_pdf_object_ref:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index a0638c3..49b8934 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -6822,6 +6822,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \driver_pdf_compresslevel:n on line ...
Defining \driver_pdf_objects_enable: on line ...
Defining \driver_pdf_objects_disable: on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 953a4fd..e3ca4a8 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -6501,6 +6501,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \driver_pdf_compresslevel:n on line ...
Defining \driver_pdf_objects_enable: on line ...
Defining \driver_pdf_objects_disable: on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 4616541..b1a1c66 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -6468,6 +6468,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link_begin:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \g__driver_pdf_object_prop on line ...
Defining \driver_pdf_object_new:nn on line ...
Defining \driver_pdf_object_ref:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index a5f292d..130459f 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -6525,6 +6525,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \driver_pdf_compresslevel:n on line ...
Defining \driver_pdf_objects_enable: on line ...
Defining \driver_pdf_objects_disable: on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index eab363c..e43db86 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -6809,6 +6809,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link_begin:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \g__driver_pdf_object_prop on line ...
Defining \driver_pdf_object_new:nn on line ...
Defining \driver_pdf_object_ref:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index a0638c3..49b8934 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -6822,6 +6822,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \driver_pdf_compresslevel:n on line ...
Defining \driver_pdf_objects_enable: on line ...
Defining \driver_pdf_objects_disable: on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 953a4fd..e3ca4a8 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -6501,6 +6501,7 @@ Defining \driver_pdf_link_goto:nnn on line ...
Defining \driver_pdf_link_user:nnn on line ...
Defining \__driver_pdf_link:nnnn on line ...
Defining \driver_pdf_link_last: on line ...
+Defining \driver_pdf_link_margin:n on line ...
Defining \driver_pdf_compresslevel:n on line ...
Defining \driver_pdf_objects_enable: on line ...
Defining \driver_pdf_objects_disable: on line ...
More information about the latex3-commits
mailing list