[latex3-commits] [latex3/latex3] main: Fix shifts not applied to rectangle in l3draw (fixes #1486) (091428b34)

github at latex-project.org github at latex-project.org
Sat Mar 2 07:49:00 CET 2024


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/091428b343794b60e9ec03f9a6c3b0cdc132a690

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

commit 091428b343794b60e9ec03f9a6c3b0cdc132a690
Author: Yukai Chou <muzimuzhi at gmail.com>
Date:   Sat Mar 2 14:41:15 2024 +0800

    Fix shifts not applied to rectangle in l3draw (fixes #1486)


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

091428b343794b60e9ec03f9a6c3b0cdc132a690
 l3experimental/CHANGELOG.md                   |  1 +
 l3experimental/l3draw/l3draw-paths.dtx        | 18 ++++++++++--------
 l3experimental/l3draw/testfiles/m3draw003.lvt |  7 +++++++
 l3experimental/l3draw/testfiles/m3draw003.tlg | 20 ++++++++++++++++++++
 4 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/l3experimental/CHANGELOG.md b/l3experimental/CHANGELOG.md
index 15a3b2845..cd7e71778 100644
--- a/l3experimental/CHANGELOG.md
+++ b/l3experimental/CHANGELOG.md
@@ -12,6 +12,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Fixed
 - Interaction between drawing rotation and shift (issue \#1483)
+- Shifting not applied to `\draw_path_rectangle:n` (issue \#1486)
 
 ## [2024-02-20]
 
diff --git a/l3experimental/l3draw/l3draw-paths.dtx b/l3experimental/l3draw/l3draw-paths.dtx
index cd00e4a86..53e6a382d 100644
--- a/l3experimental/l3draw/l3draw-paths.dtx
+++ b/l3experimental/l3draw/l3draw-paths.dtx
@@ -700,16 +700,18 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \draw_path_rectangle:nn #1#2
   {
-    \@@_point_process:nnn
+    \bool_lazy_or:nnTF
+      { \l_@@_corner_arc_bool }
+      { \l_@@_matrix_active_bool }
       {
-        \bool_lazy_or:nnTF
-          { \l_@@_corner_arc_bool }
-          { \l_@@_matrix_active_bool }
-          { \@@_path_rectangle_rounded:nnnn }
-          { \@@_path_rectangle:nnnn }
+        \@@_point_process:nnn \@@_path_rectangle_rounded:nnnn
+          {#1} {#2}
+      }
+      {
+        \@@_point_process:nnn \@@_path_rectangle:nnnn
+          { (#1) + ( \l_@@_xshift_dim , \l_@@_yshift_dim ) }
+          { #2 }
       }
-      {#1}
-      {#2}
   }
 \cs_new_protected:Npn \@@_path_rectangle:nnnn #1#2#3#4
   {
diff --git a/l3experimental/l3draw/testfiles/m3draw003.lvt b/l3experimental/l3draw/testfiles/m3draw003.lvt
index 47be6e520..6094c5edd 100644
--- a/l3experimental/l3draw/testfiles/m3draw003.lvt
+++ b/l3experimental/l3draw/testfiles/m3draw003.lvt
@@ -175,6 +175,13 @@
           { \draw_point_vec:nn { 2 } { 2 } }
           { \draw_point_vec:nn { 1 } { 1 } }
       }
+    \test:n
+      {
+        \draw_transform_shift:n { 10pt , 15pt }
+        \draw_path_rectangle:nn
+          { \draw_point_vec:nn { 2 } { 2 } }
+          { \draw_point_vec:nn { 1 } { 1 } }
+      }
     \test:n
       {
         \draw_path_corner_arc:nn { 2pt } { 2pt }
diff --git a/l3experimental/l3draw/testfiles/m3draw003.tlg b/l3experimental/l3draw/testfiles/m3draw003.tlg
index 847544616..040ad89f1 100644
--- a/l3experimental/l3draw/testfiles/m3draw003.tlg
+++ b/l3experimental/l3draw/testfiles/m3draw003.tlg
@@ -512,6 +512,26 @@ l. ...  }
 > \box...=
 \hbox(28.85275+0.0)x28.85275
 .\hbox(28.85275+0.0)x28.85275
+..\glue -66.70552
+..\hbox(0.0+0.0)x0.0, shifted 71.70552
+...\pdfsave
+...\pdfliteral{0.39851 w}
+...\pdfcolorstack 0 push {0 g 0 G}
+...\pdfliteral{0 J}
+...\pdfliteral{0 j}
+...\pdfliteral{10 M}
+...\pdfliteral{[] 0 d}
+...\hbox(0.0+0.0)x0.0
+....\pdfliteral{66.65556 71.63689 28.34647 28.34647 re}
+....\pdfliteral{S}
+...\pdfrestore
+...\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(28.85275+0.0)x28.85275
+.\hbox(28.85275+0.0)x28.85275
 ..\glue -56.70552
 ..\hbox(0.0+0.0)x0.0, shifted 56.70552
 ...\pdfsave





More information about the latex3-commits mailing list.