diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx | 825 |
1 files changed, 404 insertions, 421 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 9d442e2fe77..5ccd56959c7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/12/05} +% \date{Released 2017/12/16} % % \maketitle % @@ -69,56 +69,59 @@ % \item \texttt{xdvipdfmx}: The driver used by \XeTeX{}. % \end{itemize} % -% The code here is all very low-level, and should not in general be used -% outside of the kernel. It is also important to note that many of the -% functions here are closely tied to the immediate level \enquote{up}, -% and they must be used in the correct contexts. +% This module provides code closely tied to the exact driver in use: broadly, +% the functions here are implemented entirely independently for each case. +% As such, they often rely on higher-level code to provide necessary but +% shared operations. For example, in box rotation and scaling the functions +% here do no correct the final size of the box: this will always be required +% and thus is handled in the \pkg{box} module. +% +% Several of the operations here are low-level, and so may be used only in +% restricted contexts. Some also require understanding of PostScript/PDF +% concepts to be used corrected as they take \enquote{raw} arguments, similar +% in format to those used by the underlying driver. +% +% The functions in this module should be regarded as experimental with +% the following exceptions: +% \begin{itemize} +% \item \dots +% \end{itemize} % % \section{Box clipping} % -% \begin{function}[added = 2011-11-11]{\__driver_box_use_clip:N} +% \begin{function}[added = 2017-12-13]{\driver_box_use_clip:N} % \begin{syntax} -% \cs{__driver_box_use_clip:N} \meta{box} +% \cs{driver_box_use_clip:N} \meta{box} % \end{syntax} % Inserts the content of the \meta{box} at the current insertion point % such that any material outside of the bounding box is not displayed % by the driver. The material in the \meta{box} is still placed in the % output stream: the clipping takes place at a driver level. -% -% This function should only be used within a surrounding horizontal -% box construct. % \end{function} % % \section{Box rotation and scaling} % -% \begin{function}[added = 2016-05-12]{\__driver_box_use_rotate:Nn} +% \begin{function}[added = 2017-12-13]{\driver_box_use_rotate:Nn} % \begin{syntax} -% \cs{__driver_box_use_rotate:Nn} \meta{box} \Arg{angle} +% \cs{driver_box_use_rotate:Nn} \meta{box} \Arg{angle} % \end{syntax} % Inserts the content of the \meta{box} at the current insertion point % rotated by the \meta{angle} (expressed in degrees). The material is -% inserted with no apparent height or width, and is rotated such the -% the \TeX{} reference point of the box is the center of rotation and -% remains the reference point after rotation. It is the responsibility of -% the code using this function to adjust the apparent size of the box to -% be correct at the \TeX{} side. -% -% This function should only be used within a surrounding horizontal -% box construct. +% rotated such the the \TeX{} reference point of the box is the center of +% rotation and remains the reference point after rotation. It is the +% responsibility of the code using this function to adjust the apparent +% size of the inserted material. % \end{function} % -% \begin{function}[added = 2016-05-12]{\__driver_box_use_scale:Nnn} +% \begin{function}[added = 2017-12-13]{\driver_box_use_scale:Nnn} % \begin{syntax} -% \cs{__driver_box_use_scale:Nnn} \meta{box} \Arg{x-scale} \Arg{y-scale} +% \cs{driver_box_use_scale:Nnn} \meta{box} \Arg{x-scale} \Arg{y-scale} % \end{syntax} % Inserts the content of the \meta{box} at the current insertion point -% scale by the \meta{x-scale} and \meta{y-scale}. The material is -% inserted with no apparent height or width. It is the responsibility of -% the code using this function to adjust the apparent size of the box to -% be correct at the \TeX{} side. -% -% This function should only be used within a surrounding horizontal -% box construct. +% scale by the \meta{x-scale} and \meta{y-scale}. The reference point +% of the material will be unchanged. It is the responsibility of the +% code using this function to adjust the apparent size of the inserted +% material. % \end{function} % % \section{Color support} @@ -158,11 +161,11 @@ % graphic creation. % % \begin{function} -% { \__driver_draw_begin:, \__driver_draw_end:} +% {\driver_draw_begin:, \driver_draw_end:} % \begin{syntax} -% \cs{__driver_draw_begin:} +% \cs{driver_draw_begin:} % \meta{content} -% \cs{__driver_draw_end:} +% \cs{driver_draw_end:} % \end{syntax} % Defines a drawing environment. This is a scope for the purposes of % the graphics state. Depending on the driver, other set up may or may not @@ -173,11 +176,11 @@ % \end{function} % % \begin{function} -% {\__driver_draw_scope_begin:, \__driver_draw_scope_end:} +% {\driver_draw_scope_begin:, \driver_draw_scope_end:} % \begin{syntax} -% \cs{__driver_draw_scope_begin:} +% \cs{driver_draw_scope_begin:} % \meta{content} -% \cs{__driver_draw_scope_end:} +% \cs{driver_draw_scope_end:} % \end{syntax} % Defines a scope for drawing settings and so on. Changes to the graphic % state and concepts such as color or linewidth are localised to a scope. @@ -189,17 +192,17 @@ % % \subsection{Path construction} % -% \begin{function}{\__driver_draw_moveto:nn} +% \begin{function}{\driver_draw_moveto:nn} % \begin{syntax} -% \cs{__driver_draw_move:nn} \Arg{x} \Arg{y} +% \cs{driver_draw_move:nn} \Arg{x} \Arg{y} % \end{syntax} % Moves the current drawing reference point to (\meta{x}, \meta{y}); % any active transformation matrix applies. % \end{function} % -% \begin{function}{\__driver_draw_lineto:nn} +% \begin{function}{\driver_draw_lineto:nn} % \begin{syntax} -% \cs{__driver_draw_lineto:nn} \Arg{x} \Arg{y} +% \cs{driver_draw_lineto:nn} \Arg{x} \Arg{y} % \end{syntax} % Adds a path from the current drawing reference point to % (\meta{x}, \meta{y}); any active transformation matrix applies. Note @@ -207,9 +210,9 @@ % the path may be discarded or used as a clip without appearing itself. % \end{function} % -% \begin{function}{\__driver_draw_curveto:nnnnnn} +% \begin{function}{\driver_draw_curveto:nnnnnn} % \begin{syntax} -% \cs{__driver_draw_curveto:nnnnnn} \Arg{x_1} \Arg{y_1} +% \cs{driver_draw_curveto:nnnnnn} \Arg{x_1} \Arg{y_1} % \Arg{x_2} \Arg{y_2} \Arg{x_3} \Arg{y_3} % \end{syntax} % Adds a Bezier curve path from the current drawing reference point to @@ -220,9 +223,9 @@ % without appearing itself. % \end{function} % -% \begin{function}{\__driver_draw_rectangle:nnnn} +% \begin{function}{\driver_draw_rectangle:nnnn} % \begin{syntax} -% \cs{__driver_draw_rectangle:nnnn} \Arg{x} \Arg{y} \Arg{width} \Arg{height} +% \cs{driver_draw_rectangle:nnnn} \Arg{x} \Arg{y} \Arg{width} \Arg{height} % \end{syntax} % Adds rectangular path from (\meta{x_1}, \meta{y_1}) of \meta{height} % and \meta{width}; any active transformation matrix applies. Note that @@ -230,9 +233,9 @@ % path may be discarded or used as a clip without appearing itself. % \end{function} % -% \begin{function}{\__driver_draw_closepath:} +% \begin{function}{\driver_draw_closepath:} % \begin{syntax} -% \cs{__driver_draw_closepath:} +% \cs{driver_draw_closepath:} % \end{syntax} % Closes an existing path, adding a line from the current point to the % start of path. Note that nothing is drawn until a fill or stroke @@ -242,13 +245,13 @@ % % \subsection{Stroking and filling} % -% \begin{function}{\__driver_draw_stroke:, \__driver_draw_closestroke:} +% \begin{function}{\driver_draw_stroke:, \driver_draw_closestroke:} % \begin{syntax} % \meta{path construction} -% \cs{__driver_draw_stroke:} +% \cs{driver_draw_stroke:} % \end{syntax} % Draws a line along the current path, which is also closed by -% \cs{__driver_draw_closestroke:}. The nature of the line drawn +% \cs{driver_draw_closestroke:}. The nature of the line drawn % is influenced by settings for % \begin{itemize} % \item Line thickness @@ -261,14 +264,14 @@ % The path may also be used for clipping. % \end{function} % -% \begin{function}{\__driver_draw_fill:, \__driver_draw_fillstroke:} +% \begin{function}{\driver_draw_fill:, \driver_draw_fillstroke:} % \begin{syntax} % \meta{path construction} -% \cs{__driver_draw_fill:} +% \cs{driver_draw_fill:} % \end{syntax} % Fills the area surrounded by the current path: this will be closed prior % to filling if it is not already. The \texttt{fillstroke} version also -% strokes the path as described for \cs{__driver_draw_stroke:}. The fill is +% strokes the path as described for \cs{driver_draw_stroke:}. The fill is % influenced by the setting for fill color (or the current color if no % specific stroke color is set). The path may also be used for clipping. % For paths which are self-intersecting or comprising multiple parts, the @@ -276,9 +279,9 @@ % winding number rule unless the even-odd rule is active. % \end{function} % -% \begin{function}{\__driver_draw_nonzero_rule:, \__driver_draw_evenodd_rule:} +% \begin{function}{\driver_draw_nonzero_rule:, \driver_draw_evenodd_rule:} % \begin{syntax} -% \cs{__driver_draw_nonzero_rule:} +% \cs{driver_draw_nonzero_rule:} % \end{syntax} % Active either the non-zero winding number or the even-odd rule, % respectively, for determining what is inside a fill or clip area. @@ -286,10 +289,10 @@ % and apply on an ongoing basis. % \end{function} % -% \begin{function}{\__driver_draw_clip:} +% \begin{function}{\driver_draw_clip:} % \begin{syntax} % \meta{path construction} -% \cs{__driver_draw_clip:} +% \cs{driver_draw_clip:} % \end{syntax} % Indicates that the current path should be used for clipping, such that % any subsequent material outside of the path (but within the current @@ -299,10 +302,10 @@ % path as shown. % \end{function} % -% \begin{function}{\__driver_draw_discardpath:} +% \begin{function}{\driver_draw_discardpath:} % \begin{syntax} % \meta{path construction} -% \cs{__driver_draw_discardpath:} +% \cs{driver_draw_discardpath:} % \end{syntax} % Discards the current path without stroking or filling. This is primarily % useful for paths constructed purely for clipping, as this alone does not @@ -311,16 +314,16 @@ % % \subsection{Stroke options} % -% \begin{function}{\__driver_draw_linewidth:n} +% \begin{function}{\driver_draw_linewidth:n} % \begin{syntax} -% \cs{__driver_draw_linewidth:n} \Arg{dimexpr} +% \cs{driver_draw_linewidth:n} \Arg{dimexpr} % \end{syntax} % Sets the width to be used for stroking to \meta{dimexpr}. % \end{function} % -% \begin{function}{\__driver_draw_dash:nn} +% \begin{function}{\driver_draw_cap_dash:nn} % \begin{syntax} -% \cs{__driver_draw_dash:nn} \Arg{dash pattern} \Arg{phase} +% \cs{driver_draw_dash:nn} \Arg{dash pattern} \Arg{phase} % \end{syntax} % Sets the pattern of dashing to be used when stroking a line. The % \meta{dash pattern} should be a comma-separated list of dimension @@ -340,12 +343,12 @@ % % \begin{function} % { -% \__driver_draw_cap_butt: , -% \__driver_draw_cap_rectangle: , -% \__driver_draw_cap_round: +% \driver_draw_cap_butt: , +% \driver_draw_cap_rectangle: , +% \driver_draw_cap_round: % } % \begin{syntax} -% \cs{__driver_draw_cap_butt:} +% \cs{driver_draw_cap_butt:} % \end{syntax} % Sets the style of terminal stroke position to one of butt, rectangle or % round. @@ -353,19 +356,19 @@ % % \begin{function} % { -% \__driver_draw_join_bevel: , -% \__driver_draw_join_miter: , -% \__driver_draw_join_round: +% \driver_draw_join_bevel: , +% \driver_draw_join_miter: , +% \driver_draw_join_round: % } % \begin{syntax} -% \cs{__driver_draw_cap_butt:} +% \cs{driver_draw_cap_butt:} % \end{syntax} % Sets the style of stroke joins to one of bevel, miter or round. % \end{function} % -% \begin{function}{\__driver_draw_miterlimit:n} +% \begin{function}{\driver_draw_miterlimit:n} % \begin{syntax} -% \cs{__driver_draw_miterlimit:n} \Arg{dimexpr} +% \cs{driver_draw_miterlimit:n} \Arg{dimexpr} % \end{syntax} % Sets the miter limit of lines joined as a miter, as described in the % PDF and PostScript manuals. @@ -375,12 +378,12 @@ % % \begin{function} % { -% \__driver_draw_color_cmyk:nnnn , -% \__driver_draw_color_cmyk_fill:nnnn , -% \__driver_draw_color_cmyk_stroke:nnnn +% \driver_draw_color_cmyk:nnnn , +% \driver_draw_fill_cmyk:nnnn , +% \driver_draw_stroke_cmyk:nnnn % } % \begin{syntax} -% \cs{__driver_draw_color_cmyk:nnnn} \Arg{cyan} \Arg{magneta} \Arg{yellow} +% \cs{driver_draw_color_cmyk:nnnn} \Arg{cyan} \Arg{magneta} \Arg{yellow} % \Arg{black} % \end{syntax} % Sets the color for drawing to the CMYK values specified, all of which are @@ -392,12 +395,12 @@ % % \begin{function} % { -% \__driver_draw_color_gray:n , -% \__driver_draw_color_gray_fill:n , -% \__driver_draw_color_gray_stroke:n +% \driver_draw_color_gray:n , +% \driver_draw_fill_gray:n , +% \driver_draw_stroke_gray:n % } % \begin{syntax} -% \cs{__driver_draw_color_gray:n} \Arg{gray} +% \cs{driver_draw_color_gray:n} \Arg{gray} % \end{syntax} % Sets the color for drawing to the grayscale value specified, which is % fp expressions which should evaluate to between $0$ and $1$. The @@ -408,12 +411,12 @@ % % \begin{function} % { -% \__driver_draw_color_rgb:nnn , -% \__driver_draw_color_rgb_fill:nnn , -% \__driver_draw_color_rgb_stroke:nnn +% \driver_draw_color_rgb:nnn , +% \driver_draw_fill_rgb:nnn , +% \driver_draw_stroke_rgb:nnn % } % \begin{syntax} -% \cs{__driver_draw_color_rgb:nnn} \Arg{red} \Arg{green} \Arg{blue} +% \cs{driver_draw_color_rgb:nnn} \Arg{red} \Arg{green} \Arg{blue} % \end{syntax} % Sets the color for drawing to the RGB values specified, all of which are % fp expressions which should evaluate to between $0$ and $1$. The @@ -424,9 +427,9 @@ % % \subsection{Inserting \TeX{} material} % -% \begin{function}{\__driver_draw_hbox:Nnnnnnn} +% \begin{function}{\driver_draw_hbox:Nnnnnnn} % \begin{syntax} -% \cs{__driver_draw_hbox:Nnnnnnn} \meta{box} +% \cs{driver_draw_hbox:Nnnnnnn} \meta{box} % \Arg{a} \Arg{b} \Arg{c} \Arg{d} \Arg{x} \Arg{y} % \end{syntax} % Inserts the \meta{box} as an hbox with the box reference point placed @@ -440,9 +443,9 @@ % % \subsection{Coordinate system transformations} % -% \begin{function}{\__driver_draw_transformcm:nnnnnn} +% \begin{function}{\driver_draw_transformcm:nnnnnn} % \begin{syntax} -% \cs{__driver_draw_transformcm:nnnnnn} \Arg{a} \Arg{b} \Arg{c} \Arg{d} +% \cs{driver_draw_transformcm:nnnnnn} \Arg{a} \Arg{b} \Arg{c} \Arg{d} % \Arg{x} \Arg{y} % \end{syntax} % Applies the transformation matrix $[a b c d]$ and offset vector @@ -776,12 +779,12 @@ % % \subsubsection{Box operations} % -% \begin{macro}{\@@_box_use_clip:N} +% \begin{macro}{\driver_box_use_clip:N} % Much the same idea as for the PDF mode version but with a slightly % different syntax for creating the clip path. To avoid any scaling % issues we need the absolute length auxiliary here. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_clip:N #1 +\cs_new_protected:Npn \driver_box_use_clip:N #1 { \@@_scope_begin: \@@_literal:n @@ -802,12 +805,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_use_rotate:Nn} +% \begin{macro}{\driver_box_use_rotate:Nn} % Rotating using \texttt{dvips} does not require that the box dimensions % are altered and has a very convenient built-in operation. Zero rotation % must be written as |0| not |-0| so there is a quick test. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 +\cs_new_protected:Npn \driver_box_use_rotate:Nn #1#2 { \@@_scope_begin: \@@_literal:n @@ -823,11 +826,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_use_scale:Nnn} +% \begin{macro}{\driver_box_use_scale:Nnn} % The \texttt{dvips} driver once again has a dedicated operation we can % use here. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 +\cs_new_protected:Npn \driver_box_use_scale:Nnn #1#2#3 { \@@_scope_begin: \@@_literal:n @@ -847,7 +850,7 @@ % \begin{macro}{\@@_image_getbb_eps:n} % Simply use the generic function. % \begin{macrocode} -\cs_new_eq:NN \@@_image_getbb_eps:n \__image_read_bb:n +\cs_new_eq:NN \@@_image_getbb_eps:n \image_read_bb:n % \end{macrocode} % \end{macro} % @@ -875,7 +878,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_begin:, \@@_draw_end:} +% \begin{macro}{\driver_draw_begin:, \driver_draw_end:} % 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 @@ -883,14 +886,14 @@ % scale and $y$-axis direction. The reference point at the start of the box % is saved (as |l3x|/|l3y|) as it is needed when inserting various items. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_begin: +\cs_new_protected:Npn \driver_draw_begin: { \tex_special:D { ps::[begin] } \tex_special:D { ps::~save } \tex_special:D { ps::~/l3x~currentpoint~/l3y~exch~def~def } \tex_special:D { ps::~@beginspecial } } -\cs_new_protected:Npn \@@_draw_end: +\cs_new_protected:Npn \driver_draw_end: { \tex_special:D { ps::~@endspecial } \tex_special:D { ps::~restore } @@ -899,20 +902,20 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_scope_begin:, \@@_draw_scope_end:} +% \begin{macro}{\driver_draw_scope_begin:, \driver_draw_scope_end:} % Scope here may need to contain saved definitions, so the entire memory % rather than just the graphic state has to be sent to the stack. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_scope_begin: +\cs_new_protected:Npn \driver_draw_scope_begin: { \@@_draw_literal:n { save } } -\cs_new_protected:Npn \@@_draw_scope_end: +\cs_new_protected:Npn \driver_draw_scope_end: { \@@_draw_literal:n { restore } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_moveto:nn, \@@_draw_lineto:nn} -% \begin{macro}{\@@_draw_rectangle:nnnn} -% \begin{macro}{\@@_draw_curveto:nnnnnn} +% \begin{macro}{\driver_draw_moveto:nn, \driver_draw_lineto:nn} +% \begin{macro}{\driver_draw_rectangle:nnnn} +% \begin{macro}{\driver_draw_curveto:nnnnnn} % Path creation operations mainly resolve directly to PostScript primitive % steps, with only the need to convert to \texttt{bp}. Notice that % \texttt{x}-type expansion is included here to ensure that any variable @@ -920,17 +923,17 @@ % no native rectangular path command (without also clipping, filling or % stroking), so that task is done using a small amount of PostScript. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_moveto:nn #1#2 +\cs_new_protected:Npn \driver_draw_moveto:nn #1#2 { \@@_draw_literal:x { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ moveto } } -\cs_new_protected:Npn \@@_draw_lineto:nn #1#2 +\cs_new_protected:Npn \driver_draw_lineto:nn #1#2 { \@@_draw_literal:x { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ lineto } } -\cs_new_protected:Npn \@@_draw_rectangle:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_rectangle:nnnn #1#2#3#4 { \@@_draw_literal:x { @@ -939,7 +942,7 @@ moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~closepath } } -\cs_new_protected:Npn \@@_draw_curveto:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \driver_draw_curveto:nnnnnn #1#2#3#4#5#6 { \@@_draw_literal:x { @@ -954,13 +957,13 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_evenodd_rule:, \@@_draw_nonzero_rule:} +% \begin{macro}{\driver_draw_evenodd_rule:, \driver_draw_nonzero_rule:} % \begin{variable}{\g_@@_draw_eor_bool} % The even-odd rule here can be implemented as a simply switch. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_evenodd_rule: +\cs_new_protected:Npn \driver_draw_evenodd_rule: { \bool_gset_true:N \g_@@_draw_eor_bool } -\cs_new_protected:Npn \@@_draw_nonzero_rule: +\cs_new_protected:Npn \driver_draw_nonzero_rule: { \bool_gset_false:N \g_@@_draw_eor_bool } \bool_new:N \g_@@_draw_eor_bool % \end{macrocode} @@ -969,13 +972,13 @@ % % \begin{macro} % { -% \@@_draw_closepath: , -% \@@_draw_stroke: , -% \@@_draw_closestroke: , -% \@@_draw_fill: , -% \@@_draw_fillstroke: , -% \@@_draw_clip: , -% \@@_draw_discardpath: +% \driver_draw_closepath: , +% \driver_draw_stroke: , +% \driver_draw_closestroke: , +% \driver_draw_fill: , +% \driver_draw_fillstroke: , +% \driver_draw_clip: , +% \driver_draw_discardpath: % } % \begin{variable}{\g_@@_draw_clip_bool} % Unlike PDF, PostScript doesn't track separate colors for strokes and other @@ -988,9 +991,9 @@ % using a \TeX{} switch. All of the operations end with a new path instruction % as they do not terminate (again in contrast to PDF). % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_closepath: +\cs_new_protected:Npn \driver_draw_closepath: { \@@_draw_literal:n { closepath } } -\cs_new_protected:Npn \@@_draw_stroke: +\cs_new_protected:Npn \driver_draw_stroke: { \@@_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if } \@@_draw_literal:n { stroke } @@ -1006,12 +1009,12 @@ \@@_draw_literal:n { newpath } \bool_gset_false:N \g_@@_draw_clip_bool } -\cs_new_protected:Npn \@@_draw_closestroke: +\cs_new_protected:Npn \driver_draw_closestroke: { - \@@_draw_closepath: - \@@_draw_stroke: + \driver_draw_closepath: + \driver_draw_stroke: } -\cs_new_protected:Npn \@@_draw_fill: +\cs_new_protected:Npn \driver_draw_fill: { \@@_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if } \@@_draw_literal:x @@ -1031,7 +1034,7 @@ \@@_draw_literal:n { newpath } \bool_gset_false:N \g_@@_draw_clip_bool } -\cs_new_protected:Npn \@@_draw_fillstroke: +\cs_new_protected:Npn \driver_draw_fillstroke: { \@@_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if } \@@_draw_literal:x @@ -1054,10 +1057,10 @@ \@@_draw_literal:n { newpath } \bool_gset_false:N \g_@@_draw_clip_bool } -\cs_new_protected:Npn \@@_draw_clip: +\cs_new_protected:Npn \driver_draw_clip: { \bool_gset_true:N \g_@@_draw_clip_bool } \bool_new:N \g_@@_draw_clip_bool -\cs_new_protected:Npn \@@_draw_discardpath: +\cs_new_protected:Npn \driver_draw_discardpath: { \bool_if:NT \g_@@_draw_clip_bool { @@ -1074,19 +1077,19 @@ % \end{variable} % \end{macro} % -% \begin{macro}{\@@_draw_dash:nn} +% \begin{macro}{\driver_draw_cap_dash:nn} % \begin{macro}{\@@_draw_dash:n} -% \begin{macro}{\@@_draw_linewidth:n} -% \begin{macro}{\@@_draw_miterlimit:n} +% \begin{macro}{\driver_draw_linewidth:n} +% \begin{macro}{\driver_draw_miterlimit:n} % \begin{macro} % { -% \@@_draw_cap_butt:, \@@_draw_cap_round:, \@@_draw_cap_rectangle:, -% \@@_draw_join_miter:, \@@_draw_join_round:, \@@_draw_join_bevel: +% \driver_draw_cap_butt:, \driver_draw_cap_round:, \driver_draw_cap_rectangle:, +% \driver_draw_join_miter:, \driver_draw_join_round:, \driver_draw_join_bevel: % } % Converting paths to output is again a case of mapping directly to % PostScript operations. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_dash:nn #1#2 +\cs_new_protected:Npn \driver_draw_cap_dash:nn #1#2 { \@@_draw_literal:x { @@ -1098,24 +1101,24 @@ } \cs_new:Npn \@@_draw_dash:n #1 { \dim_to_decimal_in_bp:n {#1} ~ } -\cs_new_protected:Npn \@@_draw_linewidth:n #1 +\cs_new_protected:Npn \driver_draw_linewidth:n #1 { \@@_draw_literal:x { \dim_to_decimal_in_bp:n {#1} ~ setlinewidth } } -\cs_new_protected:Npn \@@_draw_miterlimit:n #1 +\cs_new_protected:Npn \driver_draw_miterlimit:n #1 { \@@_draw_literal:x { \fp_eval:n {#1} ~ setmiterlimit } } -\cs_new_protected:Npn \@@_draw_cap_butt: +\cs_new_protected:Npn \driver_draw_cap_butt: { \@@_draw_literal:n { 0 ~ setlinecap } } -\cs_new_protected:Npn \@@_draw_cap_round: +\cs_new_protected:Npn \driver_draw_cap_round: { \@@_draw_literal:n { 1 ~ setlinecap } } -\cs_new_protected:Npn \@@_draw_cap_rectangle: +\cs_new_protected:Npn \driver_draw_cap_rectangle: { \@@_draw_literal:n { 2 ~ setlinecap } } -\cs_new_protected:Npn \@@_draw_join_miter: +\cs_new_protected:Npn \driver_draw_join_miter: { \@@_draw_literal:n { 0 ~ setlinejoin } } -\cs_new_protected:Npn \@@_draw_join_round: +\cs_new_protected:Npn \driver_draw_join_round: { \@@_draw_literal:n { 1 ~ setlinejoin } } -\cs_new_protected:Npn \@@_draw_join_bevel: +\cs_new_protected:Npn \driver_draw_join_bevel: { \@@_draw_literal:n { 2 ~ setlinejoin } } % \end{macrocode} % \end{macro} @@ -1127,21 +1130,21 @@ % \begin{macro}{\_@@_draw_color_reset:} % \begin{macro} % { -% \@@_draw_color_cmyk:nnnn , -% \@@_draw_color_cmyk_fill:nnnn , -% \@@_draw_color_cmyk_stroke:nnnn +% \driver_draw_color_cmyk:nnnn , +% \driver_draw_fill_cmyk:nnnn , +% \driver_draw_stroke_cmyk:nnnn % } % \begin{macro} % { -% \@@_draw_color_gray:n , -% \@@_draw_color_gray_fill:n , -% \@@_draw_color_gray_stroke:n +% \driver_draw_color_gray:n , +% \driver_draw_fill_gray:n , +% \driver_draw_stroke_gray:n % } % \begin{macro} % { -% \@@_draw_color_rgb:nnn , -% \@@_draw_color_rgb_fill:nnn , -% \@@_draw_color_rgb_stroke:nnn +% \driver_draw_color_rgb:nnn , +% \driver_draw_fill_rgb:nnn , +% \driver_draw_stroke_rgb:nnn % } % To allow color to be defined for strokes and fills separately and to % respect scoping, the data needs to be stored at the PostScript level. @@ -1153,7 +1156,7 @@ \@@_draw_literal:n { currentdic~/l3fc~known~{ /l3fc~ { } ~def }~if } \@@_draw_literal:n { currentdic~/l3sc~known~{ /l3sc~ { } ~def }~if } } -\cs_new_protected:Npn \@@_draw_color_cmyk:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_color_cmyk:nnnn #1#2#3#4 { \@@_draw_literal:x { @@ -1163,7 +1166,7 @@ } \@@_draw_color_reset: } -\cs_new_protected:Npn \@@_draw_color_cmyk_fill:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_fill_cmyk:nnnn #1#2#3#4 { \@@_draw_literal:x { @@ -1176,9 +1179,9 @@ def } } -\cs_new_protected:Npn \@@_draw_color_cmyk_stroke:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_stroke_cmyk:nnnn #1#2#3#4 { - \__driver_draw_literal:x + \@@_draw_literal:x { /l3sc ~ { @@ -1189,16 +1192,16 @@ def } } -\cs_new_protected:Npn \@@_draw_color_gray:n #1 +\cs_new_protected:Npn \driver_draw_color_gray:n #1 { \@@_draw_literal:x { fp_eval:n {#1} ~ setgray } \@@_draw_color_reset: } -\cs_new_protected:Npn \@@_draw_color_gray_fill:n #1 +\cs_new_protected:Npn \driver_draw_fill_gray:n #1 { \@@_draw_literal:x { /l3fc ~ { \fp_eval:n {#1} ~ setgray } ~ def } } -\cs_new_protected:Npn \@@_draw_color_gray_stroke:n #1 +\cs_new_protected:Npn \driver_draw_stroke_gray:n #1 { \@@_draw_literal:x { /l3sc ~ { \fp_eval:n {#1} ~ setgray } ~ def } } -\cs_new_protected:Npn \@@_draw_color_rgb:nnn #1#2#3 +\cs_new_protected:Npn \driver_draw_color_rgb:nnn #1#2#3 { \@@_draw_literal:x { @@ -1207,7 +1210,7 @@ } \@@_draw_color_reset: } -\cs_new_protected:Npn \@@_draw_color_rgb_fill:nnn #1#2#3 +\cs_new_protected:Npn \driver_draw_fill_rgb:nnn #1#2#3 { \@@_draw_literal:x { @@ -1219,7 +1222,7 @@ def } } -\cs_new_protected:Npn \@@_draw_color_rgb_stroke:nnn #1#2#3 +\cs_new_protected:Npn \driver_draw_stroke_rgb:nnn #1#2#3 { \@@_draw_literal:x { @@ -1237,12 +1240,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_transformcm:nnnnnn} +% \begin{macro}{\driver_draw_transformcm:nnnnnn} % The first four arguments here are floats (the affine matrix), the last % two are a displacement vector. Once again, force evaluation to allow for % caching. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_transformcm:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \driver_draw_transformcm:nnnnnn #1#2#3#4#5#6 { \@@_draw_literal:x { @@ -1257,7 +1260,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_hbox:Nnnnnnn} +% \begin{macro}{\driver_draw_hbox:Nnnnnnn} % 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. Instead, we need to reverse the effect of @@ -1267,11 +1270,11 @@ % drawing origin so has to be done purely in driver code not using \TeX{} % offsets. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \driver_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 { \@@_scope_begin: \tex_special:D { ps::[end] } - \@@_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7} + \driver_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7} \tex_special:D { ps::~72~Resolution~div~72~VResolution~div~neg~scale } \tex_special:D { ps::~magscale~{1~DVImag~div~dup~scale}~if } \tex_special:D { ps::~l3x~neg~l3y~neg~translate } @@ -1355,7 +1358,7 @@ % % \subsubsection{Box operations} % -% \begin{macro}{\@@_box_use_clip:N} +% \begin{macro}{\driver_box_use_clip:N} % The general method is to save the current location, define a clipping path % equivalent to the bounding box, then insert the content at the current % position and in a zero width box. The \enquote{real} width is then made up @@ -1364,7 +1367,7 @@ % as much code as possible and uses the same conversions (and so same % rounding errors) in all cases. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_clip:N #1 +\cs_new_protected:Npn \driver_box_use_clip:N #1 { \@@_scope_begin: \@@_literal:n @@ -1382,7 +1385,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_use_rotate:Nn} +% \begin{macro}{\driver_box_use_rotate:Nn} % \begin{variable}{\l_@@_cos_fp, \l_@@_sin_fp} % Rotations are set using an affine transformation matrix which therefore % requires sine/cosine values not the angle itself. We store the rounded @@ -1391,7 +1394,7 @@ % with problematic display programs. Note that numbers are compared to~$0$ % after rounding. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 +\cs_new_protected:Npn \driver_box_use_rotate:Nn #1#2 { \@@_scope_begin: \box_set_wd:Nn #1 { 0pt } @@ -1421,11 +1424,11 @@ % \end{variable} % \end{macro} % -% \begin{macro}{\@@_box_use_scale:Nnn} +% \begin{macro}{\driver_box_use_scale:Nnn} % The same idea as for rotation but without the complexity of signs and % cosines. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 +\cs_new_protected:Npn \driver_box_use_scale:Nnn #1#2#3 { \@@_scope_begin: \@@_matrix:n @@ -1467,13 +1470,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_image_getbb_jpg:n #1 { - \int_zero:N \l__image_page_int - \tl_clear:N \l__image_pagebox_tl + \int_zero:N \l_image_page_int + \tl_clear:N \l_image_pagebox_tl \tl_set:Nx \l_@@_image_attr_tl { - \tl_if_empty:NF \l__image_decode_tl - { :D \l__image_decode_tl } - \bool_if:NT \l__image_interpolate_bool + \tl_if_empty:NF \l_image_decode_tl + { :D \l_image_decodearray_tl } + \bool_if:NT \l_image_interpolate_bool { :I } } \tl_clear:N \l_@@_image_attr_tl @@ -1482,27 +1485,19 @@ \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n \cs_new_protected:Npn \@@_image_getbb_pdf:n #1 { - \tl_clear:N \l__image_decode_tl - \bool_set_false:N \l__image_interpolate_bool + \tl_clear:N \l_image_decode_tl + \bool_set_false:N \l_image_interpolate_bool \tl_set:Nx \l_@@_image_attr_tl { - : \l__image_pagebox_tl - \int_compare:nNnT \l__image_page_int > 1 - { :P \int_use:N \l__image_page_int } + : \l_image_pagebox_tl + \int_compare:nNnT \l_image_page_int > 1 + { :P \int_use:N \l_image_page_int } } \@@_image_getbb_auxi:n {#1} } \cs_new_protected:Npn \@@_image_getbb_auxi:n #1 { - \dim_zero:N \l__image_llx_dim - \dim_zero:N \l__image_lly_dim - \dim_if_exist:cTF { c__image_ #1 \l_@@_image_attr_tl _urx_dim } - { - \dim_set_eq:Nc \l__image_urx_dim - { c__image_ #1 \l_@@_image_attr_tl _urx_dim } - \dim_set_eq:Nc \l__image_ury_dim - { c__image_ #1 \l_@@_image_attr_tl _ury_dim } - } + \image_bb_restore:xF { #1 \l_@@_image_attr_tl } { \@@_image_getbb_auxii:n {#1} } } % \begin{macrocode} @@ -1515,32 +1510,29 @@ { \tex_immediate:D \pdftex_pdfximage:D \bool_lazy_or:nnT - { \l__image_interpolate_bool } - { ! \tl_if_empty_p:N \l__image_decode_tl } + { \l_image_interpolate_bool } + { ! \tl_if_empty_p:N \l_image_decodearray_tl } { attr ~ { - \tl_if_empty:NF \l__image_decode_tl - { /Decode~[ \l__image_decode_tl ] } - \bool_if:NT \l__image_interpolate_bool + \tl_if_empty:NF \l_image_decode_tl + { /Decode~[ \l_image_decodearray_tl ] } + \bool_if:NT \l_image_interpolate_bool { /Interpolate~true } } } - \int_compare:nNnT \l__image_page_int > 0 - { page ~ \int_use:N \l__image_page_int } - \tl_if_empty:NF \l__image_pagebox_tl - { \l__image_pagebox_tl } + \int_compare:nNnT \l_image_page_int > 0 + { page ~ \int_use:N \l_image_page_int } + \tl_if_empty:NF \l_image_pagebox_tl + { \l_image_pagebox_tl } {#1} - \hbox_set:Nn \l__image_tmp_box + \hbox_set:Nn \l_@@_tmp_box { \pdftex_pdfrefximage:D \pdftex_pdflastximage:D } - \dim_set:Nn \l__image_urx_dim { \box_wd:N \l__image_tmp_box } - \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box } - \int_const:cn { c__image_ #1 \l_@@_image_attr_tl _int } + \dim_set:Nn \l_image_urx_dim { \box_wd:N \l_@@_tmp_box } + \dim_set:Nn \l_image_ury_dim { \box_ht:N \l_@@_tmp_box } + \int_const:cn { c_@@_image_ #1 \l_@@_image_attr_tl _int } { \tex_the:D \pdftex_pdflastximage:D } - \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _urx_dim } - { \l__image_urx_dim } - \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _ury_dim } - { \l__image_ury_dim } + \image_bb_save:x { #1 \l_@@_image_attr_tl } } % \end{macrocode} % \end{macro} @@ -1555,7 +1547,7 @@ \cs_new_protected:Npn \@@_image_include_jpg:n #1 { \pdftex_pdfrefximage:D - \int_use:c { c__image_ #1 \l_@@_image_attr_tl _int } + \int_use:c { c_@@_image_ #1 \l_@@_image_attr_tl _int } } \cs_new_eq:NN \@@_image_include_pdf:n \@@_image_include_jpg:n \cs_new_eq:NN \@@_image_include_png:n \@@_image_include_jpg:n @@ -1603,11 +1595,11 @@ % % \subsubsection{Box operations} % -% \begin{macro}{\@@_box_use_clip:N} -% The code here is idential to that for \texttt{pdfmode}: unlike rotation and +% \begin{macro}{\driver_box_use_clip:N} +% The code here is identical to that for \texttt{pdfmode}: unlike rotation and % scaling, there is no higher-level support in the driver for clipping. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_clip:N #1 +\cs_new_protected:Npn \driver_box_use_clip:N #1 { \@@_scope_begin: \@@_literal:n @@ -1625,7 +1617,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_use_rotate:Nn} +% \begin{macro}{\driver_box_use_rotate:Nn} % Rotating in \texttt{(x)}dvipdmfx can be implemented using either PDF or % driver-specific code. The former approach however is not \enquote{aware} % of the content of boxes: this means that any embedded links would not be @@ -1634,7 +1626,7 @@ % version (notice the rotation angle here is positive). As for % \texttt{dvips}, zero rotation is written as |0| not |-0|. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 +\cs_new_protected:Npn \driver_box_use_rotate:Nn #1#2 { \@@_scope_begin: \tex_special:D @@ -1650,11 +1642,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_use_scale:Nnn} +% \begin{macro}{\driver_box_use_scale:Nnn} % Much the same idea for scaling: use the higher-level driver operation to allow % for box content. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 +\cs_new_protected:Npn \driver_box_use_scale:Nnn #1#2#3 { \@@_scope_begin: \tex_special:D @@ -1679,20 +1671,20 @@ % Simply use the generic functions: only for \texttt{dvipdfmx} in the % extraction cases. % \begin{macrocode} -\cs_new_eq:NN \@@_image_getbb_eps:n \__image_read_bb:n +\cs_new_eq:NN \@@_image_getbb_eps:n \image_read_bb:n %<*dvipdfmx> \cs_new_protected:Npn \@@_image_getbb_jpg:n #1 { - \int_zero:N \l__image_page_int - \tl_clear:N \l__image_pagebox_tl - \__image_extract_bb:n {#1} + \int_zero:N \l_image_page_int + \tl_clear:N \l_image_pagebox_tl + \image_extract_bb:n {#1} } \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n \cs_new_protected:Npn \@@_image_getbb_pdf:n #1 { - \tl_clear:N \l__image_decode_tl - \bool_set_false:N \l__image_interpolate_bool - \__image_extract_bb:n {#1} + \tl_clear:N \l_image_decode_tl + \bool_set_false:N \l_image_interpolate_bool + \image_extract_bb:n {#1} } %</dvipdfmx> % \end{macrocode} @@ -1739,23 +1731,23 @@ { \@@_image_include_auxii:xnn { - \tl_if_empty:NF \l__image_pagebox_tl - { : \l__image_pagebox_tl } - \int_compare:nNnT \l__image_page_int > 1 - { :P \int_use:N \l__image_page_int } - \tl_if_empty:NF \l__image_decode_tl - { :D \l__image_decode_tl } - \bool_if:NT \l__image_interpolate_bool + \tl_if_empty:NF \l_image_pagebox_tl + { : \l_image_pagebox_tl } + \int_compare:nNnT \l_image_page_int > 1 + { :P \int_use:N \l_image_page_int } + \tl_if_empty:NF \l_image_decode_tl + { :D \l_image_decodearray_tl } + \bool_if:NT \l_image_interpolate_bool { :I } } {#1} {#2} } \cs_new_protected:Npn \@@_image_include_auxii:nnn #1#2#3 { - \int_if_exist:cTF { c__image_ #2#1 _int } + \int_if_exist:cTF { c_@@_image_ #2#1 _int } { \tex_special:D - { pdf:usexobj~@image \int_use:c { c__image_ #2#1 _int } } + { pdf:usexobj~@image \int_use:c { c_@@_image_ #2#1 _int } } } { \@@_image_include_auxiii:nn {#2} {#1} {#3} } } @@ -1769,31 +1761,31 @@ \cs_new_protected:Npn \@@_image_include_auxiii:nnn #1#2#3 { \int_gincr:N \g_@@_image_int - \int_const:cn { c__image_ #1#2 _int } { \g_@@_image_int } + \int_const:cn { c_@@_image_ #1#2 _int } { \g_@@_image_int } \tex_special:D { pdf:#3~ - @image \int_use:c { c__image_ #1#2 _int } - \int_compare:nNnT \l__image_page_int > 1 - { page ~ \int_use:N \l__image_page_int \c_space_tl } - \tl_if_empty:NF \l__image_pagebox_tl + @image \int_use:c { c_@@_image_ #1#2 _int } + \int_compare:nNnT \l_image_page_int > 1 + { page ~ \int_use:N \l_image_page_int \c_space_tl } + \tl_if_empty:NF \l_image_pagebox_tl { - pagebox ~ \l__image_pagebox_tl \c_space_tl + pagebox ~ \l_image_pagebox_tl \c_space_tl bbox ~ - \dim_to_decimal_in_bp:n \l__image_llx_dim \c_space_tl - \dim_to_decimal_in_bp:n \l__image_lly_dim \c_space_tl - \dim_to_decimal_in_bp:n \l__image_urx_dim \c_space_tl - \dim_to_decimal_in_bp:n \l__image_ury_dim \c_space_tl + \dim_to_decimal_in_bp:n \l_image_llx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l_image_lly_dim \c_space_tl + \dim_to_decimal_in_bp:n \l_image_urx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l_image_ury_dim \c_space_tl } (#1) \bool_lazy_or:nnT - { \l__image_interpolate_bool } - { ! \tl_if_empty_p:N \l__image_decode_tl } + { \l_image_interpolate_bool } + { ! \tl_if_empty_p:N \l_image_decodearray_tl } { << - \tl_if_empty:NF \l__image_decode_tl - { /Decode~[ \l__image_decode_tl ] } - \bool_if:NT \l__image_interpolate_bool + \tl_if_empty:NF \l_image_decode_tl + { /Decode~[ \l_image_decodearray_tl ] } + \bool_if:NT \l_image_interpolate_bool { /Interpolate~true> } >> } @@ -1833,21 +1825,21 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_image_getbb_jpg:n #1 { - \int_zero:N \l__image_page_int - \tl_clear:N \l__image_pagebox_tl + \int_zero:N \l_image_page_int + \tl_clear:N \l_image_pagebox_tl \@@_image_getbb_auxi:nN {#1} \xetex_picfile:D } \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n \cs_new_protected:Npn \@@_image_getbb_pdf:n #1 { - \tl_clear:N \l__image_decode_tl - \bool_set_false:N \l__image_interpolate_bool + \tl_clear:N \l_image_decode_tl + \bool_set_false:N \l_image_interpolate_bool \@@_image_getbb_auxi:nN {#1} \xetex_pdffile:D } \cs_new_protected:Npn \@@_image_getbb_auxi:nN #1#2 { - \int_compare:nNnTF \l__image_page_int > 1 - { \@@_image_getbb_auxii:VnN \l__image_page_int {#1} #2 } + \int_compare:nNnTF \l_image_page_int > 1 + { \@@_image_getbb_auxii:VnN \l_image_page_int {#1} #2 } { \@@_image_getbb_auxiii:nNnn {#1} #2 } } \cs_new_protected:Npn \@@_image_getbb_auxii:nnN #1#2#3 @@ -1855,8 +1847,8 @@ \cs_generate_variant:Nn \@@_image_getbb_auxii:nnN { V } \cs_new_protected:Npn \@@_image_getbb_auxiii:nNnn #1#2#3#4 { - \tl_if_empty:NTF \l__image_pagebox_tl - { \@@_image_getbb_auxiv:VnNnn \l__image_pagebox_tl } + \tl_if_empty:NTF \l_image_pagebox_tl + { \@@_image_getbb_auxiv:VnNnn \l_image_pagebox_tl } { \@@_image_getbb_auxv:nNnn } {#1} #2 {#3} {#4} } @@ -1871,24 +1863,15 @@ \cs_generate_variant:Nn \@@_image_getbb_auxiv:nnNnn { V } \cs_new_protected:Npn \@@_image_getbb_auxv:nNnn #1#2#3#4 { - \dim_zero:N \l__image_llx_dim - \dim_zero:N \l__image_lly_dim - \dim_if_exist:cTF { c__image_ #1#3 _urx_dim } - { - \dim_set_eq:Nc \l__image_urx_dim { c__image_ #1#3 _urx_dim } - \dim_set_eq:Nc \l__image_ury_dim { c__image_ #1#3 _ury_dim } - } + \image_bb_restore:nF {#1#3} { \@@_image_getbb_auxvi:nNnn {#1} #2 {#3} {#4} } } \cs_new_protected:Npn \@@_image_getbb_auxvi:nNnn #1#2#3#4 { - \hbox_set:Nn \l__image_tmp_box { #2 #1 ~ #4 } - \dim_set:Nn \l__image_utx_dim { \box_wd:N \l__image_tmp_box } - \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box } - \dim_const:cn { c__image_ #1#3 _urx_dim } - { \l__image_urx_dim } - \dim_const:cn { c__image_ #1#3 _ury_dim } - { \l__image_ury_dim } + \hbox_set:Nn \l_@@_tmp_box { #2 #1 ~ #4 } + \dim_set:Nn \l_image_utx_dim { \box_wd:N \l_@@_tmp_box } + \dim_set:Nn \l_image_ury_dim { \box_ht:N \l_@@_tmp_box } + \image_bb_save:n {#1#3} } \cs_new:Npn \@@_image_getbb_pagebox:w #1 box {#1} % \end{macrocode} @@ -1904,14 +1887,14 @@ % For PDF images, properly supporting the |pagebox| concept in \XeTeX{} % is best done using the |\xetex_pdffile:D| primitive. The syntax here % is the same as for the image measurement part, although we know at this -% stage that there must be some valid setting for \cs{l__image_pagebox_tl}. +% stage that there must be some valid setting for \cs{l_image_pagebox_tl}. % \begin{macrocode} \cs_new_protected:Npn \@@_image_include_pdf:n #1 { \xetex_pdffile:D "#1" ~ - \int_compare:nNnT \l__image_page_int > 0 - { page~ \int_use:N \l__image_page_int } - \@@_image_getbb_auxiv:VnNnn \l__image_pagebox_tl + \int_compare:nNnT \l_image_page_int > 0 + { page~ \int_use:N \l_image_page_int } + \@@_image_getbb_auxiv:VnNnn \l_image_pagebox_tl } % \end{macrocode} % \end{macro} @@ -1939,46 +1922,46 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_begin:, \@@_draw_end:} +% \begin{macro}{\driver_draw_begin:, \driver_draw_end:} % No special requirements here, so simply set up a drawing scope. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_begin: - { \@@_draw_scope_begin: } -\cs_new_protected:Npn \@@_draw_end: - { \@@_draw_scope_end: } +\cs_new_protected:Npn \driver_draw_begin: + { \driver_draw_scope_begin: } +\cs_new_protected:Npn \driver_draw_end: + { \driver_draw_scope_end: } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_scope_begin:, \@@_draw_scope_end:} +% \begin{macro}{\driver_draw_scope_begin:, \driver_draw_scope_end:} % In contrast to a general scope, a drawing scope is always done using % the PDF operators so is the same for all relevant drivers. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_scope_begin: +\cs_new_protected:Npn \driver_draw_scope_begin: { \@@_draw_literal:n { q } } -\cs_new_protected:Npn \@@_draw_scope_end: +\cs_new_protected:Npn \driver_draw_scope_end: { \@@_draw_literal:n { Q } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_moveto:nn, \@@_draw_lineto:nn} -% \begin{macro}{\@@_draw_curveto:nnnnnn} -% \begin{macro}{\@@_draw_rectangle:nnnn} +% \begin{macro}{\driver_draw_moveto:nn, \driver_draw_lineto:nn} +% \begin{macro}{\driver_draw_curveto:nnnnnn} +% \begin{macro}{\driver_draw_rectangle:nnnn} % Path creation operations all resolve directly to PDF primitive steps, with % only the need to convert to \texttt{bp}. Notice that \texttt{x}-type % expansion is included here to ensure that any variable values are % forced to literals before any possible caching. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_moveto:nn #1#2 +\cs_new_protected:Npn \driver_draw_moveto:nn #1#2 { \@@_draw_literal:x { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ m } } -\cs_new_protected:Npn \@@_draw_lineto:nn #1#2 +\cs_new_protected:Npn \driver_draw_lineto:nn #1#2 { \@@_draw_literal:x { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ l } } -\cs_new_protected:Npn \@@_draw_curveto:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \driver_draw_curveto:nnnnnn #1#2#3#4#5#6 { \@@_draw_literal:x { @@ -1988,7 +1971,7 @@ c } } -\cs_new_protected:Npn \@@_draw_rectangle:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_rectangle:nnnn #1#2#3#4 { \@@_draw_literal:x { @@ -2002,13 +1985,13 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_evenodd_rule:, \@@_draw_nonzero_rule:} +% \begin{macro}{\driver_draw_evenodd_rule:, \driver_draw_nonzero_rule:} % \begin{variable}{\g_@@_draw_eor_bool} % The even-odd rule here can be implemented as a simply switch. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_evenodd_rule: +\cs_new_protected:Npn \driver_draw_evenodd_rule: { \bool_gset_true:N \g_@@_draw_eor_bool } -\cs_new_protected:Npn \@@_draw_nonzero_rule: +\cs_new_protected:Npn \driver_draw_nonzero_rule: { \bool_gset_false:N \g_@@_draw_eor_bool } \bool_new:N \g_@@_draw_eor_bool % \end{macrocode} @@ -2017,56 +2000,56 @@ % % \begin{macro} % { -% \@@_draw_closepath: , -% \@@_draw_stroke: , -% \@@_draw_closestroke: , -% \@@_draw_fill: , -% \@@_draw_fillstroke: , -% \@@_draw_clip: , -% \@@_draw_discardpath: +% \driver_draw_closepath: , +% \driver_draw_stroke: , +% \driver_draw_closestroke: , +% \driver_draw_fill: , +% \driver_draw_fillstroke: , +% \driver_draw_clip: , +% \driver_draw_discardpath: % } % Converting paths to output is again a case of mapping directly to % PDF operations. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_closepath: +\cs_new_protected:Npn \driver_draw_closepath: { \@@_draw_literal:n { h } } -\cs_new_protected:Npn \@@_draw_stroke: +\cs_new_protected:Npn \driver_draw_stroke: { \@@_draw_literal:n { S } } -\cs_new_protected:Npn \@@_draw_closestroke: +\cs_new_protected:Npn \driver_draw_closestroke: { \@@_draw_literal:n { s } } -\cs_new_protected:Npn \@@_draw_fill: +\cs_new_protected:Npn \driver_draw_fill: { \@@_draw_literal:x { f \bool_if:NT \g_@@_draw_eor_bool * } } -\cs_new_protected:Npn \@@_draw_fillstroke: +\cs_new_protected:Npn \driver_draw_fillstroke: { \@@_draw_literal:x { B \bool_if:NT \g_@@_draw_eor_bool * } } -\cs_new_protected:Npn \@@_draw_clip: +\cs_new_protected:Npn \driver_draw_clip: { \@@_draw_literal:x { W \bool_if:NT \g_@@_draw_eor_bool * } } -\cs_new_protected:Npn \@@_draw_discardpath: +\cs_new_protected:Npn \driver_draw_discardpath: { \@@_draw_literal:n { n } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_dash:nn} +% \begin{macro}{\driver_draw_cap_dash:nn} % \begin{macro}{\@@_draw_dash:n} -% \begin{macro}{\@@_draw_linewidth:n} -% \begin{macro}{\@@_draw_miterlimit:n} +% \begin{macro}{\driver_draw_linewidth:n} +% \begin{macro}{\driver_draw_miterlimit:n} % \begin{macro} % { -% \@@_draw_cap_butt:, \@@_draw_cap_round:, \@@_draw_cap_rectangle:, -% \@@_draw_join_miter:, \@@_draw_join_round:, \@@_draw_join_bevel: +% \driver_draw_cap_butt:, \driver_draw_cap_round:, \driver_draw_cap_rectangle:, +% \driver_draw_join_miter:, \driver_draw_join_round:, \driver_draw_join_bevel: % } % Converting paths to output is again a case of mapping directly to % PDF operations. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_dash:nn #1#2 +\cs_new_protected:Npn \driver_draw_cap_dash:nn #1#2 { \@@_draw_literal:x { @@ -2078,24 +2061,24 @@ } \cs_new:Npn \@@_draw_dash:n #1 { \dim_to_decimal_in_bp:n {#1} ~ } -\cs_new_protected:Npn \@@_draw_linewidth:n #1 +\cs_new_protected:Npn \driver_draw_linewidth:n #1 { \@@_draw_literal:x { \dim_to_decimal_in_bp:n {#1} ~ w } } -\cs_new_protected:Npn \@@_draw_miterlimit:n #1 +\cs_new_protected:Npn \driver_draw_miterlimit:n #1 { \@@_draw_literal:x { \fp_eval:n {#1} ~ M } } -\cs_new_protected:Npn \@@_draw_cap_butt: +\cs_new_protected:Npn \driver_draw_cap_butt: { \@@_draw_literal:n { 0 ~ J } } -\cs_new_protected:Npn \@@_draw_cap_round: +\cs_new_protected:Npn \driver_draw_cap_round: { \@@_draw_literal:n { 1 ~ J } } -\cs_new_protected:Npn \@@_draw_cap_rectangle: +\cs_new_protected:Npn \driver_draw_cap_rectangle: { \@@_draw_literal:n { 2 ~ J } } -\cs_new_protected:Npn \@@_draw_join_miter: +\cs_new_protected:Npn \driver_draw_join_miter: { \@@_draw_literal:n { 0 ~ j } } -\cs_new_protected:Npn \@@_draw_join_round: +\cs_new_protected:Npn \driver_draw_join_round: { \@@_draw_literal:n { 1 ~ j } } -\cs_new_protected:Npn \@@_draw_join_bevel: +\cs_new_protected:Npn \driver_draw_join_bevel: { \@@_draw_literal:n { 2 ~ j } } % \end{macrocode} % \end{macro} @@ -2106,29 +2089,29 @@ % % \begin{macro} % { -% \@@_draw_color_cmyk:nnnn , -% \@@_draw_color_cmyk_fill:nnnn , -% \@@_draw_color_cmyk_stroke:nnnn +% \driver_draw_color_cmyk:nnnn , +% \driver_draw_fill_cmyk:nnnn , +% \driver_draw_stroke_cmyk:nnnn % } % \begin{macro}{\@@_draw_color_cmyk_aux:nnnn} % \begin{macro} % { -% \@@_draw_color_gray:n , -% \@@_draw_color_gray_fill:n , -% \@@_draw_color_gray_stroke:n +% \driver_draw_color_gray:n , +% \driver_draw_fill_gray:n , +% \driver_draw_stroke_gray:n % } % \begin{macro}{\@@_draw_color_gray_aux:n} % \begin{macro} % { -% \@@_draw_color_rgb:nnn , -% \@@_draw_color_rgb_fill:nnn , -% \@@_draw_color_rgb_stroke:nnn +% \driver_draw_color_rgb:nnn , +% \driver_draw_fill_rgb:nnn , +% \driver_draw_stroke_rgb:nnn % } % \begin{macro}{\@@_draw_color_rgb_aux:nnn} % Yet more fast conversion, all using the FPU to allow for expressions % in numerical input. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_color_cmyk:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_color_cmyk:nnnn #1#2#3#4 { \use:x { @@ -2144,7 +2127,7 @@ \@@_draw_literal:n { #1 ~ #2 ~ #3 ~ #4 ~ k ~ #1 ~ #2 ~ #3 ~ #4 ~ K } } -\cs_new_protected:Npn \@@_draw_color_cmyk_fill:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_fill_cmyk:nnnn #1#2#3#4 { \@@_draw_literal:x { @@ -2153,7 +2136,7 @@ k } } -\cs_new_protected:Npn \@@_draw_color_cmyk_stroke:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_stroke_cmyk:nnnn #1#2#3#4 { \@@_draw_literal:x { @@ -2162,7 +2145,7 @@ K } } -\cs_new_protected:Npn \@@_draw_color_gray:n #1 +\cs_new_protected:Npn \driver_draw_color_gray:n #1 { \use:x { \@@_draw_color_gray_aux:n { \fp_eval:n {#1} } } @@ -2171,11 +2154,11 @@ { \@@_draw_literal:n { #1 ~ g ~ #1 ~ G } } -\cs_new_protected:Npn \@@_draw_color_gray_fill:n #1 +\cs_new_protected:Npn \driver_draw_fill_gray:n #1 { \@@_draw_literal:x { \fp_eval:n {#1} ~ g } } -\cs_new_protected:Npn \@@_draw_color_gray_stroke:n #1 +\cs_new_protected:Npn \driver_draw_stroke_gray:n #1 { \@@_draw_literal:x { \fp_eval:n {#1} ~ G } } -\cs_new_protected:Npn \@@_draw_color_rgb:nnn #1#2#3 +\cs_new_protected:Npn \driver_draw_color_rgb:nnn #1#2#3 { \use:x { @@ -2190,12 +2173,12 @@ \@@_draw_literal:n { #1 ~ #2 ~ #3 ~ rg ~ #1 ~ #2 ~ #3 ~ RG } } -\cs_new_protected:Npn \@@_draw_color_rgb_fill:nnn #1#2#3 +\cs_new_protected:Npn \driver_draw_fill_rgb:nnn #1#2#3 { \@@_draw_literal:x { \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ rg } } -\cs_new_protected:Npn \@@_draw_color_rgb_stroke:nnn #1#2#3 +\cs_new_protected:Npn \driver_draw_stroke_rgb:nnn #1#2#3 { \@@_draw_literal:x { \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ RG } @@ -2208,12 +2191,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_transformcm:nnnnnn} +% \begin{macro}{\driver_draw_transformcm:nnnnnn} % The first four arguments here are floats (the affine matrix), the last % two are a displacement vector. Once again, force evaluation to allow for % caching. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_transformcm:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \driver_draw_transformcm:nnnnnn #1#2#3#4#5#6 { \@@_draw_literal:x { @@ -2226,7 +2209,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_hbox:Nnnnnnn} +% \begin{macro}{\driver_draw_hbox:Nnnnnnn} % \begin{variable}{\l_@@_tmp_box} % Inserting a \TeX{} box transformed to the requested position and using % the current matrix is done using a mixture of \TeX{} and low-level @@ -2235,13 +2218,13 @@ % operation can never be cached, the scope is set directly not using the % \texttt{draw} version. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \driver_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 { \hbox_set:Nn \l_@@_tmp_box { \tex_kern:D \__dim_eval:n {#6} \@@_scope_begin: - \@@_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} + \driver_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} { 0pt } { 0pt } \box_move_up:nn {#7} { \box_use:N #1 } \@@_scope_end: @@ -2306,7 +2289,7 @@ % % \subsubsection{Box operations} % -% \begin{macro}{\@@_box_use_clip:N} +% \begin{macro}{\driver_box_use_clip:N} % \begin{variable}{\g_@@_clip_path_int} % Clipping in SVG is more involved than with other drivers. The first issue % is that the clipping path must be defined separately from where it is used, @@ -2317,7 +2300,7 @@ % up and down using scopes to allow for the depth of the \TeX{} box and % keep the reference point the same! % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_clip:N #1 +\cs_new_protected:Npn \driver_box_use_clip:N #1 { \int_gincr:N \g_@@_clip_path_int \@@_literal:n @@ -2381,12 +2364,12 @@ % \end{variable} % \end{macro} % -% \begin{macro}{\@@_box_use_rotate:Nn} +% \begin{macro}{\driver_box_use_rotate:Nn} % Rotation has a dedicated operation which includes a centre-of-rotation % optional pair. That can be picked up from the driver syntax, so there is % no need to worry about the transformation matrix. % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 +\cs_new_protected:Npn \driver_box_use_rotate:Nn #1#2 { \@@_scope_begin:n { @@ -2402,12 +2385,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_use_scale:Nnn} +% \begin{macro}{\driver_box_use_scale:Nnn} % In contrast to rotation, we have to account for the current position in this % case. That is done using a couple of translations in addition to the scaling % (which is therefore done backward with a flip). % \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 +\cs_new_protected:Npn \driver_box_use_scale:Nnn #1#2#3 { \@@_scope_begin:n { @@ -2434,8 +2417,8 @@ % \begin{macro}{\@@_image_getbb_png:n, \@@_image_getbb_jpg:n} % These can be included by extracting the bounding box data. % \begin{macrocode} -\cs_new_eq:NN \@@_image_getbb_png:n \__image_extract_bb:n -\cs_new_eq:NN \@@_image_getbb_jpg:n \__image_extract_bb:n +\cs_new_eq:NN \@@_image_getbb_png:n \image_extract_bb:n +\cs_new_eq:NN \@@_image_getbb_jpg:n \image_extract_bb:n % \end{macrocode} % \end{macro} % @@ -2453,8 +2436,8 @@ \tex_special:D { dvisvgm:img~ - \dim_to_decimal:n { \l__image_ury_dim } ~ - \dim_to_decimal:n { \l__image_ury_dim } ~ + \dim_to_decimal:n { \l_image_ury_dim } ~ + \dim_to_decimal:n { \l_image_ury_dim } ~ \@@_image_include_bitmap_quote:w #1 " " \q_stop } } @@ -2474,21 +2457,21 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_begin:, \@@_draw_end:} +% \begin{macro}{\driver_draw_begin:, \driver_draw_end:} % A drawing needs to be set up such that the co-ordinate system is % translated. That is done inside a scope, which as described below % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_begin: +\cs_new_protected:Npn \driver_draw_begin: { - \@@_draw_scope_begin: + \driver_draw_scope_begin: \@@_draw_scope:n { transform="translate({?x},{?y})~scale(1,-1)" } } -\cs_new_protected:Npn \@@_draw_end: - { \@@_draw_scope_end: } +\cs_new_protected:Npn \driver_draw_end: + { \driver_draw_scope_end: } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_scope_begin:, \@@_draw_scope_end:} +% \begin{macro}{\driver_draw_scope_begin:, \driver_draw_scope_end:} % \begin{macro}{\@@_draw_scope:n, \@@_draw_scope:x} % \begin{variable}{\g_@@_draw_scope_int, \l_@@_draw_scope_int} % Several settings that with other drivers are \enquote{stand alone} have @@ -2499,7 +2482,7 @@ % 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 \@@_draw_scope_begin: +\cs_new_protected:Npn \driver_draw_scope_begin: { \int_set_eq:NN \l_@@_draw_scope_int @@ -2507,7 +2490,7 @@ \group_begin: \int_gzero:N \g_@@_draw_scope_int } -\cs_new_protected:Npn \@@_draw_scope_end: +\cs_new_protected:Npn \driver_draw_scope_end: { \prg_replicate:nn { \g_@@_draw_scope_int } @@ -2530,9 +2513,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_moveto:nn, \@@_draw_lineto:nn} -% \begin{macro}{\@@_draw_rectangle:nnnn} -% \begin{macro}{\@@_draw_curveto:nnnnnn} +% \begin{macro}{\driver_draw_moveto:nn, \driver_draw_lineto:nn} +% \begin{macro}{\driver_draw_rectangle:nnnn} +% \begin{macro}{\driver_draw_curveto:nnnnnn} % \begin{macro}{\@@_draw_add_to_path:n} % \begin{variable}{\g_@@_draw_path_tl} % Once again, some work is needed to get path constructs correct. Rather @@ -2542,17 +2525,17 @@ % be fully expanded there is no need to worry about the internal % \texttt{x}-type expansion. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_moveto:nn #1#2 +\cs_new_protected:Npn \driver_draw_moveto:nn #1#2 { \@@_draw_add_to_path:n { M ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} } } -\cs_new_protected:Npn \@@_draw_lineto:nn #1#2 +\cs_new_protected:Npn \driver_draw_lineto:nn #1#2 { \@@_draw_add_to_path:n { L ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} } } -\cs_new_protected:Npn \@@_draw_rectangle:nnnn #1#2#3#4 +\cs_new_protected:Npn \driver_draw_rectangle:nnnn #1#2#3#4 { \@@_draw_add_to_path:n { @@ -2563,7 +2546,7 @@ Z } } -\cs_new_protected:Npn \@@_draw_curveto:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \driver_draw_curveto:nnnnnn #1#2#3#4#5#6 { \@@_draw_add_to_path:n { @@ -2590,12 +2573,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_evenodd_rule:, \@@_draw_nonzero_rule:} +% \begin{macro}{\driver_draw_evenodd_rule:, \driver_draw_nonzero_rule:} % The fill rules here have to be handled as scopes. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_evenodd_rule: +\cs_new_protected:Npn \driver_draw_evenodd_rule: { \@@_draw_scope:n { fill-rule="evenodd" } } -\cs_new_protected:Npn \@@_draw_nonzero_rule: +\cs_new_protected:Npn \driver_draw_nonzero_rule: { \@@_draw_scope:n { fill-rule="nonzero" } } % \end{macrocode} % \end{macro} @@ -2603,13 +2586,13 @@ % \begin{macro}{\@@_draw_path:n} % \begin{macro} % { -% \@@_draw_closepath: , -% \@@_draw_stroke: , -% \@@_draw_closestroke: , -% \@@_draw_fill: , -% \@@_draw_fillstroke: , -% \@@_draw_clip: , -% \@@_draw_discardpath: +% \driver_draw_closepath: , +% \driver_draw_stroke: , +% \driver_draw_closestroke: , +% \driver_draw_fill: , +% \driver_draw_fillstroke: , +% \driver_draw_clip: , +% \driver_draw_discardpath: % } % \begin{variable}{\g_@@_draw_clip_bool} % \begin{variable}{\g_@@_draw_path_int} @@ -2619,7 +2602,7 @@ % for path drawing: not essential but avoids constructing them twice. % Discarding a path needs a separate function as it's not quite the same. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_closepath: +\cs_new_protected:Npn \driver_draw_closepath: { \@@_draw_add_to_path:n { Z } } \cs_new_protected:Npn \@@_draw_path:n #1 { @@ -2652,21 +2635,21 @@ \bool_gset_false:N \g_@@_draw_clip_bool } \int_new:N \g_@@_path_int -\cs_new_protected:Npn \@@_draw_stroke: +\cs_new_protected:Npn \driver_draw_stroke: { \@@_draw_path:n { style="fill:none" } } -\cs_new_protected:Npn \@@_draw_closestroke: +\cs_new_protected:Npn \driver_draw_closestroke: { - \@@_draw_closepath: - \@@_draw_stroke: + \driver_draw_closepath: + \driver_draw_stroke: } -\cs_new_protected:Npn \@@_draw_fill: +\cs_new_protected:Npn \driver_draw_fill: { \@@_draw_path:n { style="stroke:none" } } -\cs_new_protected:Npn \@@_draw_fillstroke: +\cs_new_protected:Npn \driver_draw_fillstroke: { \@@_draw_path:n { } } -\cs_new_protected:Npn \@@_draw_clip: +\cs_new_protected:Npn \driver_draw_clip: { \bool_gset_true:N \g_@@_draw_clip_bool } \bool_new:N \g_@@_draw_clip_bool -\cs_new_protected:Npn \@@_draw_discardpath: +\cs_new_protected:Npn \driver_draw_discardpath: { \bool_if:NT \g_@@_draw_clip_bool { @@ -2693,21 +2676,21 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_dash:nn} +% \begin{macro}{\driver_draw_cap_dash:nn} % \begin{macro}{\@@_draw_dash:n} % \begin{macro}{\@@_draw_dash_aux:nn} -% \begin{macro}{\@@_draw_linewidth:n} -% \begin{macro}{\@@_draw_miterlimit:n} +% \begin{macro}{\driver_draw_linewidth:n} +% \begin{macro}{\driver_draw_miterlimit:n} % \begin{macro} % { -% \@@_draw_cap_butt:, \@@_draw_cap_round:, \@@_draw_cap_rectangle:, -% \@@_draw_join_miter:, \@@_draw_join_round:, \@@_draw_join_bevel: +% \driver_draw_cap_butt:, \driver_draw_cap_round:, \driver_draw_cap_rectangle:, +% \driver_draw_join_miter:, \driver_draw_join_round:, \driver_draw_join_bevel: % } % All of these ideas are properties of scopes in SVG. The only slight % complexity is converting the dash array properly (doing any required % maths). % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_dash:nn #1#2 +\cs_new_protected:Npn \driver_draw_cap_dash:nn #1#2 { \use:x { @@ -2731,21 +2714,21 @@ stroke-offset=" #2 " } } -\cs_new_protected:Npn \@@_draw_linewidth:n #1 +\cs_new_protected:Npn \driver_draw_linewidth:n #1 { \@@_draw_scope:x { stroke-width=" \dim_to_decimal:n {#1} " } } -\cs_new_protected:Npn \@@_draw_miterlimit:n #1 +\cs_new_protected:Npn \driver_draw_miterlimit:n #1 { \@@_draw_scope:x { stroke-miterlimit=" \fp_eval:n {#1} " } } -\cs_new_protected:Npn \@@_draw_cap_butt: +\cs_new_protected:Npn \driver_draw_cap_butt: { \@@_draw_scope:n { stroke-linecap="butt" } } -\cs_new_protected:Npn \@@_draw_cap_round: +\cs_new_protected:Npn \driver_draw_cap_round: { \@@_draw_scope:n { stroke-linecap="round" } } -\cs_new_protected:Npn \@@_draw_cap_rectangle: +\cs_new_protected:Npn \driver_draw_cap_rectangle: { \@@_draw_scope:n { stroke-linecap="square" } } -\cs_new_protected:Npn \@@_draw_join_miter: +\cs_new_protected:Npn \driver_draw_join_miter: { \@@_draw_scope:n { stroke-linejoin="miter" } } -\cs_new_protected:Npn \@@_draw_join_round: +\cs_new_protected:Npn \driver_draw_join_round: { \@@_draw_scope:n { stroke-linejoin="round" } } -\cs_new_protected:Npn \@@_draw_join_bevel: +\cs_new_protected:Npn \driver_draw_join_bevel: { \@@_draw_scope:n { stroke-linejoin="bevel" } } % \end{macrocode} % \end{macro} @@ -2757,21 +2740,21 @@ % % \begin{macro} % { -% \@@_draw_color_cmyk:nnnn , -% \@@_draw_color_cmyk_fill:nnnn , -% \@@_draw_color_cmyk_stroke:nnnn +% \driver_draw_color_cmyk:nnnn , +% \driver_draw_fill_cmyk:nnnn , +% \driver_draw_stroke_cmyk:nnnn % } % \begin{macro} % { -% \@@_draw_color_gray:n , -% \@@_draw_color_gray_fill:n , -% \@@_draw_color_gray_stroke:n +% \driver_draw_color_gray:n , +% \driver_draw_fill_gray:n , +% \driver_draw_stroke_gray:n % } % \begin{macro} % { -% \@@_draw_color_rgb:nnn , -% \@@_draw_color_rgb_fill:nnn , -% \@@_draw_color_rgb_stroke:nnn +% \driver_draw_color_rgb:nnn , +% \driver_draw_fill_rgb:nnn , +% \driver_draw_stroke_rgb:nnn % } % SVG only works with RGB colors, so there is some conversion to % do. The values also need to be given as percentages, which means a @@ -2788,11 +2771,11 @@ } #1 #2 } -\cs_new_protected:Npn \@@_draw_color_cmyk:nnnn +\cs_new_protected:Npn \driver_draw_color_cmyk:nnnn { \@@_draw_color_cmyk_aux:NNnnnnn \c_true_bool \c_true_bool } -\cs_new_protected:Npn \@@_draw_color_cmyk_fill:nnnn +\cs_new_protected:Npn \driver_draw_fill_cmyk:nnnn { \@@_draw_color_cmyk_aux:NNnnnnn \c_false_bool \c_true_bool } -\cs_new_protected:Npn \@@_draw_color_cmyk_stroke:nnnn +\cs_new_protected:Npn \driver_draw_stroke_cmyk:nnnn { \@@_draw_color_cmyk_aux:NNnnnnn \c_true_bool \c_false_bool } \cs_new_protected:Npn \@@_draw_color_gray_aux:NNn #1#2#3 { @@ -2806,11 +2789,11 @@ \cs_new_protected:Npn \@@_draw_color_gray_aux:nNN #1 { \@@_draw_color_rgb_auxii:nnnNN {#1} {#1} {#1} } \cs_generate_variant:Nn \@@_draw_color_gray_aux:nNN { x } -\cs_new_protected:Npn \@@_draw_color_gray:n +\cs_new_protected:Npn \driver_draw_color_gray:n { \@@_draw_color_gray_aux:NNn \c_true_bool \c_true_bool } -\cs_new_protected:Npn \@@_draw_color_gray_fill:n +\cs_new_protected:Npn \driver_draw_fill_gray:n { \@@_draw_color_gray_aux:NNn \c_false_bool \c_true_bool } -\cs_new_protected:Npn \@@_draw_color_gray_stroke:n +\cs_new_protected:Npn \driver_draw_stroke_gray:n { \@@_draw_color_gray_aux:NNn \c_true_bool \c_false_bool } \cs_new_protected:Npn \@@_draw_color_rgb_auxi:NNnnn #1#2#3#4#5 { @@ -2854,23 +2837,23 @@ } } } -\cs_new_protected:Npn \@@_draw_color_rgb:nnn +\cs_new_protected:Npn \driver_draw_color_rgb:nnn { \@@_draw_color_rgb_auxi:NNnnn \c_true_bool \c_true_bool } -\cs_new_protected:Npn \@@_draw_color_rgb_fill:nnn +\cs_new_protected:Npn \driver_draw_fill_rgb:nnn { \@@_draw_color_rgb_auxi:NNnnn \c_false_bool \c_true_bool } -\cs_new_protected:Npn \@@_draw_color_rgb_stroke:nnn +\cs_new_protected:Npn \driver_draw_stroke_rgb:nnn { \@@_draw_color_rgb_auxi:NNnnn \c_true_bool \c_false_bool } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\@@_draw_transformcm:nnnnnn} +% \begin{macro}{\driver_draw_transformcm:nnnnnn} % The first four arguments here are floats (the affine matrix), the last % two are a displacement vector. Once again, force evaluation to allow for % caching. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_transformcm:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \driver_draw_transformcm:nnnnnn #1#2#3#4#5#6 { \@@_draw_scope:x { @@ -2888,15 +2871,15 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_draw_hbox:Nnnnnnn} +% \begin{macro}{\driver_draw_hbox:Nnnnnnn} % No special savings can be made here: simply displace the box inside % a scope. As there is nothing to re-box, just make the box passed of % zero size. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \driver_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 { \@@_scope_begin: - \@@_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7} + \driver_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7} \@@_literal:n { < g~ |