[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add PDF compression interfaces (79c8e79)

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Sep 1 10:49:23 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/79c8e79aa40b25983d770185facd7547bc88d2a1

>---------------------------------------------------------------

commit 79c8e79aa40b25983d770185facd7547bc88d2a1
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sat Sep 1 09:40:48 2018 +0100

    Add PDF compression interfaces


>---------------------------------------------------------------

79c8e79aa40b25983d770185facd7547bc88d2a1
 l3kernel/l3drivers.dtx                  |   92 +++++++++++++++++++++++++++++++
 l3kernel/testfiles/m3expl001.luatex.tlg |    4 ++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    3 +
 l3kernel/testfiles/m3expl001.tlg        |    4 ++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    3 +
 l3kernel/testfiles/m3expl001.xetex.tlg  |    3 +
 l3kernel/testfiles/m3expl003.luatex.tlg |    4 ++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    3 +
 l3kernel/testfiles/m3expl003.tlg        |    4 ++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    3 +
 l3kernel/testfiles/m3expl003.xetex.tlg  |    3 +
 11 files changed, 126 insertions(+)

diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index 9e0e34c..43d2bdf 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -468,6 +468,30 @@
 % As such, the functions provided here are all defined to do nothing with the
 % latter drivers.
 %
+% \subsection{PDF structure}
+%
+% \begin{function}{\driver_pdf_compresslevel:n}
+%   \begin{syntax}
+%     \cs{driver_pdf_compresslevel:n} \Arg{level}
+%   \end{syntax}
+%   Sets the degree of compression used for PDF files: the \meta{level} should
+%   be in the range $0$ to $9$ (higher is more compression). Typically, either
+%   compression is disables ($0$) or maximised ($9$). When used with
+%   \texttt{(x)dvipdfmx}, this setting may only be applied globally: it should
+%   be set only once.
+% \end{function}
+%
+% \begin{function}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:}
+%   \begin{syntax}
+%     \cs{driver_pdf_objects_disable:}
+%   \end{syntax}
+%   Enables or disables the creation of PDF objects. These objects are used to
+%   reduce the size of PDFs, and typically are enabled as standard. When used
+%   with \texttt{(x)dvipdfmx}, object creation can be disabled but not
+%   re-enabled, and this setting may only be applied globally: it should
+%   be set only once.
+% \end{function}
+%
 % \end{documentation}
 %
 % \begin{implementation}
@@ -1332,6 +1356,19 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \subsubsection{PDF Features}
+%
+% \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:Npx \driver_pdf_compresslevel:n #1 { }
+\cs_new_protected:Npn \driver_pdf_objects_enable: { }
+\cs_new_protected:Npn \driver_pdf_objects_disable: { }
+%    \end{macrocode}
+% \end{macrocode}
+% \end{macrocode}
+%
 %    \begin{macrocode}
 %</dvips>
 %    \end{macrocode}
