diff options
author | Karl Berry <karl@freefriends.org> | 2024-03-14 20:24:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-03-14 20:24:49 +0000 |
commit | 7bad9b14c550da9ae08669e681e2d94c11bddd9e (patch) | |
tree | ed81b7a7d34eb2da325026d3977131cdb8044c00 /Master/texmf-dist/source/latex/l3backend | |
parent | 2bb8d5e07c328b2737d7e4ba46365bffa060b64f (diff) |
l3 (14mar24)
git-svn-id: svn://tug.org/texlive/trunk@70637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3backend')
8 files changed, 73 insertions, 76 deletions
diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx index c80d51e06d9..4d3b68225ab 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % @@ -70,27 +70,27 @@ % \begin{macrocode} \ProvidesExplFile %<*dvipdfmx> - {l3backend-dvipdfmx.def}{2024-02-20}{} + {l3backend-dvipdfmx.def}{2024-03-14}{} {L3 backend support: dvipdfmx} %</dvipdfmx> %<*dvips> - {l3backend-dvips.def}{2024-02-20}{} + {l3backend-dvips.def}{2024-03-14}{} {L3 backend support: dvips} %</dvips> %<*dvisvgm> - {l3backend-dvisvgm.def}{2024-02-20}{} + {l3backend-dvisvgm.def}{2024-03-14}{} {L3 backend support: dvisvgm} %</dvisvgm> %<*luatex> - {l3backend-luatex.def}{2024-02-20}{} + {l3backend-luatex.def}{2024-03-14}{} {L3 backend support: PDF output (LuaTeX)} %</luatex> %<*pdftex> - {l3backend-pdftex.def}{2024-02-20}{} + {l3backend-pdftex.def}{2024-03-14}{} {L3 backend support: PDF output (pdfTeX)} %</pdftex> %<*xetex> - {l3backend-xetex.def}{2024-02-20}{} + {l3backend-xetex.def}{2024-03-14}{} {L3 backend support: XeTeX} %</xetex> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx index 4b0059c2b9e..3fc3243c422 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx index 907ca91c6ee..eaa89add8cf 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx index ee33a717fef..eef86886f58 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % @@ -68,7 +68,7 @@ % % \begin{macro}{\@@_backend_literal:n, \@@_backend_literal:e} % The same as literal PostScript: same arguments about positioning apply -% her. +% here. % \begin{macrocode} \cs_new_eq:NN \@@_backend_literal:n \__kernel_backend_literal_postscript:n \cs_generate_variant:Nn \@@_backend_literal:n { e } @@ -81,23 +81,20 @@ % but where we can't split material between separate calls. The % |@beginspecial|/|@endspecial| pair are from |special.pro| and correct the % scale and $y$-axis direction. -% In contrast to \pkg{pgf}, we don't save the current point: -% discussion with Tom Rokici suggested a better way to handle the necessary -% translations (see \cs{@@_backend_box_use:Nnnnn}). (Note that -% |@beginspecial|/|@endspecial| forms a backend scope.) The |[begin]|/^^A -% |[end]| lines are handled differently from the rest as they are -% conceptually different: not really drawing literals but instructions to -% \texttt{dvips} itself. +% As for \pkg{pgf}, we need to save the current point as this is +% required for box placement. (Note that +% |@beginspecial|/|@endspecial| forms a backend scope.) % \begin{macrocode} \cs_new_protected:Npn \@@_backend_begin: { - \__kernel_backend_literal:n { ps::[begin] } + \@@_backend_literal:n { [begin] } + \@@_backend_literal:n { /draw.x~currentpoint~/draw.y~exch~def~def } \@@_backend_literal:n { @beginspecial } } \cs_new_protected:Npn \@@_backend_end: { \@@_backend_literal:n { @endspecial } - \__kernel_backend_literal:n { ps::[end] } + \@@_backend_literal:n { [end] } } % \end{macrocode} % \end{macro} @@ -350,21 +347,23 @@ % Inside a picture |@beginspecial|/|@endspecial| are active, which is % normally a good thing but means that the position and scaling would be off % if the box was inserted directly. To deal with that, there are a number of -% possible approaches. The implementation here was suggested by Tom Rokici -% (author of \texttt{dvips}). We end the current special placement, then -% set the current point with a literal |[begin]|. As for general -% literals, we then use the stack to store the current point and move to -% it. To insert the required transformation, we have to flip the $y$-axis, -% once before and once after it. Then we get back to the \TeX{} reference -% point to insert our content. The clean up has to happen in the right -% places, hence the |[begin]|/|[end]| pair around |restore|. Finally, -% we can return to \enquote{normal} drawing mode. Notice that the set up -% here is very similar to that in \cs{@@_align_currentpoint_\ldots}, but -% the ordering of saving and restoring is different (intermixed). +% possible approaches. A previous implementation suggested by Tom Rokici +% used |@endspecial|/|@beginspecial|. This avoids needing internals of +% \texttt{dvips}, but fails if there the box is used inside a scope +% (see \url{https://github.com/latex3/latex3/issues/1504}). Instead, +% we use the same method as \pkg{pgf}, which means tracking the position +% at the PostScript level. Also note that using |@endspecial| would +% close the scope it creates, meaning that after a box insertion, any +% local changes would be lost. Keeping \texttt{dvips} on track is +% non-trivial, hence the |[begin]|/|[end]| pair before the +% |save| and around the |restore|. % \begin{macrocode} \cs_new_protected:Npn \@@_backend_box_use:Nnnnn #1#2#3#4#5 { - \@@_backend_literal:n { @endspecial } + \@@_backend_literal:n { save } + \@@_backend_literal:n { 72~Resolution~div~72~VResolution~div~neg~scale } + \@@_backend_literal:n { magscale { 1~DVImag~div~dup~scale } if } + \@@_backend_literal:n { draw.x~neg~draw.y~neg~translate } \@@_backend_literal:n { [end] } \@@_backend_literal:n { [begin] } \@@_backend_literal:n { save } @@ -380,7 +379,7 @@ \@@_backend_literal:n { restore } \@@_backend_literal:n { [end] } \@@_backend_literal:n { [begin] } - \@@_backend_literal:n { @beginspecial } + \@@_backend_literal:n { restore } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx index cb959169d99..9360bffd2e1 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-header.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-header.dtx index d7b6d4c37c9..84f8ab53b7a 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-header.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-header.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx index 6cc972f7d84..a5828bfd905 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % @@ -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 @@ -83,25 +83,20 @@ % \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} @@ -143,7 +137,7 @@ % \begin{macrocode} \bool_lazy_and:nnT { \cs_if_exist_p:N \pdfmanagement_if_active_p: } - { \pdfmanagement_if_active_p:} + { \pdfmanagement_if_active_p: } { %<*luatex|pdftex> \__kernel_color_backend_stack_init:Nnn \c_@@_backend_stack_int @@ -157,24 +151,21 @@ % % \begin{variable}{\l_@@_backend_fill_tl, \l_@@_backend_stroke_tl} % We use |tl| here for speed: at the backend, this should be reasonable. +% Both need to start off fully opaque. % \begin{macrocode} \tl_new:N \l_@@_backend_fill_tl \tl_new:N \l_@@_backend_stroke_tl +\tl_set:Nn \l_@@_backend_fill_tl { 1 } +\tl_set:Nn \l_@@_backend_stroke_tl { 1 } % \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} \pdfmanagement_add:nnn { Page / Resources / ExtGState } @@ -189,12 +180,6 @@ { /opacity #1 ~ gs } \group_insert_after:N \@@_backend_reset: } -\bool_lazy_and:nnF - { \cs_if_exist_p:N \pdfmanagement_if_active_p: } - { \pdfmanagement_if_active_p:} - { - \cs_gset_protected:Npn \@@_backend_select_aux:n #1 { } - } \cs_new_protected:Npn \@@_backend_reset: { %<*dvipdfmx|xetex> @@ -210,26 +195,26 @@ % \end{macro} % % \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n} -% \begin{macro}{\@@_backend_fillstroke:nn, \@@_backend_fillstroke: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} @@ -237,7 +222,7 @@ { opacity.fill #1 } { << /ca ~ #1 >> } \pdfmanagement_add:nnn { Page / Resources / ExtGState } - { opacity.stroke #1 } + { opacity.stroke #2 } { << /CA ~ #2 >> } %<*dvipdfmx|xetex> \__kernel_backend_literal_pdf:n @@ -249,11 +234,24 @@ \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:n, \@@_backend_fill_stroke:nn} +% Redefine them to stubs if pdfmanagement is either not loaded or +% deactivated. +% \begin{macrocode} +\bool_lazy_and:nnF + { \cs_if_exist_p:N \pdfmanagement_if_active_p: } + { \pdfmanagement_if_active_p: } + { + \cs_gset_protected:Npn \@@_backend_select:n #1 { } + \cs_gset_protected:Npn \@@_backend_fill_stroke:nn #1#2 { } + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</dvipdfmx|luatex|pdftex|xetex> % \end{macrocode} @@ -272,9 +270,9 @@ \cs_new_protected:Npn \@@_backend_fill:n #1 { \@@_backend:nn {#1} { fill- } } \cs_new_protected:Npn \@@_backend_stroke:n #1 - { \@@_backend:nn { {#1} } { stroke- } } + { \@@_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/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx index 472b7adefae..0a16a79f9ea 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2024-02-20} +% \date{Released 2024-03-14} % % \maketitle % |