[latex3-commits] [latex3/latex3] main: Remove range guard from opacity backend (96bd4f36b)

github at latex-project.org github at latex-project.org
Sat Mar 2 08:27:37 CET 2024


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/96bd4f36bf7b9e3238047536125b7f014efafbce

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

commit 96bd4f36bf7b9e3238047536125b7f014efafbce
Author: Yukai Chou <muzimuzhi at gmail.com>
Date:   Fri Mar 1 05:54:16 2024 +0800

    Remove range guard from opacity backend
    
    Out-of-range opacity expressions raise error in package layer and won't
    go into backend.


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

96bd4f36bf7b9e3238047536125b7f014efafbce
 l3backend/CHANGELOG.md                  |  3 ++
 l3backend/l3backend-opacity.dtx         | 51 ++++++++++++---------------------
 l3kernel/testfiles/m3expl001.luatex.tlg |  2 --
 l3kernel/testfiles/m3expl001.ptex.tlg   |  2 --
 l3kernel/testfiles/m3expl001.tlg        |  2 --
 l3kernel/testfiles/m3expl001.uptex.tlg  |  2 --
 l3kernel/testfiles/m3expl001.xetex.tlg  |  2 --
 l3kernel/testfiles/m3expl003.luatex.tlg |  2 --
 l3kernel/testfiles/m3expl003.ptex.tlg   |  2 --
 l3kernel/testfiles/m3expl003.tlg        |  2 --
 l3kernel/testfiles/m3expl003.uptex.tlg  |  2 --
 l3kernel/testfiles/m3expl003.xetex.tlg  |  2 --
 12 files changed, 22 insertions(+), 52 deletions(-)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 95aba7ae0..50468885e 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Removed
