[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3draw: Basic path support (18be6e3)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Feb 11 12:47:28 CET 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/18be6e3a6c4b7d5e3d644d0b766b12bea66b8b6f

>---------------------------------------------------------------

commit 18be6e3a6c4b7d5e3d644d0b766b12bea66b8b6f
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Feb 11 11:47:28 2018 +0000

    l3draw: Basic path support
    
    At present, there is no soft path code, so this is direct writing.
    
    Tests are engine-dependent: perhaps later an approach at a soft-path level may be possible.


>---------------------------------------------------------------

18be6e3a6c4b7d5e3d644d0b766b12bea66b8b6f
 l3trial/l3draw/l3draw-paths.dtx                    |   46 ++++++++++++++++++++
 l3trial/l3draw/testfiles/m3draw003.lvt             |   43 ++++++++++++++++++
 .../l3draw/testfiles/m3draw003.ptex.tlg            |   37 ++++++++--------
 .../l3draw/testfiles/m3draw003.tlg                 |   37 ++++++++--------
 .../l3draw/testfiles/m3draw003.uptex.tlg           |   37 ++++++++--------
 .../l3draw/testfiles/m3draw003.xetex.tlg           |   37 ++++++++--------
 6 files changed, 169 insertions(+), 68 deletions(-)

diff --git a/l3trial/l3draw/l3draw-paths.dtx b/l3trial/l3draw/l3draw-paths.dtx
index a4b955e..db9a924 100644
--- a/l3trial/l3draw/l3draw-paths.dtx
+++ b/l3trial/l3draw/l3draw-paths.dtx
@@ -123,6 +123,52 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\@@_path_update_last:nn}
+%   A simple auxiliary to avoid repetition.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_path_update_last:nn #1#2
+  {
+    \dim_gset:Nn \g_@@_path_lastx_dim {#1}
+    \dim_gset:Nn \g_@@_path_lasty_dim {#2}
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{Basic path constructions}
+%
+% \begin{macro}{\draw_path_moveto:n, \draw_path_lineto:n}
+% \begin{macro}{\@@_path_moveto:nn, \@@_path_lineto:nn}
+%   At present, stick to purely linear transformation support and skip the
+%   soft path business: that will likely need to be revisited later.
+%    \begin{macrocode}
+\cs_new_protected:Npn \draw_path_moveto:n #1
+  {
+    \@@_point_process:nn
+      { \@@_path_moveto:nn }
+      { \draw_point_transform:n {#1} }
+  }
+\cs_new_protected:Npn \@@_path_moveto:nn #1#2
+  {
+     \@@_path_update_limits:nn {#1} {#2}
+     \driver_draw_moveto:nn {#1} {#2}
+     \@@_path_update_last:nn {#1} {#2}
+  }
+\cs_new_protected:Npn \draw_path_lineto:n #1
+  {
+    \@@_point_process:nn
+      { \@@_path_lineto:nn }
+      { \draw_point_transform:n {#1} }
+  }
+\cs_new_protected:Npn \@@_path_lineto:nn #1#2
+  {
+     \@@_path_update_limits:nn {#1} {#2}
+     \driver_draw_lineto:nn {#1} {#2}
+     \@@_path_update_last:nn {#1} {#2}
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 %    \begin{macrocode}
 %</initex|package>
 %    \end{macrocode}
diff --git a/l3trial/l3draw/testfiles/m3draw003.lvt b/l3trial/l3draw/testfiles/m3draw003.lvt
new file mode 100644
index 0000000..5701089
--- /dev/null
+++ b/l3trial/l3draw/testfiles/m3draw003.lvt
@@ -0,0 +1,43 @@
+%
+% Copyright (C) 2018 The LaTeX3 Project
+%
+
+\documentclass{minimal}
+\input{regression-test}
+
+\RequirePackage[check-declarations]{expl3}
+\ExplSyntaxOn
+\debug_on:n { deprecation }
+\ExplSyntaxOff
+
+\AUTHOR{Joseph Wright}
+\RequirePackage{l3draw}
+
+\ExplSyntaxOn
+
+\cs_set_protected:Npn \test:n #1
+  {
+    \hbox_set:Nn \l_tmpa_box
+      {
+        \draw_begin:
+        #1
+        \draw_end:
+      }
+    \box_show:N \l_tmpa_box
+  }
+
+\START
+
+\TEST { \draw_path_moveto:n }
+  {
+    \test:n
+      { \draw_path_moveto:n { { 10pt } { 10pt } } }
+  }
+
+\TEST { \draw_path_lineto:n }
+  {
+    \test:n
+      { \draw_path_lineto:n { { 10pt } { 10pt } } }
+  }
+
+\END
diff --git a/l3kernel/testfiles/m3seq005.tlg b/l3trial/l3draw/testfiles/m3draw003.ptex.tlg
similarity index 52%
copy from l3kernel/testfiles/m3seq005.tlg
copy to l3trial/l3draw/testfiles/m3draw003.ptex.tlg
index 04414d7..cfcd369 100644
--- a/l3kernel/testfiles/m3seq005.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.ptex.tlg
@@ -1,25 +1,28 @@
 This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
-Author: Bruno Le Floch
 ============================================================
-TEST 1: seq_count
+TEST 1: \draw_path_moveto:n 
 ============================================================
-Defining \l_foo_seq on line ...
-|0|
-|4|
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf:literal q}
+..\special{pdf:literal 9.96265 9.96265 m}
+..\special{pdf:literal Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
 ============================================================
-TEST 2: seq_item:Nn
+TEST 2: \draw_path_lineto:n 
 ============================================================
-||
-||
-||
-||
-|\scan_stop: |
-|b{cd} |
-|a|
-|a|
-|b{cd} |
-|\scan_stop: |
-||
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf:literal q}
+..\special{pdf:literal 9.96265 9.96265 l}
+..\special{pdf:literal Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
diff --git a/l3kernel/testfiles/m3clist005.tlg b/l3trial/l3draw/testfiles/m3draw003.tlg
similarity index 56%
copy from l3kernel/testfiles/m3clist005.tlg
copy to l3trial/l3draw/testfiles/m3draw003.tlg
index 01f1b33..3943e7d 100644
--- a/l3kernel/testfiles/m3clist005.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.tlg
@@ -1,25 +1,28 @@
 This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
-Author: Bruno Le Floch
 ============================================================
-TEST 1: clist_use:Nnnn
+TEST 1: \draw_path_moveto:n 
 ============================================================
-> .
-> \AA .
-> \AA  and .
-> \AA  and .
-> \AA , , and ##\par .
-> a, b, c, d, e, f, \g , h, and i.
-> AAA, \g , and (x,y).
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\pdfliteral{q}
+..\pdfliteral{9.96265 9.96265 m}
+..\pdfliteral{Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
 ============================================================
-TEST 2: clist_use:Nn
+TEST 2: \draw_path_lineto:n 
 ============================================================
-> .
-> \AA .
-> \AA  and .
-> \AA  and .
-> \AA  and  and ##\par .
-> a and b and c and d and e and f and \g  and h and i.
-> AAA and \g  and (x,y).
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\pdfliteral{q}
+..\pdfliteral{9.96265 9.96265 l}
+..\pdfliteral{Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
diff --git a/l3kernel/testfiles/m3seq005.tlg b/l3trial/l3draw/testfiles/m3draw003.uptex.tlg
similarity index 52%
copy from l3kernel/testfiles/m3seq005.tlg
copy to l3trial/l3draw/testfiles/m3draw003.uptex.tlg
index 04414d7..cfcd369 100644
--- a/l3kernel/testfiles/m3seq005.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.uptex.tlg
@@ -1,25 +1,28 @@
 This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
-Author: Bruno Le Floch
 ============================================================
-TEST 1: seq_count
+TEST 1: \draw_path_moveto:n 
 ============================================================
-Defining \l_foo_seq on line ...
-|0|
-|4|
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf:literal q}
+..\special{pdf:literal 9.96265 9.96265 m}
+..\special{pdf:literal Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
 ============================================================
-TEST 2: seq_item:Nn
+TEST 2: \draw_path_lineto:n 
 ============================================================
-||
-||
-||
-||
-|\scan_stop: |
-|b{cd} |
-|a|
-|a|
-|b{cd} |
-|\scan_stop: |
-||
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf:literal q}
+..\special{pdf:literal 9.96265 9.96265 l}
+..\special{pdf:literal Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
diff --git a/l3kernel/testfiles/m3seq005.tlg b/l3trial/l3draw/testfiles/m3draw003.xetex.tlg
similarity index 52%
copy from l3kernel/testfiles/m3seq005.tlg
copy to l3trial/l3draw/testfiles/m3draw003.xetex.tlg
index 04414d7..cfcd369 100644
--- a/l3kernel/testfiles/m3seq005.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.xetex.tlg
@@ -1,25 +1,28 @@
 This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
-Author: Bruno Le Floch
 ============================================================
-TEST 1: seq_count
+TEST 1: \draw_path_moveto:n 
 ============================================================
-Defining \l_foo_seq on line ...
-|0|
-|4|
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf:literal q}
+..\special{pdf:literal 9.96265 9.96265 m}
+..\special{pdf:literal Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================
 ============================================================
-TEST 2: seq_item:Nn
+TEST 2: \draw_path_lineto:n 
 ============================================================
-||
-||
-||
-||
-|\scan_stop: |
-|b{cd} |
-|a|
-|a|
-|b{cd} |
-|\scan_stop: |
-||
+> \box...=
+\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf:literal q}
+..\special{pdf:literal 9.96265 9.96265 l}
+..\special{pdf:literal Q}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
 ============================================================





More information about the latex3-commits mailing list