[latex3-commits] [git/LaTeX3-latex3-latex3] main: Correct \color_ensure_current: on DVI routes (fixes #1085) (ec921ae01)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Apr 14 14:40:36 CEST 2022
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/ec921ae018936823a5e18e9ebb61dfce85a53186
>---------------------------------------------------------------
commit ec921ae018936823a5e18e9ebb61dfce85a53186
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Thu Apr 14 13:40:36 2022 +0100
Correct \color_ensure_current: on DVI routes (fixes #1085)
>---------------------------------------------------------------
ec921ae018936823a5e18e9ebb61dfce85a53186
l3backend/CHANGELOG.md | 3 +++
l3backend/l3backend-color.dtx | 22 +++++++++++++++++--
.../m3color005.etex-dvips.tlg} | 23 ++++++++++++--------
.../m3color005.etex-dvisvgm.tlg} | 22 +++++++++++--------
.../testfiles-backend/m3color005.lvt | 25 +++++++++-------------
.../m3color005.ptex.tlg} | 23 ++++++++++++--------
.../m3color005.tlg} | 22 +++++++++++--------
.../m3color005.uptex.tlg} | 23 ++++++++++++--------
.../m3color005.xetex.tlg} | 22 +++++++++++--------
9 files changed, 114 insertions(+), 71 deletions(-)
diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 596d0b81f..3772ac371 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -9,6 +9,9 @@ this project uses date-based 'snapshot' version identifiers.
### Added
- Support for SVG graphic inclusion by `dvisvgm`
+### Fixed
+- `\color_ensure_current:` backend with DVI-based routes (issue \#1085)
+
## [2022-04-10]
### Added
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 815b41302..22d8c5cef 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -91,8 +91,8 @@
{
\tl_set:Nx #1
{
+ { named }
{ \exp_after:wN \use:n \current at color }
- { 1 }
}
}
{
@@ -353,18 +353,22 @@
% {
% \@@_backend_select_cmyk:n ,
% \@@_backend_select_gray:n ,
+% \@@_backend_select_named:n ,
% \@@_backend_select_rgb:n ,
% \@@_backend_select:n
% }
% \begin{macro}{\@@_backend_reset:}
% \begin{macro}{color.sc}
% Push the data to the stack. In the case of \texttt{dvips} also saves the
-% drawing color in raw PostScript.
+% drawing color in raw PostScript. The |spot| model is for handling data
+% in classical format.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
{ \@@_backend_select:n { cmyk ~ #1 } }
\cs_new_protected:Npn \@@_backend_select_gray:n #1
{ \@@_backend_select:n { gray ~ #1 } }
+\cs_new_protected:Npn \@@_backend_select_named:n #1
+ { \@@_backend_select:n { ~ #1 } }
\cs_new_protected:Npn \@@_backend_select_rgb:n #1
{ \@@_backend_select:n { rgb ~ #1 } }
\cs_new_protected:Npn \@@_backend_select:n #1
@@ -427,6 +431,20 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\@@_backend_select_named:n}
+% For classical named colors, the only value we should get is |Black|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select_named:n #1
+ {
+ \str_if_eq:nnTF {#1} { Black }
+ { \@@_backend_select_gray:n { 0 } }
+ { \msg_error:nnn { color } { unknown-named-color } {#1} }
+ }
+\msg_new:nnn { color } { unknown-named-color }
+ { Named~color~'#1'~is~not~known. }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
diff --git a/l3kernel/testfiles/m3text005.luatex.tlg b/l3kernel/testfiles-backend/m3color005.etex-dvips.tlg
similarity index 51%
copy from l3kernel/testfiles/m3text005.luatex.tlg
copy to l3kernel/testfiles-backend/m3color005.etex-dvips.tlg
index 1cf8e241e..67e985b10 100644
--- a/l3kernel/testfiles/m3text005.luatex.tlg
+++ b/l3kernel/testfiles-backend/m3color005.etex-dvips.tlg
@@ -2,14 +2,19 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Joseph Wright
============================================================
-TEST 1: \@uclclist\ entries
+TEST 1: Current color
============================================================
-ё\cyryo
-Ё\CYRYO
-Ё\cyryo
-Ё\CYRYO
-ё\cyryo
-Ё\CYRYO
-Ё\cyryo
-Ё\cyryo
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0}
+.\special{ps:SDict begin /color.sc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box
+l. ... }
============================================================
diff --git a/l3kernel/testfiles/m3text005.ptex.tlg b/l3kernel/testfiles-backend/m3color005.etex-dvisvgm.tlg
similarity index 56%
copy from l3kernel/testfiles/m3text005.ptex.tlg
copy to l3kernel/testfiles-backend/m3color005.etex-dvisvgm.tlg
index 5735cebe5..468ac5dad 100644
--- a/l3kernel/testfiles/m3text005.ptex.tlg
+++ b/l3kernel/testfiles-backend/m3color005.etex-dvisvgm.tlg
@@ -2,14 +2,18 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Joseph Wright
============================================================
-TEST 1: \@uclclist\ entries
+TEST 1: Current color
============================================================
-Ё\cyryo
-Ё\CYRYO
-Ё\CYRYO
-Ё\CYRYO
-ё\cyryo
-ё\CYRYO
-ё\CYRYO
-ё\CYRYO
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box
+l. ... }
============================================================
diff --git a/l3experimental/l3opacity/testfiles/m3opacity001.lvt b/l3kernel/testfiles-backend/m3color005.lvt
similarity index 58%
copy from l3experimental/l3opacity/testfiles/m3opacity001.lvt
copy to l3kernel/testfiles-backend/m3color005.lvt
index 0b9e21e92..b6b0e9db5 100644
--- a/l3experimental/l3opacity/testfiles/m3opacity001.lvt
+++ b/l3kernel/testfiles-backend/m3color005.lvt
@@ -1,5 +1,5 @@
%
-% Copyright (C) 2021 The LaTeX Project
+% Copyright (C) 2022 The LaTeX Project
%
\documentclass{minimal}
@@ -7,9 +7,15 @@
\input{regression-test}
\RequirePackage[enable-debug]{expl3}
-\RequirePackage{l3opacity}
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation , log-functions }
+\ExplSyntaxOff
+
+\START
+
+\AUTHOR{Joseph Wright}
+
+\ExplSyntaxOn
\OMIT
\cs_set_protected:Npn \test:n #1
@@ -25,20 +31,9 @@
}
\TIMO
-\START
-
-\AUTHOR{Joseph ~ Wright}
-
-\ExplSyntaxOn
-
-\TEST { Select }
+\TEST { Current~color }
{
- \clist_map_inline:nn { 1 , 0.5 , 2 , -1 }
- {
- \test:n { \opacity_select:n {#1} }
- \test:n { \opacity_fill:n {#1} }
- \test:n { \opacity_stroke:n {#1} }
- }
+ \test:n { \color_ensure_current: }
}
\END
diff --git a/l3kernel/testfiles/m3text005.luatex.tlg b/l3kernel/testfiles-backend/m3color005.ptex.tlg
similarity index 51%
copy from l3kernel/testfiles/m3text005.luatex.tlg
copy to l3kernel/testfiles-backend/m3color005.ptex.tlg
index 1cf8e241e..67e985b10 100644
--- a/l3kernel/testfiles/m3text005.luatex.tlg
+++ b/l3kernel/testfiles-backend/m3color005.ptex.tlg
@@ -2,14 +2,19 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Joseph Wright
============================================================
-TEST 1: \@uclclist\ entries
+TEST 1: Current color
============================================================
-ё\cyryo
-Ё\CYRYO
-Ё\cyryo
-Ё\CYRYO
-ё\cyryo
-Ё\CYRYO
-Ё\cyryo
-Ё\cyryo
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0}
+.\special{ps:SDict begin /color.sc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box
+l. ... }
============================================================
diff --git a/l3kernel/testfiles/m3text005.ptex.tlg b/l3kernel/testfiles-backend/m3color005.tlg
similarity index 55%
copy from l3kernel/testfiles/m3text005.ptex.tlg
copy to l3kernel/testfiles-backend/m3color005.tlg
index 5735cebe5..9e0608d71 100644
--- a/l3kernel/testfiles/m3text005.ptex.tlg
+++ b/l3kernel/testfiles-backend/m3color005.tlg
@@ -2,14 +2,18 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Joseph Wright
============================================================
-TEST 1: \@uclclist\ entries
+TEST 1: Current color
============================================================
-Ё\cyryo
-Ё\CYRYO
-Ё\CYRYO
-Ё\CYRYO
-ё\cyryo
-ё\CYRYO
-ё\CYRYO
-ё\CYRYO
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0 g 0 G}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box
+l. ... }
============================================================
diff --git a/l3kernel/testfiles/m3text005.luatex.tlg b/l3kernel/testfiles-backend/m3color005.uptex.tlg
similarity index 51%
copy from l3kernel/testfiles/m3text005.luatex.tlg
copy to l3kernel/testfiles-backend/m3color005.uptex.tlg
index 1cf8e241e..67e985b10 100644
--- a/l3kernel/testfiles/m3text005.luatex.tlg
+++ b/l3kernel/testfiles-backend/m3color005.uptex.tlg
@@ -2,14 +2,19 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Joseph Wright
============================================================
-TEST 1: \@uclclist\ entries
+TEST 1: Current color
============================================================
-ё\cyryo
-Ё\CYRYO
-Ё\cyryo
-Ё\CYRYO
-ё\cyryo
-Ё\CYRYO
-Ё\cyryo
-Ё\cyryo
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0}
+.\special{ps:SDict begin /color.sc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box
+l. ... }
============================================================
diff --git a/l3kernel/testfiles/m3text005.ptex.tlg b/l3kernel/testfiles-backend/m3color005.xetex.tlg
similarity index 53%
copy from l3kernel/testfiles/m3text005.ptex.tlg
copy to l3kernel/testfiles-backend/m3color005.xetex.tlg
index 5735cebe5..24db69dde 100644
--- a/l3kernel/testfiles/m3text005.ptex.tlg
+++ b/l3kernel/testfiles-backend/m3color005.xetex.tlg
@@ -2,14 +2,18 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Author: Joseph Wright
============================================================
-TEST 1: \@uclclist\ entries
+TEST 1: Current color
============================================================
-Ё\cyryo
-Ё\CYRYO
-Ё\CYRYO
-Ё\CYRYO
-ё\cyryo
-ё\CYRYO
-ё\CYRYO
-ё\CYRYO
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{pdfcolorstack 1 push (0 g 0 G)}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{pdfcolorstack 1 pop}
+! OK.
+<argument> \l_tmpa_box
+l. ... }
============================================================
More information about the latex3-commits
mailing list.