+- Range guard for opacity
+
 ### Fixed
 - Initiation of opacity data (see \#1472)
 - ExtGState setup for stroking opacity (issue \#1472)
diff --git a/l3backend/l3backend-opacity.dtx b/l3backend/l3backend-opacity.dtx
index e0aec11dc..fbcb59011 100644
--- a/l3backend/l3backend-opacity.dtx
+++ b/l3backend/l3backend-opacity.dtx
@@ -71,9 +71,9 @@
 %<*dvips>
 %    \end{macrocode}
 %
-% \begin{macro}{\@@_backend_select:n,\@@_backend_select_aux:n}
+% \begin{macro}{\@@_backend_select:n}
 % \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
-% \begin{macro}{\@@_backend:nnn, \@@_backend:enn}
+% \begin{macro}{\@@_backend:nnn}
 %   No stack so set values directly. The need to deal with Distiller and
 %   Ghostscript separately means we use a common auxiliary: the two
 %   systems require different PostScript for transparency. This is
@@ -82,26 +82,21 @@
 %   for the detail on testing for GhostScript.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_backend_select:n #1
-  {
-    \exp_args:Ne \@@_backend_select_aux:n
-      { \fp_eval:n { min(max(0,#1),1) } }
-  }
-\cs_new_protected:Npn \@@_backend_select_aux:n #1
   {
     \@@_backend:nnn {#1} { fill }   { ca }
     \@@_backend:nnn {#1} { stroke } { CA }
   }
 \cs_new_protected:Npn \@@_backend_fill:n #1
   {
-    \@@_backend:enn
-      { \fp_eval:n { min(max(0,#1),1) } }
+    \@@_backend:nnn
+      { #1 }
       { fill }
       { ca }
   }
 \cs_new_protected:Npn \@@_backend_stroke:n #1
   {
-    \@@_backend:enn
-      { \fp_eval:n { min(max(0,#1),1) } }
+    \@@_backend:nnn
+      { #1 }
       { stroke }
       { CA }
   }
@@ -124,7 +119,6 @@
         ifelse
       }
   }
-\cs_generate_variant:Nn \@@_backend:nnn { e }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -166,17 +160,11 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{macro}{\@@_backend_select:n, \@@_backend_select_aux:n}
+% \begin{macro}{\@@_backend_select:n}
 % \begin{macro}{\@@_backend_reset:}
-%   Other than the need to evaluate the opacity as an \texttt{fp}, much the
-%   same as color.
+%   Much the same as color.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_backend_select:n #1
-  {
-    \exp_args:Ne \@@_backend_select_aux:n
-      { \fp_eval:n { min(max(0,#1),1) } }
-  }
-\cs_new_protected:Npn \@@_backend_select_aux:n #1
   {
     \tl_set:Nn \l_@@_backend_fill_tl {#1}
     \tl_set:Nn \l_@@_backend_stroke_tl {#1}
@@ -207,26 +195,26 @@
 % \end{macro}
 %
 % \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
-% \begin{macro}{\@@_backend_fill_stroke:nn, \@@_backend_fill_stroke:ee}
+% \begin{macro}{\@@_backend_fill_stroke:nn}
 %   For separate fill and stroke, we need to work out if we need to do
 %   more work or if we can stick to a single setting.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_backend_fill:n #1
   {
-    \@@_backend_fill_stroke:ee
-      { \fp_eval:n { min(max(0,#1),1) } }
-      \l_@@_backend_stroke_tl
+    \exp_args:Nno \@@_backend_fill_stroke:nn
+      { #1 }
+      { \l_@@_backend_stroke_tl }
   }
 \cs_new_protected:Npn \@@_backend_stroke:n #1
   {
-    \@@_backend_fill_stroke:ee
-      \l_@@_backend_fill_tl
-      { \fp_eval:n { min(max(0,#1),1) } }
+    \exp_args:No \@@_backend_fill_stroke:nn
+      { \l_@@_backend_fill_tl }
+      { #1 }
   }
 \cs_new_protected:Npn \@@_backend_fill_stroke:nn #1#2
   {
     \str_if_eq:nnTF {#1} {#2}
-      { \@@_backend_select_aux:n {#1} }
+      { \@@_backend_select:n {#1} }
       {
         \tl_set:Nn \l_@@_backend_fill_tl {#1}
         \tl_set:Nn \l_@@_backend_stroke_tl {#2}
@@ -246,12 +234,11 @@
         \group_insert_after:N \@@_backend_reset:
       }
   }
-\cs_generate_variant:Nn \@@_backend_fill_stroke:nn { ee }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\@@_backend_select_aux:n, \@@_backend_fill_stroke:nn}
+% \begin{macro}{\@@_backend_select:n, \@@_backend_fill_stroke:nn}
 %   Redefine them to stubs if pdfmanagement is either not loaded or
 %   deactivated.
 %    \begin{macrocode}
@@ -259,7 +246,7 @@
   { \cs_if_exist_p:N \pdfmanagement_if_active_p: }
   { \pdfmanagement_if_active_p: }
   {
-    \cs_gset_protected:Npn \@@_backend_select_aux:n #1 { }
+    \cs_gset_protected:Npn \@@_backend_select:n #1 { }
     \cs_gset_protected:Npn \@@_backend_fill_stroke:nn #1#2 { }
   }
 %    \end{macrocode}
@@ -285,7 +272,7 @@
 \cs_new_protected:Npn \@@_backend_stroke:n #1
   { \@@_backend:nn {#1} { stroke- } }
 \cs_new_protected:Npn \@@_backend:nn #1#2
-  { \__kernel_backend_scope:e { #2 opacity = " \fp_eval:n { min(max(0,#1),1) } " } }
+  { \__kernel_backend_scope:e { #2 opacity = " #1 " } }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index b16903307..b6f31c6b2 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -172,10 +172,8 @@ Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \l__opacity_backend_fill_tl on line ...
 Defining \l__opacity_backend_stroke_tl on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_reset: on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend_fill_stroke:nn on line ...
-Defining \__opacity_backend_fill_stroke:ee on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index abbe426df..27758664f 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -182,9 +182,7 @@ Defining \__pdf_backend_bdc:nn on line ...
 Defining \__pdf_backend_emc: on line ...
 Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend:nnn on line ...
-Defining \__opacity_backend:enn on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 40fe48cc4..01a13748b 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -172,10 +172,8 @@ Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \l__opacity_backend_fill_tl on line ...
 Defining \l__opacity_backend_stroke_tl on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_reset: on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend_fill_stroke:nn on line ...
-Defining \__opacity_backend_fill_stroke:ee on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index abbe426df..27758664f 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -182,9 +182,7 @@ Defining \__pdf_backend_bdc:nn on line ...
 Defining \__pdf_backend_emc: on line ...
 Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend:nnn on line ...
-Defining \__opacity_backend:enn on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 4a3a70f69..2c9b6f908 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -183,10 +183,8 @@ Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \l__opacity_backend_fill_tl on line ...
 Defining \l__opacity_backend_stroke_tl on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_reset: on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend_fill_stroke:nn on line ...
-Defining \__opacity_backend_fill_stroke:ee on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index b16903307..b6f31c6b2 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -172,10 +172,8 @@ Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \l__opacity_backend_fill_tl on line ...
 Defining \l__opacity_backend_stroke_tl on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_reset: on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend_fill_stroke:nn on line ...
-Defining \__opacity_backend_fill_stroke:ee on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index abbe426df..27758664f 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -182,9 +182,7 @@ Defining \__pdf_backend_bdc:nn on line ...
 Defining \__pdf_backend_emc: on line ...
 Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend:nnn on line ...
-Defining \__opacity_backend:enn on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 40fe48cc4..01a13748b 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -172,10 +172,8 @@ Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \l__opacity_backend_fill_tl on line ...
 Defining \l__opacity_backend_stroke_tl on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_reset: on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend_fill_stroke:nn on line ...
-Defining \__opacity_backend_fill_stroke:ee on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index abbe426df..27758664f 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -182,9 +182,7 @@ Defining \__pdf_backend_bdc:nn on line ...
 Defining \__pdf_backend_emc: on line ...
 Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend:nnn on line ...
-Defining \__opacity_backend:enn on line ...
 ))
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 4a3a70f69..2c9b6f908 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -183,10 +183,8 @@ Defining \__pdf_backend_pagesize_gset:nn on line ...
 Defining \l__opacity_backend_fill_tl on line ...
 Defining \l__opacity_backend_stroke_tl on line ...
 Defining \__opacity_backend_select:n on line ...
-Defining \__opacity_backend_select_aux:n on line ...
 Defining \__opacity_backend_reset: on line ...
 Defining \__opacity_backend_fill:n on line ...
 Defining \__opacity_backend_stroke:n on line ...
 Defining \__opacity_backend_fill_stroke:nn on line ...
-Defining \__opacity_backend_fill_stroke:ee on line ...
 ))





More information about the latex3-commits mailing list.