[latex3-commits] [git/LaTeX3-latex3-latex3] master: Move dvips link-break code to a dedicated hook (946f70d)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sun May 5 21:07:42 CEST 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/946f70d88bff5227db01b0cc509de34f55c46ee1
>---------------------------------------------------------------
commit 946f70d88bff5227db01b0cc509de34f55c46ee1
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun May 5 20:07:09 2019 +0100
Move dvips link-break code to a dedicated hook
>---------------------------------------------------------------
946f70d88bff5227db01b0cc509de34f55c46ee1
l3kernel/l3drivers-pdf.dtx | 94 ++++++++++++++++++++++++++++++--------------
1 file changed, 65 insertions(+), 29 deletions(-)
diff --git a/l3kernel/l3drivers-pdf.dtx b/l3kernel/l3drivers-pdf.dtx
index 33d3463..33492f7 100644
--- a/l3kernel/l3drivers-pdf.dtx
+++ b/l3kernel/l3drivers-pdf.dtx
@@ -854,6 +854,33 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_breaklink_obj_tl, \l_@@_breaklink_pdfmark_tl}
+% Swappable content for link breaking.
+% \begin{macrocode}
+\tl_new:N \l_@@_breaklink_obj_tl
+\tl_set:Nn \l_@@_breaklink_obj_tl
+ { /_objdef ~ { driver.obj \int_use:N \g_@@_pdf_link_int } }
+\tl_new:N \l_@@_breaklink_pdfmark_tl
+\tl_set:Nn \l_@@_breaklink_pdfmark_tl { pdfmark }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_breaklink_postscript:n, \@@_breaklink_postscript:x}
+% To allow dropping material unless link breaking is active.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_breaklink_postscript:n #1 { }
+\cs_generate_variant:Nn \@@_breaklink_postscript:n { x }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_breaklink_usebox:N}
+% Swappable box unpacking or use.
+% \begin{macrocode}
+\cs_new_eq:NN \@@_breaklink_usebox:N \box_use:N
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\driver_pdf_link_begin_goto:nnw, \driver_pdf_link_begin_user:nnw}
% \begin{macro}{\@@_pdf_link:nw, \@@_pdf_link_aux:nw}
% \begin{macro}{\driver_pdf_link_end:, \@@_pdf_link_end:}
@@ -907,16 +934,6 @@
\@@_pdf_annotation:nnnn { 3pt } { 3pt } { 0pt } { }
\@@_postscript:n
{ /driver.link.dict ( #1 ) def }
- \int_gincr:N \g_@@_pdf_object_int
- \int_gset_eq:NN \g_@@_pdf_link_int \g_@@_pdf_object_int
- \@@_postscript:x
- {
- /driver.link.obj
- {
- { driver.obj \int_use:N \g_@@_pdf_link_int \c_space_tl driver.cvs }
- }
- def
- }
\tl_gset:Nn \g_@@_pdf_link_dict_tl {#1}
\@@_pdf_link_sf_save:
\mode_if_math:TF
@@ -953,20 +970,31 @@
}
\box_move_down:nn { \box_dp:N \l_@@_pdf_content_box }
{ \hbox:n { \@@_postscript:n { driver.save.linkll } } }
- \@@_postscript:n { driver.bordertracking.begin }
- \hbox_unpack:N \l_@@_pdf_content_box
- \@@_postscript:n { driver.bordertracking.end }
+ \@@_breaklink_postscript:n { driver.bordertracking.begin }
+ \@@_breaklink_usebox:N \l_@@_pdf_content_box
+ \@@_breaklink_postscript:n { driver.bordertracking.end }
\box_move_up:nn { \box_ht:N \l_@@_pdf_content_box }
{
\hbox:n
{ \@@_postscript:n { driver.save.linkur } }
}
+ \int_gincr:N \g_@@_pdf_object_int
+ \int_gset_eq:NN \g_@@_pdf_link_int \g_@@_pdf_object_int
+ \@@_breaklink_postscript:x
+ {
+ /driver.link.obj
+ {
+ { driver.obj \int_use:N \g_@@_pdf_link_int \c_space_tl driver.cvs }
+ }
+ def
+ }
\@@_postscript:x
{
mark
+ \l_@@_breaklink_obj_tl
\g_@@_pdf_link_dict_tl \c_space_tl
driver.rect
- /ANN ~ driver.pdfmark
+ /ANN ~ \l_@@_breaklink_pdfmark_tl
}
\@@_pdf_link_sf_restore:
\bool_gset_false:N \g_@@_pdf_link_bool
@@ -1050,31 +1078,39 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@makecol}
+% \begin{macro}{\@makecol at hook}
% Hooks to allow link breaking: something will be needed in format mode
-% at some stage. WE can only hook in to \LaTeXe{}, so skip this if
-% the format lacks \tn{@makecol}.
+% at some stage. At present this code is disabled as there is an open
+% question about the name of the hook: to be resolved at the \LaTeXe{}
+% end.
% \begin{macrocode}
%<*package>
-\cs_if_exist:NT \@makecol
+\use_none:n
{
- \tl_gput_left:Nn \@makecol
+ \cs_if_exist:NT \@makecol at hook
{
- \box_if_empty:NF \@cclv
+ \tl_put_right:Nn \@makecol at hook
{
- \vbox_set:Nn \@cclv
+ \box_if_empty:NF \@cclv
{
- \@@_postscript:n
+ \vbox_set:Nn \@cclv
{
- driver.globaldict /driver.brokenlink.rect ~ known
- { driver.bordertracking.continue }
- if
+ \@@_postscript:n
+ {
+ driver.globaldict /driver.brokenlink.rect ~ known
+ { driver.bordertracking.continue }
+ if
+ }
+ \vbox_unpack_drop:N \@cclv
+ \@@_postscript:n
+ { driver.bordertracking.endpage }
}
- \vbox_unpack_drop:N \@cclv
- \@@_postscript:n
- { driver.bordertracking.endpage }
- }
}
+ }
+ \tl_clear:N \l_@@_breaklink_obj_tl
+ \tl_set:Nn \l_@@_breaklink_pdfmark_tl { driver.pdfmark }
+ \cs_set_eq:NN \@@_breaklink_postscript:n \@@_postscript:n
+ \cs_set_eq:NN \@@_breaklink_usebox:N \hbox_unpack:N
}
}
%</package>
More information about the latex3-commits
mailing list