8000 Add "set" into function names for adjusting drawing state by josephwright · Pull Request #1757 · latex3/latex3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add "set" into function names for adjusting drawing state #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions l3experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.

## [Unreleased]

### Changed
- Add `set` into function names for adjusting drawing state, e.g.
`\draw_set_linewidth:n` replacing `\draw_linewidth:n`

### Removed
- `l3str-format` package: integrated into `l3kernel`

Expand Down
2 changes: 1 addition & 1 deletion l3experimental/l3draw/l3draw-layers.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
\box_use_drop:c { g_@@_layer_ #1 _box }
\group_begin:
}
\draw_linewidth:n { \l_draw_default_linewidth_dim }
\draw_set_linewidth:n { \l_draw_default_linewidth_dim }
}
{
\str_if_eq:nnTF {#1} { main }
Expand Down
16 changes: 8 additions & 8 deletions l3experimental/l3draw/l3draw-scopes.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@
\draw_transform_matrix_reset:
\draw_transform_shift_reset:
\@@_softpath_clear:
\draw_linewidth:n { \l_draw_default_linewidth_dim }
\draw_set_linewidth:n { \l_draw_default_linewidth_dim }
\color_select:n { . }
\draw_nonzero_rule:
\draw_cap_butt:
\draw_join_miter:
\draw_miterlimit:n { 10 }
\draw_dash_pattern:nn { } { 0cm }
\draw_set_nonzero_rule:
\draw_set_cap_butt:
\draw_set_join_miter:
\draw_set_miterlimit:n { 10 }
\draw_set_dash_pattern:nn { } { 0cm }
\hbox_set:Nw \l_@@_layer_main_box
\@@_record_origin:
}
Expand Down Expand Up @@ -250,11 +250,11 @@
% \end{macrocode}
% \end{variable}
%
% \begin{macro}{\draw_baseline:n}
% \begin{macro}{\draw_set_baseline:n}
% A simple setting of the baseline along with the flag we need to know that
% it is active.
% \begin{macrocode}
\cs_new_protected:Npn \draw_baseline:n #1
\cs_new_protected:Npn \draw_set_baseline:n #1
{
\bool_set_true:N \l_@@_baseline_bool
\dim_set:Nn \l_@@_baseline_dim { \fp_to_dim:n {#1} }
Expand Down
34 changes: 17 additions & 17 deletions l3experimental/l3draw/l3draw-state.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,23 @@
% \end{macrocode}
% \end{variable}
%
% \begin{macro}{\draw_linewidth:n}
% \begin{macro}{\draw_set_linewidth:n}
% Set the linewidth: we need a wrapper as this has to pass to the driver
% layer.
% \begin{macrocode}
\cs_new_protected:Npn \draw_linewidth:n #1
\cs_new_protected:Npn \draw_set_linewidth:n #1
{
\dim_gset:Nn \g_@@_linewidth_dim { \fp_to_dim:n {#1} }
\@@_backend_linewidth:n \g_@@_linewidth_dim
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\draw_dash_pattern:nn}
% \begin{macro}{\draw_set_dash_pattern:nn}
% \begin{variable}{\l_@@_tmp_seq}
% Evaluated all of the list and pass it to the driver layer.
% \begin{macrocode}
\cs_new_protected:Npn \draw_dash_pattern:nn #1#2
\cs_new_protected:Npn \draw_set_dash_pattern:nn #1#2
{
\group_begin:
\seq_set_from_clist:Nn \l_@@_tmp_seq {#1}
Expand All @@ -120,30 +120,30 @@
% \end{variable}
% \end{macro}
%
% \begin{macro}{\draw_miterlimit:n}
% \begin{macro}{\draw_set_miterlimit:n}
% Pass through to the driver layer.
% \begin{macrocode}
\cs_new_protected:Npn \draw_miterlimit:n #1
\cs_new_protected:Npn \draw_set_miterlimit:n #1
{ \exp_args:Ne \@@_backend_miterlimit:n { \fp_eval:n {#1} } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}
% {
% \draw_cap_butt:, \draw_cap_rectangle:, \draw_cap_round:,
% \draw_evenodd_rule:, \draw_nonzero_rule:,
% \draw_join_bevel:, \draw_join_miter:, \draw_join_round:
% \draw_set_cap_butt:, \draw_set_cap_rectangle:, \draw_set_cap_round:,
% \draw_set_evenodd_rule:, \draw_set_nonzero_rule:,
% \draw_set_join_bevel:, \draw_set_join_miter:, \draw_set_join_round:
% }
% All straight wrappers.
% \begin{macrocode}
\cs_new_protected:Npn \draw_cap_butt: { \@@_backend_cap_butt: }
\cs_new_protected:Npn \draw_cap_rectangle: { \@@_backend_cap_rectangle: }
\cs_new_protected:Npn \draw_cap_round: { \@@_backend_cap_round: }
\cs_new_protected:Npn \draw_evenodd_rule: { \@@_backend_evenodd_rule: }
\cs_new_protected:Npn \draw_nonzero_rule: { \@@_backend_nonzero_rule: }
\cs_new_protected:Npn \draw_join_bevel: { \@@_backend_join_bevel: }
\cs_new_protected:Npn \draw_join_miter: { \@@_backend_join_miter: }
\cs_new_protected:Npn \draw_join_round: { \@@_backend_join_round: }
\cs_new_protected:Npn \draw_set_cap_butt: { \@@_backend_cap_butt: }
\cs_new_protected:Npn \draw_set_cap_rectangle: { \@@_backend_cap_rectangle: }
\cs_new_protected:Npn \draw_set_cap_round: { \@@_backend_cap_round: }
\cs_new_protected:Npn \draw_set_evenodd_rule: { \@@_backend_evenodd_rule: }
\cs_new_protected:Npn \draw_set_nonzero_rule: { \@@_backend_nonzero_rule: }
\cs_new_protected:Npn \draw_set_join_bevel: { \@@_backend_join_bevel: }
\cs_new_protected:Npn \draw_set_join_miter: { \@@_backend_join_miter: }
\cs_new_protected:Npn \draw_set_join_round: { \@@_backend_join_round: }
% \end{macrocode}
% \end{macro}
%
Expand Down
58 changes: 29 additions & 29 deletions l3experimental/l3draw/l3draw.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@
% drawing. This can include those automatically generated, for example the
% supporting points needed to construct an arc.
%
% \begin{function}{\draw_baseline:n}
% \begin{function}{\draw_set_baseline:n}
% \begin{syntax}
% \cs{draw_baseline:n} \Arg{length}
% \cs{draw_set_baseline:n} \Arg{length}
% \end{syntax}
% As standard, the baseline of the bounding box of a drawing is calculated
% automatically at the bottom of the drawing. It is possible to adjust this
% using the \cs{draw_baseline:n} function. If the drawing coordinates lead
% using the \cs{draw_set_baseline:n} function. If the drawing coordinates lead
% to lower $y$-axis values than the \meta{length}, then the drawing will have
% a depth as well as a height.
% \begin{demo}
Expand All @@ -209,13 +209,13 @@
% text
% \draw_begin:
% \draw_path_rectangle:nn { 0 , 1ex } { 2ex , 1ex }
% \draw_baseline:n { 0pt }
% \draw_set_baseline:n { 0pt }
% \draw_path_use:n { stroke }
% \draw_end:
% text
% \draw_begin:
% \draw_path_rectangle:nn { 0 , -1ex } { 2ex , 1ex }
% \draw_baseline:n { -0.5ex }
% \draw_set_baseline:n { -0.5ex }
% \draw_path_use:n { stroke }
% \draw_end:
% text
Expand Down Expand Up @@ -258,28 +258,28 @@
% \cs{draw_begin:} is used.
% \end{variable}
%
% \subsection{Graphics state}
% \subsection{Setting the graphics state}
%
% Within the drawing environment, a number of functions control how drawings
% will appear. Note that these all apply \emph{globally}, though some are
% rest at the start of each drawing (\cs{draw_begin:}).
% reset at the start of each drawing (\cs{draw_begin:}).
%
% \begin{variable}{\l_draw_default_linewidth_dim}
% The default value of the linewidth for stokes, set at the start
% of every drawing (\cs{draw_begin:}).
% \end{variable}
%
% \begin{function}{\draw_linewidth:n}
% \begin{function}{\draw_set_linewidth:n}
% \begin{syntax}
% \cs{draw_linewidth:n} \Arg{width}
% \cs{draw_set_linewidth:n} \Arg{width}
% \end{syntax}
% Sets the width to be used for stroking to the \meta{width} (an
% \meta{fp expr}).
% \end{function}
%
% \begin{function}{\draw_dash_pattern:nn}
% \begin{function}{\draw_set_dash_pattern:nn}
% \begin{syntax}
% \cs{draw_dash_pattern:nn} \Arg{pattern} \Arg{phase}
% \cs{draw_set_dash_pattern:nn} \Arg{pattern} \Arg{phase}
% \end{syntax}
% Specifies a dash pattern. The \meta{pattern} itself is a comma-separated
% list of entries which represent the \enquote{on} and \enquote{off}
Expand All @@ -289,19 +289,19 @@
% start.
% \begin{demo}
% \draw_begin:
% \draw_dash_pattern:nn
% \draw_set_dash_pattern:nn
% { 0.5cm , 0.5cm , 0.1cm , 0.2cm }
% { 0cm }
% \draw_path_moveto:n { 0cm , 0cm }
% \draw_path_lineto:n { 2cm , 0cm }
% \draw_path_use_clear:n { stroke }
% \draw_dash_pattern:nn
% \draw_set_dash_pattern:nn
% { 0.5cm , 0.5cm , 0.1cm , 0.2cm }
% { 0.1cm }
% \draw_path_moveto:n { 0cm , 1mm }
% \draw_path_lineto:n { 2cm , 1mm }
% \draw_path_use_clear:n { stroke }
% \draw_dash_pattern:nn
% \draw_set_dash_pattern:nn
% { 0.5cm , 0.5cm , 0.1cm , 0.2cm }
% { 0.2cm }
% \draw_path_moveto:n { 0cm , 2mm }
Expand All @@ -315,9 +315,9 @@
% the list is comma-separated not given in brace groups.
% \end{function}
%
% \begin{function}{\draw_nonzero_rule:, \draw_evenodd_rule:}
% \begin{function}{\draw_set_nonzero_rule:, \draw_set_evenodd_rule:}
% \begin{syntax}
% \cs{draw_nonzero_rule:}
% \cs{draw_set_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.
Expand All @@ -327,32 +327,32 @@
%
% \begin{function}
% {
% \draw_cap_butt: ,
% \draw_cap_rectangle: ,
% \draw_cap_round:
% \draw_set_cap_butt: ,
% \draw_set_cap_rectangle: ,
% \draw_set_cap_round:
% }
% \begin{syntax}
% \cs{draw_cap_butt:}
% \cs{draw_set_cap_butt:}
% \end{syntax}
% Sets the style of terminal stroke position to one of butt, rectangle or
% round.
% \end{function}
%
% \begin{function}
% {
% \draw_join_bevel: ,
% \draw_join_miter: ,
% \draw_join_round:
% \draw_set_join_bevel: ,
% \draw_set_join_miter: ,
% \draw_set_join_round:
% }
% \begin{syntax}
% \cs{draw_join_miter:}
% \cs{draw_set_join_miter:}
% \end{syntax}
% Sets the style of stroke joins to one of bevel, miter or round.
% \end{function}
%
% \begin{function}{\draw_miterlimit:n}
% \begin{function}{\draw_set_miterlimit:n}
% \begin{syntax}
% \cs{draw_miterlimit:n} \Arg{factor}
% \cs{draw_set_miterlimit:n} \Arg{factor}
% \end{syntax}
% Sets the miter \meta{factor} of lines joined as a miter, as described in the
% PDF and PostScript manuals. The \meta{factor} is an \meta{fp expr}.
Expand Down Expand Up @@ -380,7 +380,7 @@
% \draw_begin:
% \draw_scope_begin:
% \group_begin:
% \draw_linewidth:n { 2pt }
% \draw_set_linewidth:n { 2pt }
% \draw_path_rectangle:nn { 0 , 0 } { 2ex , 2ex }
% \draw_path_use:n { stroke }
% \group_end:
Expand Down Expand Up @@ -896,13 +896,13 @@
% if the start/end positions do not fully align.
% \begin{demo}
% \draw_begin:
% \draw_linewidth:n { 0.8pt }
% \draw_set_linewidth:n { 0.8pt }
% \draw_path_grid:nnnn
% { 1cm } { 1cm }
% { -3mm , -3mm }
% { 33mm , 23mm }
% \draw_path_use_clear:n { stroke }
% \draw_linewidth:n { 0.4pt }
% \draw_set_linewidth:n { 0.4pt }
% \draw_path_grid:nnnn
% { 1mm } { 1mm }
% { -1.5mm , -1.5mm }
Expand Down
12 changes: 6 additions & 6 deletions l3experimental/l3draw/testfiles/m3draw004.etex-dvips.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ l. ... }
l. ... }
============================================================
============================================================
TEST 2: \draw_linewidth:n
TEST 2: \draw_set_linewidth:n
============================================================
> \box...=
\hbox(285.52756+0.0)x57.90552
Expand Down Expand Up @@ -112,7 +112,7 @@ TEST 2: \draw_linewidth:n
l. ... }
============================================================
============================================================
TEST 3: \draw_dash_pattern:nn
TEST 3: \draw_set_dash_pattern:nn
============================================================
> \box...=
\hbox(284.92755+0.0)x57.30551
Expand Down Expand Up @@ -221,7 +221,7 @@ l. ... }
l. ... }
============================================================
============================================================
TEST 4: \draw_cap_ ...
TEST 4: \draw_set_cap_ ...
============================================================
> \box...=
\hbox(284.92755+0.0)x57.30551
Expand Down Expand Up @@ -330,7 +330,7 @@ l. ... }
l. ... }
============================================================
============================================================
TEST 5: \draw_join_ ...
TEST 5: \draw_set_join_ ...
============================================================
> \box...=
\hbox(284.92755+0.0)x57.30551
Expand Down Expand Up @@ -439,7 +439,7 @@ l. ... }
l. ... }
============================================================
============================================================
TEST 6: \draw_miterlimit:n
TEST 6: \draw_set_miterlimit:n
============================================================
> \box...=
\hbox(284.92755+0.0)x57.30551
Expand Down Expand Up @@ -747,7 +747,7 @@ TEST 9: \color_stroke:n
l. ... }
============================================================
============================================================
TEST 10: \draw_baseline:n
TEST 10: \draw_set_baseline:n
============================================================
> \box...=
\hbox(284.92755+0.0)x57.30551
Expand Down
Loading
0