[latex3-commits] [git/LaTeX3-latex3-latex3] master: Set up PDF objects for dvips (cd4e580)
Joseph Wright
joseph.wright at morningstar2.co.uk
Tue Sep 4 16:30:52 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/cd4e580bcd5a655cfd250b16b0076d440631a155
>---------------------------------------------------------------
commit cd4e580bcd5a655cfd250b16b0076d440631a155
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Sep 4 15:30:52 2018 +0100
Set up PDF objects for dvips
Taken from pdfbase.
>---------------------------------------------------------------
cd4e580bcd5a655cfd250b16b0076d440631a155
l3kernel/l3drivers.dtx | 74 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 62 insertions(+), 12 deletions(-)
diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index c5fc449..29dd26a 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -463,10 +463,9 @@
% A range of PDF features are exposed by \pdfTeX{} and \LuaTeX{} in direct PDF
% output mode, and the vast majority of these are also controllable using
% the \texttt{(x)dvipdfmx} driver (as DVI instructions are converted directly
-% to PDF). They are \emph{not} generally applicable when using \texttt{dvips}
-% (as PostScript is the \enquote{controllable} target) or \texttt{dvisvgm}.
-% As such, the functions provided here are all defined to do nothing with the
-% latter drivers.
+% to PDF). Some of these functions are also available for cases where PDFs
+% are generated by \texttt{dvips}: this depends on being able to pass
+% information through correctly.
%
% \subsection{PDF Objects}
%
@@ -1395,25 +1394,76 @@
%
% \subsubsection{PDF Features}
%
-% \begin{macro}{\driver_pdf_object_new:n}
+% \begin{variable}{\g_@@_pdf_object_int, \g_@@_pdf_object_prop}
+% For tracking objects to allow finalisation.
+% \begin{macrocode}
+\int_new:N \g_@@_pdf_object_int
+\prop_new:N \g_@@_pdf_object_prop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\driver_pdf_object_new:nn}
% \begin{macro}[EXP]{\driver_pdf_object_ref:n}
-% \begin{macro}{\driver_pdf_ojbect_write:nn}
+% Tracking objects is similar to \texttt{dvipdfmx}.
+% \begin{macrocode}
+\cs_new_protected:Npn \driver_pdf_object_new:nn #1#2
+ {
+ \int_gincr:N \g_@@_pdf_object_int
+ \int_const:cn
+ { g_@@_pdf_object_ \tl_to_str:n {#1} _int }
+ { \g_@@_pdf_object_int }
+ \prop_gput:Nnn \g_@@_pdf_object_prop {#1} {#2}
+ }
+\cs_new:Npn \driver_pdf_object_ref:n #1
+ { { l3obj \int_use:c { g_@@_pdf_object_ \tl_to_str:n {#1} _int } } }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\driver_pdf_object_write:nn}
+% This is where we choose the actual type: some work to get things
+% right.
+% \begin{macrocode}
+\cs_new_protected:Npn \driver_pdf_object_write:nn #1#2
+ {
+ \@@_literal:x
+ {
+ ps:mark ~ /_objdef ~ \driver_pdf_object_ref:n {#1} ~
+ /type / \prop_item:Nn \g_@@_pdf_object_prop {#1}
+ /OBJ ~ pdfmark
+ }
+ \@@_literal:x
+ {
+ ps:mark ~ \driver_pdf_object_ref:n {#1} ~
+ \str_case_e:nn
+ { \prop_item:Nn \g_@@_pdf_object_prop {#1} }
+ {
+ { array }
+ {
+ [ ~ \exp_not:n {#2} ~ ]
+ /PUTINTERVAL ~ pdfmark
+ }
+ { dict }
+ {
+ << ~ \exp_not:n {#2} ~ >>
+ /PUT ~ pdfmark
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\driver_pdf_compresslevel:n}
% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:}
% These are all no-ops.
% \begin{macrocode}
-\cs_new_protected:Npn \driver_pdf_object_new:n #1 { }
-\cs_new:Npn \driver_pdf_object_ref:n #1 { }
-\cs_new_protected:Npn \driver_pdf_object_write:nn #1#2 { }
\cs_new_protected:Npn \driver_pdf_compresslevel:n #1 { }
\cs_new_protected:Npn \driver_pdf_objects_enable: { }
\cs_new_protected:Npn \driver_pdf_objects_disable: { }
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \begin{macrocode}
%</dvips>
More information about the latex3-commits
mailing list