@@ -1604,6 +1641,35 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \subsubsection{PDF Structure}
+%
+% \begin{macro}{\driver_pdf_compresslevel:n}
+% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:}
+% \begin{macro}{\@@_pdf_objectlevel:n}
+%   Simply pass data to the engine.
+%    \begin{macrocode}
+\cs_new_protected:Npx \driver_pdf_compresslevel:n #1
+  {
+    \cs_if_exist:NTF \tex_pdfcompresslevel:D
+      { \tex_pdfcompresslevel:D }
+      { \tex_pdfvariable:D compresslevel }
+      \exp_not:N \int_value:w \exp_not:N \int_eval:n {#1} \scan_stop:
+  }
+\cs_new_protected:Npn \driver_pdf_objects_enable:
+  { \@@_pdf_objectlevel:n { 2 } }
+\cs_new_protected:Npn \driver_pdf_objects_disable:
+  { \@@_pdf_objectlevel:n { 0 } }
+\cs_new_protected:Npx \@@_pdf_objectlevel:n #1
+  {
+    \cs_if_exist:NTF \tex_pdfobjcompresslevel:D
+      { \tex_pdfobjcompresslevel:D }
+      { \tex_pdfvariable:D objcompresslevel }
+      #1 \scan_stop:
+  }
+%    \end{macrocode}
+% \end{macrocode}
+% \end{macrocode}
+%
 %    \begin{macrocode}
 %</pdfmode>
 %    \end{macrocode}
@@ -1850,6 +1916,20 @@
 % \end{macro}
 % \end{macro}
 %
+% \subsubsection{PDF Structure}
+%
+% \begin{macro}{\driver_pdf_compresslevel:n}
+% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:}
+%   Pass data to the driver: these are a one-shot.
+%    \begin{macrocode}
+\cs_new_protected:Npn \driver_pdf_compresslevel:n #1
+  { \@@_literal:x { dvipdfmx:config~z~ \int_eval:n {#1} } }
+\cs_new_protected:Npn \driver_pdf_objects_enable: { }
+\cs_new_protected:Npn \driver_pdf_objects_disable:
+  { \@@_literal:n { dvipdfmx:config~C~0x40 } }
+%    \end{macrocode}
+% \end{macrocode}
+%
 %    \begin{macrocode}
 %</dvipdfmx|xdvipdfmx>
 %    \end{macrocode}
@@ -2604,7 +2684,19 @@
 %
 % \subsubsection{PDF Features}
 %
+% \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:Npx \driver_pdf_compresslevel:n #1 { }
+\cs_new_protected:Npn \driver_pdf_objects_enable: { }
+\cs_new_protected:Npn \driver_pdf_objects_disable: { }
+%    \end{macrocode}
+% \end{macrocode}
+% \end{macrocode}
+%
 % \subsubsection{Drawing}
+%
 % \begin{macro}{\@@_draw_literal:n, \@@_draw_literal:x}
 %   The same as the more general literal call.
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 1439c14..6dec570 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -6144,6 +6144,10 @@ Defining \__driver_image_getbb_auxii:n on line ...
 Defining \__driver_image_include_jpg:n on line ...
 Defining \__driver_image_include_pdf:n on line ...
 Defining \__driver_image_include_png:n on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
+Defining \__driver_pdf_objectlevel:n on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 6058a58..006c876 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -6177,6 +6177,9 @@ Defining \__driver_image_include_auxi:nn on line ...
 Defining \__driver_image_include_auxii:nnn on line ...
 Defining \__driver_image_include_auxii:xnn on line ...
 Defining \__driver_image_include_auxiii:nnn on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 90fb415..e7494b4 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -6382,6 +6382,10 @@ Defining \__driver_image_getbb_auxii:n on line ...
 Defining \__driver_image_include_jpg:n on line ...
 Defining \__driver_image_include_pdf:n on line ...
 Defining \__driver_image_include_png:n on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
+Defining \__driver_pdf_objectlevel:n on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 7ea0bb0..2187ccf 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -6375,6 +6375,9 @@ Defining \__driver_image_include_auxi:nn on line ...
 Defining \__driver_image_include_auxii:nnn on line ...
 Defining \__driver_image_include_auxii:xnn on line ...
 Defining \__driver_image_include_auxiii:nnn on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 9d69c10..d185e73 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -6140,6 +6140,9 @@ Defining \__driver_image_include_auxi:nn on line ...
 Defining \__driver_image_include_auxii:nnn on line ...
 Defining \__driver_image_include_auxii:xnn on line ...
 Defining \__driver_image_include_auxiii:nnn on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
 Defining \__driver_image_getbb_jpg:n on line ...
 Defining \__driver_image_getbb_png:n on line ...
 Defining \__driver_image_getbb_pdf:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 1439c14..6dec570 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -6144,6 +6144,10 @@ Defining \__driver_image_getbb_auxii:n on line ...
 Defining \__driver_image_include_jpg:n on line ...
 Defining \__driver_image_include_pdf:n on line ...
 Defining \__driver_image_include_png:n on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
+Defining \__driver_pdf_objectlevel:n on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 6058a58..006c876 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -6177,6 +6177,9 @@ Defining \__driver_image_include_auxi:nn on line ...
 Defining \__driver_image_include_auxii:nnn on line ...
 Defining \__driver_image_include_auxii:xnn on line ...
 Defining \__driver_image_include_auxiii:nnn on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 90fb415..e7494b4 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -6382,6 +6382,10 @@ Defining \__driver_image_getbb_auxii:n on line ...
 Defining \__driver_image_include_jpg:n on line ...
 Defining \__driver_image_include_pdf:n on line ...
 Defining \__driver_image_include_png:n on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
+Defining \__driver_pdf_objectlevel:n on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 7ea0bb0..2187ccf 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -6375,6 +6375,9 @@ Defining \__driver_image_include_auxi:nn on line ...
 Defining \__driver_image_include_auxii:nnn on line ...
 Defining \__driver_image_include_auxii:xnn on line ...
 Defining \__driver_image_include_auxiii:nnn on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
 Defining \__driver_draw_literal:n on line ...
 Defining \__driver_draw_literal:x on line ...
 Defining \driver_draw_begin: on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 9d69c10..d185e73 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -6140,6 +6140,9 @@ Defining \__driver_image_include_auxi:nn on line ...
 Defining \__driver_image_include_auxii:nnn on line ...
 Defining \__driver_image_include_auxii:xnn on line ...
 Defining \__driver_image_include_auxiii:nnn on line ...
+Defining \driver_pdf_compresslevel:n on line ...
+Defining \driver_pdf_objects_enable: on line ...
+Defining \driver_pdf_objects_disable: on line ...
 Defining \__driver_image_getbb_jpg:n on line ...
 Defining \__driver_image_getbb_png:n on line ...
 Defining \__driver_image_getbb_pdf:n on line ...





More information about the latex3-commits mailing list