[latex3-commits] [git/LaTeX3-latex3-latex3] master: Extend PDF compression control to dvips route (d46c71d09)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Mar 16 12:42:42 CET 2020


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

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

commit d46c71d09565de91e95b8078476c8b57f26fff4b
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Mar 16 11:42:42 2020 +0000

    Extend PDF compression control to dvips route


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

d46c71d09565de91e95b8078476c8b57f26fff4b
 l3backend/CHANGELOG.md      |  2 +-
 l3backend/l3backend-pdf.dtx | 34 +++++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index ad4dd871a..c77c31594 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -7,7 +7,7 @@ this project uses date-based 'snapshot' version identifiers.
 ## [Unreleased]
 
 ### Changed
-- Add advice for PDF compression in DVI mode
+- Extend PDF compression control to `dvips`
 
 ## [2020-03-12]
 
diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index 339720bfd..195aab4aa 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -666,23 +666,31 @@
 %
 % \begin{macro}{\@@_backend_compresslevel:n}
 % \begin{macro}{\@@_backend_compress_objects:n}
-%   These are all no-ops, but can give helpful advice. We make sure we
-%   only give that the once.
+%   Doable for the usual \texttt{ps2pdf} method.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_compresslevel:n #1
+\cs_new_protected:Npx \@@_backend_compresslevel:n #1
   {
-    \__kernel_msg_info:nn { backend } { cannot-set-compression }
-    \cs_gset_protected:Npn \@@_backend_compresslevel:n ##1 { }
-    \cs_gset_protected:Npn \@@_backend_compress_objects:n ##1 { }
+    \int_compare:nNnT {#1} = 0
+      { 
+        \__kernel_backend_literal:n
+          {
+            /setdistillerparams ~ where
+             { pop << /CompressPages ~ false >> setdistillerparams }
+            if
+          }
+      }
   }
-\cs_new_eq:NN \@@_backend_compress_objects:n
-  \@@_backend_compresslevel:n
-\__kernel_msg_new:nnn { backend } { cannot-set-compression }
+\cs_new_protected:Npn \@@_backend_compress_objects:n #1
   {
-    LaTeX~cannot~set~PDF~compression~in~DVI~mode.\\ \\
-    If~you~are~using~"ps2pdf",~add \\ \\
-    \iow_indent:n { -dCompressStreams=false~-dCompressPages=false } \\ \\
-    to~your~command~line~call.
+    \bool_if:nF {#1}
+      { 
+        \__kernel_backend_literal:n
+          {
+            /setdistillerparams ~ where
+             { pop << /CompressStreams ~ false >> setdistillerparams }
+            if
+          }
+      }
   }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.