diff options
author | Karl Berry <karl@freefriends.org> | 2020-08-07 21:37:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-08-07 21:37:39 +0000 |
commit | d6a7e0e5536b4924edec286797ed38021b94509d (patch) | |
tree | 04407161e6a03a0698d3029183d3959a762a0bb2 /Master/texmf-dist/source/latex/l3backend | |
parent | 5a14bab00bc59f46bdb92dcfc08ca2d331e3c3ec (diff) |
l3 (7aug20)
git-svn-id: svn://tug.org/texlive/trunk@56067 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3backend')
7 files changed, 386 insertions, 411 deletions
diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx index 00367dea5f3..209b2a648fb 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-basics} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> % \end{macrocode} % % Whilst there is a reasonable amount of code overlap between backends, @@ -71,23 +71,23 @@ %<*package> \ProvidesExplFile %<*dvipdfmx> - {l3backend-dvipdfmx.def}{2020-06-29}{} + {l3backend-dvipdfmx.def}{2020-08-07}{} {L3 backend support: dvipdfmx} %</dvipdfmx> %<*dvips> - {l3backend-dvips.def}{2020-06-29}{} + {l3backend-dvips.def}{2020-08-07}{} {L3 backend support: dvips} %</dvips> %<*dvisvgm> - {l3backend-dvisvgm.def}{2020-06-29}{} + {l3backend-dvisvgm.def}{2020-08-07}{} {L3 backend support: dvisvgm} %</dvisvgm> %<*pdfmode> - {l3backend-pdfmode.def}{2020-06-29}{} + {l3backend-pdfmode.def}{2020-08-07}{} {L3 backend support: PDF mode} %</pdfmode> %<*xdvipdfmx> - {l3backend-xdvipdfmx.def}{2020-06-29}{} + {l3backend-xdvipdfmx.def}{2020-08-07}{} {L3 backend support: xdvipdfmx} %</xdvipdfmx> %</package> @@ -358,36 +358,71 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\__kernel_backend_scope_begin:, \__kernel_backend_scope_end:} -% A scope in SVG terms is slightly different to the other backends as -% operations have to be \enquote{tied} to these not simply inside them. +% \begin{variable}{\g__kernel_backend_scope_int, \l__kernel_backend_scope_int} +% In SVG, we need to track scope nesting as properties attach to scopes; that +% requires a pair of \texttt{int} registers. % \begin{macrocode} -\cs_new_protected:Npn \__kernel_backend_scope_begin: - { \__kernel_backend_literal_svg:n { <g> } } -\cs_new_protected:Npn \__kernel_backend_scope_end: - { \__kernel_backend_literal_svg:n { </g> } } +\int_new:N \g__kernel_backend_scope_int +\int_new:N \l__kernel_backend_scope_int % \end{macrocode} -% \end{macro} +% \end{variable} % +% \begin{macro}{\__kernel_backend_scope_begin:, \__kernel_backend_scope_end:} % \begin{macro}{\__kernel_backend_scope_begin:n, \__kernel_backend_scope_begin:x} -% In SVG transformations, clips and so on are attached directly to scopes so -% we need a way or allowing for that. This is rather more useful than -% \cs{__kernel_backend_scope_begin:} as a result. -% No assumptions are made about the nature -% of the scoped operation(s). +% \begin{macro}{\__kernel_backend_scope:n, \__kernel_backend_scope:x} +% In SVG, the need to attach concepts to a scope means we need to be sure we +% will close all of the open scopes. That is easiest done if we only need +% an outer \enquote{wrapper} \texttt{begin}/\texttt{end} pair, and within +% that we apply operations as a simple scoped statements. To keep down the +% non-productive groups, we also have a \texttt{begin} version that does take +% an argument. % \begin{macrocode} +\cs_new_protected:Npn \__kernel_backend_scope_begin: + { + \__kernel_backend_literal_svg:n { <g> } + \int_set_eq:NN + \l__kernel_backend_scope_int + \g__kernel_backend_scope_int + \group_begin: + \int_gset:Nn \g__kernel_backend_scope_int { 1 } + } +\cs_new_protected:Npn \__kernel_backend_scope_end: + { + \prg_replicate:nn + { \g__kernel_backend_scope_int } + { \__kernel_backend_literal_svg:n { </g> } } + \group_end: + \int_gset_eq:NN + \g__kernel_backend_scope_int + \l__kernel_backend_scope_int + } \cs_new_protected:Npn \__kernel_backend_scope_begin:n #1 - { \__kernel_backend_literal_svg:n { <g~ #1 > } } + { + \__kernel_backend_literal_svg:n { <g ~ #1 > } + \int_set_eq:NN + \l__kernel_backend_scope_int + \g__kernel_backend_scope_int + \group_begin: + \int_gset:Nn \g__kernel_backend_scope_int { 1 } + } \cs_generate_variant:Nn \__kernel_backend_scope_begin:n { x } +\cs_new_protected:Npn \__kernel_backend_scope:n #1 + { + \__kernel_backend_literal_svg:n { <g ~ #1 > } + \int_gincr:N \g__kernel_backend_scope_int + } +\cs_generate_variant:Nn \__kernel_backend_scope:n { x } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macrocode} %</dvisvgm> % \end{macrocode} % % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx index 8a63b8db150..c5ef445658d 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-box} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> %<@@=box> % \end{macrocode} % @@ -387,12 +387,12 @@ scale ( 1 , -1 ) " } - \__kernel_backend_scope_begin:x + \__kernel_backend_scope:x { clip-path = "url ( \c_hash_str l3cp \int_use:N \g_@@_clip_path_int ) " } - \__kernel_backend_scope_begin:n + \__kernel_backend_scope:n { transform = " @@ -403,9 +403,6 @@ } \box_use:N #1 \__kernel_backend_scope_end: - \__kernel_backend_scope_end: - \__kernel_backend_scope_end: -% \skip_horizontal:n { \box_wd:N #1 } } \int_new:N \g_@@_clip_path_int % \end{macrocode} @@ -465,7 +462,7 @@ % \end{macrocode} % % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx index 6875ce75790..6defac4817a 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-color} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> %<@@=color> % \end{macrocode} % @@ -81,62 +81,55 @@ % spot ones (here we need a model and a tint). The \texttt{x}-type expansion % is there to cover the case where \pkg{xcolor} is in use. % \begin{macrocode} -%<*package> \cs_new_protected:Npn \@@_backend_pickup:N #1 { } -\AtBeginDocument +\cs_if_exist:cT { ver@color.sty } { - \cs_if_exist:cT { ver@color.sty } + \cs_set_protected:Npn \@@_backend_pickup:N #1 { - \cs_set_protected:Npn \@@_backend_pickup:N #1 + \exp_args:NV \tl_if_head_is_space:nTF \current@color { - \exp_args:NV \tl_if_head_is_space:nTF \current@color - { - \tl_set:Nx #1 - { - { spot } - { \exp_after:wN \use:n \current@color \c_space_tl 1 } - } - } - { - \exp_last_unbraced:Nx \@@_backend_pickup:w - { \current@color } \s_@@_stop #1 - } + \tl_set:Nx #1 + { + { \exp_after:wN \use:n \current@color } + { 1 } + } + } + { + \exp_last_unbraced:Nx \@@_backend_pickup:w + { \current@color } \s_@@_stop #1 } - \cs_new_protected:Npn \@@_backend_pickup:w #1 ~ #2 \s_@@_stop #3 - { \tl_set:Nn #3 { {#1} {#2} } } } + \cs_new_protected:Npn \@@_backend_pickup:w #1 ~ #2 \s_@@_stop #3 + { \tl_set:Nn #3 { {#1} {#2} } } } -%</package> % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} % { -% \@@_backend_cmyk:n , -% \@@_backend_gray:n , -% \@@_backend_rgb:n , -% \@@_backend_spot:n , +% \@@_backend_select_cmyk:n , +% \@@_backend_select_gray:n , +% \@@_backend_select_rgb:n , % \@@_backend_select:n % } % \begin{macro}{\@@_backend_reset:} -% \begin{macro}{color.fc} -% Push the data to the stack. In the case of \texttt{dvips} also reset the -% drawing fill color in raw PostScript. +% \begin{macro}{color.sc, color.fc} +% Push the data to the stack. In the case of \texttt{dvips} also saves the +% drawing color in raw PostScript. % \begin{macrocode} -\cs_new_protected:Npn \@@_backend_cmyk:n #1 +\cs_new_protected:Npn \@@_backend_select_cmyk:n #1 { \@@_backend_select:n { cmyk ~ #1 } } -\cs_new_protected:Npn \@@_backend_gray:n #1 +\cs_new_protected:Npn \@@_backend_select_gray:n #1 { \@@_backend_select:n { gray ~ #1 } } -\cs_new_protected:Npn \@@_backend_rgb:n #1 +\cs_new_protected:Npn \@@_backend_select_rgb:n #1 { \@@_backend_select:n { rgb ~ #1 } } -\cs_new_protected:Npn \@@_backend_spot:n #1 - { \@@_backend_select:n {#1} } \cs_new_protected:Npn \@@_backend_select:n #1 { \__kernel_backend_literal:n { color~push~ #1 } %<*dvips> - \__kernel_backend_postscript:n { /color.fc~{ }~def } + \__kernel_backend_postscript:n { /color.sc~ { ~ } ~def } + \__kernel_backend_postscript:n { /color.fc~ { ~ } ~def } %</dvips> \group_insert_after:N \@@_backend_reset: } @@ -147,6 +140,13 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@_backend_select_separation:nn} +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_select_separation:nn #1#2 + { \@@_backend_select:n {#1} } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</dvisvgm|dvipdfmx|dvips|xdvipdfmx> % \end{macrocode} @@ -166,43 +166,38 @@ % \cs{@@_backend_pickup:w} breaks it apart, because for instance % \pkg{xcolor} sets it to be instructions to generate a color % \begin{macrocode} -%<*package> \cs_new_protected:Npn \@@_backend_pickup:N #1 { } -\AtBeginDocument +\cs_if_exist:cT { ver@color.sty } { - \cs_if_exist:cT { ver@color.sty } + \cs_set_protected:Npn \@@_backend_pickup:N #1 { - \cs_set_protected:Npn \@@_backend_pickup:N #1 - { - \exp_last_unbraced:Nx \@@_backend_pickup:w - { \current@color } ~ 0 ~ 0 ~ 0 \s_@@_stop #1 - } - \cs_new_protected:Npn \@@_backend_pickup:w - #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \s_@@_stop #7 + \exp_last_unbraced:Nx \@@_backend_pickup:w + { \current@color } ~ 0 ~ 0 ~ 0 \s_@@_stop #1 + } + \cs_new_protected:Npn \@@_backend_pickup:w + #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \s_@@_stop #7 + { + \str_if_eq:nnTF {#2} { g } + { \tl_set:Nn #7 { { gray } {#1} } } { - \str_if_eq:nnTF {#2} { g } - { \tl_set:Nn #7 { { gray } {#1} } } + \str_if_eq:nnTF {#4} { rg } + { \tl_set:Nn #7 { { rgb } { #1 ~ #2 ~ #3 } } } { - \str_if_eq:nnTF {#4} { rg } - { \tl_set:Nn #7 { { rgb } { #1 ~ #2 ~ #3 } } } - { - \str_if_eq:nnTF {#5} { k } - { \tl_set:Nn #7 { { cmyk } { #1 ~ #2 ~ #3 ~ #4 } } } + \str_if_eq:nnTF {#5} { k } + { \tl_set:Nn #7 { { cmyk } { #1 ~ #2 ~ #3 ~ #4 } } } + { + \str_if_eq:nnTF {#2} { cs } + { + \tl_set:Nx #7 { { \use:n #1 } { #5 } } + } { - \str_if_eq:nnTF {#2} { cs } - { - \tl_set:Nx #7 { { spot } { \use_none:n #1 ~ #5 } } - } - { - \tl_set:Nn #7 { { gray } { 0 } } - } + \tl_set:Nn #7 { { gray } { 0 } } } - } + } } } } } -%</package> % \end{macrocode} % \end{macro} % \end{macro} @@ -217,26 +212,19 @@ % % \begin{macro} % { -% \@@_backend_cmyk:n , -% \@@_backend_gray:n , -% \@@_backend_rgb:n , -% \@@_backend_spot:n +% \@@_backend_select_cmyk:n , +% \@@_backend_select_gray:n , +% \@@_backend_select_rgb:n % } -% \begin{macro}{\@@_backend_spot:w} -% \begin{macro}{\@@_backend_select:n} % \begin{macro}{\@@_backend_reset:} % Simply dump the data, but allowing for \LuaTeX{}. % \begin{macrocode} -\cs_new_protected:Npn \@@_backend_cmyk:n #1 +\cs_new_protected:Npn \@@_backend_select_cmyk:n #1 { \@@_backend_select:n { #1 ~ k ~ #1 ~ K } } -\cs_new_protected:Npn \@@_backend_gray:n #1 +\cs_new_protected:Npn \@@_backend_select_gray:n #1 { \@@_backend_select:n { #1 ~ g ~ #1 ~ G } } -\cs_new_protected:Npn \@@_backend_rgb:n #1 +\cs_new_protected:Npn \@@_backend_select_rgb:n #1 { \@@_backend_select:n { #1 ~ rg ~ #1 ~ RG } } -\cs_new_protected:Npn \@@_backend_spot:n #1 - { \@@_backend_spot:w #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_spot:w #1 ~ #2 \s_@@_stop - { \@@_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } } \cs_new_protected:Npx \@@_backend_select:n #1 { \cs_if_exist:NTF \tex_pdfextension:D @@ -255,15 +243,240 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} +% +% \begin{macro}{\@@_backend_select_separation:nn} +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_select_separation:nn #1#2 + { \@@_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } } +% \end{macrocode} % \end{macro} % % \begin{macrocode} %</pdfmode> % \end{macrocode} % +% \subsection{Fill and stroke color} +% +% Here, \texttt{(x)dvipdfmx} follows \texttt{pdfmode}, while for \texttt{dvips} +% we have to manage fill and stroke color ourselves. We also handle +% \texttt{dvisvgm} independently, as there we can create SVG directly. +% +% \begin{macrocode} +%<*dvipdfmx|pdfmode|xdvipdfmx> +% \end{macrocode} +% +% \begin{macro} +% { +% \@@_backend_fill_cmyk:n , +% \@@_backend_fill_gray:n , +% \@@_backend_fill_rgb:n , +% \@@_backend_stroke_cmyk:n , +% \@@_backend_stroke_gray:n , +% \@@_backend_stroke_rgb:n +% } +% Drawing (fill/stroke) color is handled in \texttt{(x)dvipdfmx} in the +% same way as \texttt{pdfmode}. We use the same approach as earlier, except the +% color stack is not involved so the generic direct PDF operation is used. +% There is no worry about the nature of strokes: everything is handled +% automatically. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1 + { \__kernel_backend_literal_pdf:n { #1 ~ k } } +\cs_new_protected:Npn \@@_backend_fill_gray:n #1 + { \__kernel_backend_literal_pdf:n { #1 ~ g } } +\cs_new_protected:Npn \@@_backend_fill_rgb:n #1 + { \__kernel_backend_literal_pdf:n { #1 ~ rg } } + \cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1 + { \__kernel_backend_literal_pdf:n { #1 ~ K } } +\cs_new_protected:Npn \@@_backend_stroke_gray:n #1 + { \__kernel_backend_literal_pdf:n { #1 ~ G } } +\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1 + { \__kernel_backend_literal_pdf:n { #1 ~ RG } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \@@_backend_fill_separation:nn, +% \@@_backend_stroke_separation:nn +% } +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2 + { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } } +\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2 + { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</dvipdfmx|pdfmode|xdvipdfmx> +% \end{macrocode} +% +% \begin{macrocode} +%<*dvips> +% \end{macrocode} +% +% \begin{macro} +% { +% \@@_backend_fill_cmyk:n , +% \@@_backend_fill_gray:n , +% \@@_backend_fill_rgb:n , +% \@@_backend_stroke_cmyk:n , +% \@@_backend_stroke_gray:n , +% \@@_backend_stroke_rgb:n +% } +% All questions of saving the non-stacked data. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1 + { \__kernel_backend_postscript:n { /color.fc { #1 ~ setcmykcolor } def } } +\cs_new_protected:Npn \@@_backend_fill_gray:n #1 + { \__kernel_backend_postscript:n { /color.fc { #1 ~ setgray } def } } +\cs_new_protected:Npn \@@_backend_fill_rgb:n #1 + { \__kernel_backend_postscript:n { /color.fc { #1 ~ setrgbcolor } def } } + \cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1 + { \__kernel_backend_postscript:n { /color.sc { #1 ~ setcmykcolor } def } } +\cs_new_protected:Npn \@@_backend_stroke_gray:n #1 + { \__kernel_backend_postscript:n { /color.sc { #1 ~ setgray } def } } +\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1 + { \__kernel_backend_postscript:n { /color.sc { #1 ~ setrgbcolor } def } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \@@_backend_fill_separation:nn, +% \@@_backend_stroke_separation:nn +% } +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2 + { \__kernel_backend_postscript:n { /color.fc { #1 } def } } +\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2 + { \__kernel_backend_postscript:n { /color.sc { #1 } def } } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</dvips> +% \end{macrocode} +% +% \begin{macrocode} +%<*dvisvgm> +% \end{macrocode} +% +% \begin{macro} +% { +% \@@_backend_fill_cmyk:n , +% \@@_backend_stroke_cmyk:n +% } +% \begin{macro}{\@@_backend_cmyk:nw} +% \begin{macro} +% { +% \@@_backend_fill_gray:n , +% \@@_backend_stroke_gray:n +% } +% \begin{macro}{\@@_backend_gray:nn, \@@_backend_gray_aux:n} +% \begin{macro} +% { +% \@@_backend_fill_rgb:n , +% \@@_backend_stroke_rgb:n +% } +% \begin{macro}{\@@_backend_rgb:nw} +% \begin{macro}{\@@_backend:nnnn} +% For drawings in SVG, we use scopes for all colors. That +% requires using \texttt{RGB} values, which luckily are easy to +% convert here (|cmyk| to |RGB| is a fixed function). +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1 + { \@@_backend_cmyk:nw { fill } #1 \s_@@_stop } +\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1 + { \@@_backend_cmyk:nw { stroke } #1 \s_@@_stop } +\cs_new_protected:Npn \@@_backend_cmyk:nw + #1#2 ~ #3 ~ #4 ~ #5 \s_@@_stop + { + \use:x + { + \@@_backend:nnnn + {#1} + { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #5 ) ) } } + { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #5 ) ) } } + { \fp_eval:n { -100 * ( 1 - min ( 1 , #4 + #5 ) ) } } + } + } +\cs_new_protected:Npn \@@_backend_fill_gray:n #1 + { \@@_backend_grab:nn { fill } {#1} } +\cs_new_protected:Npn \@@_backend_stroke_gray:n #1 + { \@@_backend_grab:nn { stroke } {#1} } +\cs_new_protected:Npn \@@_backend_gray:nn #1#2 + { + \use:x + { + \@@_backend_gray_aux:nn + {#1} + { \fp_eval:n { 100 * (#2) } } + } + } +\cs_new_protected:Npn \@@_backend_gray_aux:nn #1#2 + { \@@_backend:nnn {#1} {#2} {#2} {#2} } +\cs_new_protected:Npn \@@_backend_fill_rgb:n #1 + { \@@_backend_rgb:nw { fill } #1 \s_@@_stop } +\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1 + { \@@_backend_rgb:nw { stroke } #1 \s_@@_stop } +\cs_new_protected:Npn \@@_backend_rgb:nw + #1#2 ~ #3 ~ #4\s_@@_stop + { + \use:x + { + \@@_backend:nnnn + { fill } + { \fp_eval:n { 100 * (#2) } } + { \fp_eval:n { 100 * (#3) } } + { \fp_eval:n { 100 * (#4) } } + } + } +\cs_new_protected:Npx \@@_backend:nnnn #1#2#3#4 + { + \__kernel_backend_scope:n + { + #1 = + " + rgb + ( + #2 \c_percent_str , + #3 \c_percent_str , + #4 \c_percent_str + ) + " + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro} +% { +% \@@_backend_fill_separation:nn, +% \@@_backend_stroke_separation:nn +% } +% At present, these are no-ops. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2 + { } +\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2 + { } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</dvisvgm> +% \end{macrocode} +% % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx index 1b7d444ae62..7f0f4cfb4ab 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-draw} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> %<@@=draw> % \end{macrocode} % @@ -76,13 +76,12 @@ % \end{macro} % % \begin{macro}{\@@_backend_begin:, \@@_backend_end:} -% \begin{macro}{color.fc} % The |ps::[begin]| special here deals with positioning but allows us to % continue on to a matching |ps::[end]|: contrast with |ps:|, which positions % 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. The definition of |/color.fc| deals with fill -% color in paths. In contrast to \pkg{pgf}, we don't save the current point: +% 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 @@ -94,7 +93,6 @@ { \__kernel_backend_literal:n { ps::[begin] } \@@_backend_literal:n { @beginspecial } - \@@_backend_literal:n { SDict ~ begin ~ /color.fc ~ { } ~ def ~ end } } \cs_new_protected:Npn \@@_backend_end: { @@ -103,7 +101,6 @@ } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\@@_backend_scope_begin:, \@@_backend_scope_end:} % Scope here may need to contain saved definitions, so the entire memory @@ -202,7 +199,10 @@ { \@@_backend_literal:n { closepath } } \cs_new_protected:Npn \@@_backend_stroke: { + \@@_backend_literal:n { gsave } + \@@_backend_literal:n { color.sc } \@@_backend_literal:n { stroke } + \@@_backend_literal:n { grestore } \bool_if:NT \g_@@_draw_clip_bool { \@@_backend_literal:x @@ -243,6 +243,7 @@ \cs_new_protected:Npn \@@_backend_fillstroke: { \@@_backend_literal:n { gsave } + \@@_backend_literal:n { color.sc } \@@_backend_literal:n { color.fc } \@@_backend_literal:x { @@ -333,54 +334,6 @@ % \end{macro} % \end{macro} % -% \begin{macro} -% { -% \@@_backend_color_fill_cmyk:n , -% \@@_backend_color_stroke_cmyk:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_gray:n , -% \@@_backend_color_stroke_gray:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_rgb:n , -% \@@_backend_color_stroke_rgb:n -% } -% \begin{macro}{\@@_backend_color_fill:n, \@@_backend_color_stroke:n} -% For \texttt{dvips}, we can use the standard color stack to deal with -% stroke color, but for fills have to switch to raw PostScript. This is -% thus not handled by the stack, but the context is very restricted. See -% also how fills are implemented. -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_color_fill_cmyk:n #1 - { \@@_backend_color_fill:n { #1 ~ setcmykcolor } } -\cs_new_protected:Npn \@@_backend_color_stroke_cmyk:n #1 - { \@@_backend_color_stroke:n { cmyk ~ #1 } } -\cs_new_protected:Npn \@@_backend_color_stroke_gray:n #1 - { \@@_backend_color_fill:n { #1 ~ setgray } } -\cs_new_protected:Npn \@@_backend_color_fill_gray:n #1 - { \@@_backend_color_stroke:n { gray ~ #1 } } -\cs_new_protected:Npn \@@_backend_color_fill_rgb:n #1 - { \@@_backend_color_fill:n { #1 ~ setrgbcolor } } -\cs_new_protected:Npn \@@_backend_color_stroke_rgb:n #1 - { \@@_backend_color_stroke:n { rgb ~ #1 } } -\cs_new_protected:Npn \@@_backend_color_fill:n #1 - { - \__kernel_backend_postscript:n - { /color.fc ~ { #1 } ~ def } - } -\cs_new_protected:Npn \@@_backend_color_stroke:n #1 - { - \__kernel_backend_literal:n { color~push~#1 } - \group_insert_after:N \@@_color_reset: - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\@@_backend_cm:nnnn} % In \texttt{dvips}, keeping the transformations in line with the engine @@ -620,66 +573,6 @@ % \end{macro} % \end{macro} % -% \begin{macro} -% { -% \@@_backend_color_fill_cmyk:n , -% \@@_backend_color_stroke_cmyk:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_gray:n , -% \@@_backend_color_stroke_gray:n -% } -% \begin{macro} -% { -% \@@_backend_color_fill_rgb:n , -% \@@_backend_color_stroke_rgb:n -% } -% \begin{macro}{\@@_backend_color_select:n, \@@_backend_color_select:x} -% \begin{macro}{\@@_backend_color_reset:} -% Color has to be split between \texttt{(x)dvipdfmx} and the PDF engines -% as there is no color stack for fill/stroke separation in the former. -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_color_fill_cmyk:n #1 - { \@@_backend_color_select:n { #1 ~ k } } -\cs_new_protected:Npn \@@_backend_color_stroke_cmyk:n #1 - { \@@_backend_color_select:n { #1 ~ K } } -\cs_new_protected:Npn \@@_backend_color_fill_gray:n #1 - { \@@_backend_color_select:n { #1 ~ g } } -\cs_new_protected:Npn \@@_backend_color_stroke_gray:n #1 - { \@@_backend_color_select:n { #1 ~ G } } -\cs_new_protected:Npn \@@_backend_color_fill_rgb:n #1 - { \@@_backend_color_select:n { #1 ~ rg } } -\cs_new_protected:Npn \@@_backend_color_stroke_rgb:n #1 - { \@@_backend_color_select:n { #1 ~ RG } } -%<*pdfmode> -\cs_new_protected:Npx \@@_backend_color_select:n #1 - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D colorstack } - { \tex_pdfcolorstack:D } - \exp_not:N \l__kernel_color_stack_int push {#1} - \group_insert_after:N \exp_not:N \@@_backend_color_reset: - } -\cs_new_protected:Npx \@@_backend_color_reset: - { - \cs_if_exist:NTF \tex_pdfextension:D - { \tex_pdfextension:D colorstack } - { \tex_pdfcolorstack:D } - \exp_not:N \l__kernel_color_stack_int pop \scan_stop: - } -%</pdfmode> -%<*dvipdfmx|xdvipdfmx> -\cs_new_eq:NN \@@_backend_color_select:n \__kernel_backend_literal_pdf:n -%</dvipdfmx|xdvipdfmx> -\cs_generate_variant:Nn \@@_backend_color_select:n { x } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\@@_backend_cm:nnnn} % \begin{macro}{\@@_backend_cm_aux:nnnn} % Another split here between \texttt{pdfmode} and \texttt{(x)dvipdfmx}. @@ -883,54 +776,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_backend_begin: { - \@@_backend_scope_begin: - \@@_backend_scope:n { transform="translate({?x},{?y})~scale(1,-1)" } - } -\cs_new_protected:Npn \@@_backend_end: - { \@@_backend_scope_end: } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_backend_scope_begin:, \@@_backend_scope_end:} -% \begin{macro}{\@@_backend_scope:n, \@@_backend_scope:x} -% \begin{variable}{\g_@@_draw_scope_int, \l_@@_draw_scope_int} -% Several settings that with other backends are \enquote{stand alone} have -% to be given as part of a scope in SVG. As a result, there is a need to -% provide a mechanism to automatically close these extra scopes. That is -% done using a dedicated function and a pair of tracking variables. Within -% each graphics scope we use a global variable to do the work, with a group -% used to save the value between scopes. The result is that no direct action -% is needed when creating a scope. -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_scope_begin: - { - \int_set_eq:NN - \l_@@_draw_scope_int - \g_@@_draw_scope_int - \group_begin: - \int_gzero:N \g_@@_draw_scope_int - } -\cs_new_protected:Npn \@@_backend_scope_end: - { - \prg_replicate:nn - { \g_@@_draw_scope_int } - { \@@_backend_literal:n { </g> } } - \group_end: - \int_gset_eq:NN - \g_@@_draw_scope_int - \l_@@_draw_scope_int - } -\cs_new_protected:Npn \@@_backend_scope:n #1 - { - \@@_backend_literal:n { <g~ #1 > } - \int_gincr:N \g_@@_draw_scope_int + \__kernel_backend_scope_begin: + \__kernel_backend_scope:n { transform="translate({?x},{?y})~scale(1,-1)" } } -\cs_generate_variant:Nn \@@_backend_scope:n { x } -\int_new:N \g_@@_draw_scope_int -\int_new:N \l_@@_draw_scope_int +\cs_new_eq:NN \@@_backend_end: \__kernel_backend_scope_end: % \end{macrocode} -% \end{variable} -% \end{macro} % \end{macro} % % \begin{macro}{\@@_backend_moveto:nn, \@@_backend_lineto:nn} @@ -1158,100 +1008,6 @@ % \end{macro} % \end{macro} % -% \begin{macro} -% { -% \@@_backend_color_fill_cmyk:n , -% \@@_backend_color_stroke_cmyk:n -% } -% \begin{macro}{\@@_backend_color_cmyk:nw} -% \begin{macro} -% { -% \@@_backend_color_fill_gray:n , -% \@@_backend_color_stroke_gray:n -% } -% \begin{macro}{\@@_backend_color_gray:nn, \@@_backend_color_gray_aux:n} -% \begin{macro} -% { -% \@@_backend_color_fill_rgb:n , -% \@@_backend_color_stroke_rgb:n -% } -% \begin{macro}{\@@_backend_color_rgb:nw} -% \begin{macro}{\@@_backend_color:nnnn} -% For drawings in SVG, we use scopes for all colors. That -% requires using \texttt{RGB} values, which luckily are easy to -% convert here (|cmyk| to |RGB| is a fixed function). -% \begin{macrocode} -\cs_new_protected:Npn \@@_backend_color_fill_cmyk:n #1 - { \@@_backend_color_cmyk:nw { fill } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_stroke_cmyk:n #1 - { \@@_backend_color_cmyk:nw { stroke } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_cmyk:nw - #1#2 ~ #3 ~ #4 ~ #5 \s_@@_stop - { - \use:x - { - \@@_backend_color:nnnn - {#1} - { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #5 ) ) } } - { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #5 ) ) } } - { \fp_eval:n { -100 * ( 1 - min ( 1 , #4 + #5 ) ) } } - } - } -\cs_new_protected:Npn \@@_backend_color_fill_gray:n #1 - { \@@_backend_color_grab:nn { fill } {#1} } -\cs_new_protected:Npn \@@_backend_color_stroke_gray:n #1 - { \@@_backend_color_grab:nn { stroke } {#1} } -\cs_new_protected:Npn \@@_backend_color_gray:nn #1#2 - { - \use:x - { - \@@_backend_color_gray_aux:nn - {#1} - { \fp_eval:n { 100 * (#2) } } - } - } -\cs_new_protected:Npn \@@_backend_color_gray_aux:nn #1#2 - { \@@_backend_color:nnn {#1} {#2} {#2} {#2} } -\cs_new_protected:Npn \@@_backend_color_fill_rgb:n #1 - { \@@_backend_color_rgb:nw { fill } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_stroke_rgb:n #1 - { \@@_backend_color_rgb:nw { stroke } #1 \s_@@_stop } -\cs_new_protected:Npn \@@_backend_color_rgb:nw - #1#2 ~ #3 ~ #4\s_@@_stop - { - \use:x - { - \@@_backend_color:nnnn - { fill } - { \fp_eval:n { 100 * (#2) } } - { \fp_eval:n { 100 * (#3) } } - { \fp_eval:n { 100 * (#4) } } - } - } -\cs_new_protected:Npx \@@_backend_color:nnnn #1#2#3#4 - { - \@@_backend_scope:n - { - #1 = - " - rgb - ( - #2 \c_percent_str , - #3 \c_percent_str , - #4 \c_percent_str - ) - " - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\@@_backend_cm:nnnn} % The four arguments here are floats (the affine matrix), the last % two are a displacement vector. @@ -1298,7 +1054,7 @@ % \end{macrocode} % % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx index d9ed9f84957..ba3b2ed5e97 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-graphics} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> %<@@=graphics> % \end{macrocode} % @@ -69,13 +69,7 @@ % \begin{macro}{\@@_backend_getbb_eps:n} % Simply use the generic function. % \begin{macrocode} -%<*initex> -\use:n -%</initex> -%<*package> -\AtBeginDocument -%</package> - { \cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n } +\cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n % \end{macrocode} % \end{macro} % @@ -297,13 +291,7 @@ % Simply use the generic functions: only for \texttt{dvipdfmx} in the % extraction cases. % \begin{macrocode} -%<*initex> -\use:n -%</initex> -%<*package> -\AtBeginDocument -%</package> - { \cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n } +\cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n %<*dvipdfmx> \cs_new_protected:Npn \@@_backend_getbb_jpg:n #1 { @@ -560,13 +548,7 @@ % \begin{macro}{\@@_backend_getbb_eps:n} % Simply use the generic function. % \begin{macrocode} -%<*initex> -\use:n -%</initex> -%<*package> -\AtBeginDocument -%</package> - { \cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n } +\cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n % \end{macrocode} % \end{macro} % @@ -650,7 +632,7 @@ % \end{macrocode} % % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-header.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-header.dtx index 77303f1733c..24e7ee2cfae 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -59,6 +59,14 @@ %<*dvips&header> % \end{macrocode} % +% \begin{macro}{color.sc, color.fc} +% Empty definitions for color at the top level. +% \begin{macrocode} +/color.sc { } def +/color.fc { } def +% \end{macrocode} +% \end{macro} +% % \begin{macro}{pdf.globaldict} % A small global dictionary for backend use. % \begin{macrocode} @@ -79,7 +87,6 @@ false setglobal % is done here to allow for |Resolution|. The total height of a rectangle % (an array) needs a little maths, in contrast to simply extracting a value. % \begin{macrocode} - /pdf.cvs { 65534 string cvs } def /pdf.dvi.pt { 72.27 mul Resolution div } def /pdf.pt.dvi { 72.27 div Resolution mul } def @@ -351,7 +358,7 @@ false setglobal /x { 0 exch rmoveto - SDict~ + SDict begin currentpoint pdf.originy ne exch pdf.originx ne or diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx index 7fbc94a550c..fb569f2c24c 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 2020-06-29} +% \date{Released 2020-08-07} % % \maketitle % @@ -56,7 +56,7 @@ % \section{\pkg{l3backend-pdf} Implementation} % % \begin{macrocode} -%<*initex|package> +%<*package> %<@@=pdf> % \end{macrocode} % @@ -458,14 +458,9 @@ \hbox_set:Nn \l_@@_backend_model_box { Gg } \exp_args:Nx \@@_backend_link_outerbox:n { -%<*initex> - \l_galley_total_left_margin_dim -%</initex> -%<*package> \int_if_odd:nTF { \value { page } } { \oddsidemargin } { \evensidemargin } -%</package> } \box_move_down:nn { \box_dp:N \l_@@_backend_content_box } { \hbox:n { \__kernel_backend_postscript:n { pdf.save.linkll } } } @@ -527,12 +522,7 @@ [ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n { -\box_dp:N \l_@@_backend_model_box } ~ -%<*initex> - \dim_to_decimal:n { #1 + \l_galley_text_width_dim } ~ -%</initex> -%<*package> \dim_to_decimal:n { #1 + \textwidth } ~ -%</package> \dim_to_decimal:n { \box_ht:N \l_@@_backend_model_box } ] [ exch { pdf.pt.dvi } forall ] def @@ -1314,18 +1304,13 @@ % not rotate. As such, we need to know if landscape is active. % \begin{macrocode} \bool_new:N \g_@@_landscape_bool -%<*package> -\AtBeginDocument +\cs_if_exist:NT \landscape { - \cs_if_exist:NT \landscape - { - \tl_put_right:Nn \landscape - { \bool_gset_true:N \g_@@_landscape_bool } - \tl_put_left:Nn \endlandscape - { \bool_gset_false:N \g_@@_landscape_bool } - } + \tl_put_right:Nn \landscape + { \bool_gset_true:N \g_@@_landscape_bool } + \tl_put_left:Nn \endlandscape + { \bool_gset_false:N \g_@@_landscape_bool } } -%</package> % \end{macrocode} % \end{variable} % @@ -1628,7 +1613,7 @@ % \end{macrocode} % % \begin{macrocode} -%</initex|package> +%</package> % \end{macrocode} % % \end{implementation} |