[latex3-commits] [git/LaTeX3-latex3-latex3] master: Moving drawing box support to a separate file (107d9a0)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Mar 4 11:53:06 CET 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/107d9a013ae90c37f34b29b3528f811045122493

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

commit 107d9a013ae90c37f34b29b3528f811045122493
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Mar 4 09:14:01 2018 +0000

    Moving drawing box support to a separate file


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

107d9a013ae90c37f34b29b3528f811045122493
 l3experimental/l3draw/l3draw-boxes.dtx        |  146 +++++++++++++++++++++++++
 l3experimental/l3draw/l3draw-scopes.dtx       |   81 --------------
 l3experimental/l3draw/l3draw.ins              |    1 +
 l3experimental/l3draw/testfiles/m3draw000.tlg |    2 +-
 4 files changed, 148 insertions(+), 82 deletions(-)

diff --git a/l3experimental/l3draw/l3draw-boxes.dtx b/l3experimental/l3draw/l3draw-boxes.dtx
new file mode 100644
index 0000000..c037ffe
--- /dev/null
+++ b/l3experimental/l3draw/l3draw-boxes.dtx
@@ -0,0 +1,146 @@
+% \iffalse meta-comment
+%
+%% File: l3draw-boxes.dtx Copyright(C) 2018 The LaTeX3 Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.  The latest version
+% of this license is in the file
+%
+%    http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3experimental bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+%    https://github.com/latex3/latex3
+%
+% for those people who are interested.
+%
+%<*driver>
+\RequirePackage{expl3}
+\documentclass[full]{l3doc}
+\begin{document}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{^^A
+%   The \pkg{l3draw} package\\ Boxes in drawings^^A
+% }
+%
+% \author{^^A
+%  The \LaTeX3 Project\thanks
+%    {^^A
+%      E-mail:
+%        \href{mailto:latex-team at latex-project.org}
+%          {latex-team at latex-project.org}^^A
+%    }^^A
+% }
+%
+% \date{Released 2018/02/21}
+%
+% \maketitle
+%
+% \begin{implementation}
+%
+% \section{\pkg{l3draw-boxes} implementation}
+%
+%    \begin{macrocode}
+%<*initex|package>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<@@=draw>
+%    \end{macrocode}
+%
+% Inserting boxes requires us to \enquote{interrupt} the drawing state,
+% so is closely linked to scoping. At the same time, there are a few
+% additional features required to make text work in a flexible way.
+%
+% \begin{variable}{\l_@@_tmp_box}
+%    \begin{macrocode}
+\box_new:N \l_@@_tmp_box
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\draw_hbox_set:Nn}
+%   Collect up the input and box, reset all of the structures and typeset.
+%   Note that in \pkg{pgf} the various reset parts are set up in an auxiliary,
+%   but this is not done here at present as it is all done only once.
+%    \begin{macrocode}
+\cs_new_protected:Npn \draw_hbox_set:Nn #1#2
+  {
+    \hbox_set:Nn #1
+      {
+        \color_ensure_current:
+        \@@_scope_bb_begin:
+        \draw_path_scope_begin:
+        \draw_transform_matrix_reset:
+        \draw_transform_shift_reset:
+          #2
+        \draw_path_scope_end:
+        \@@_scope_bb_end:
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\draw_hbox_use:N}
+%   Before inserting a box, we need to make sure that the bounding box is being
+%   updated correctly. As drawings track transformations as a whole, rather
+%   than as separate operations, we do the insertion using an almost-raw
+%   matrix.
+%    \begin{macrocode}
+\cs_new_protected:Npn \draw_hbox_use:N #1
+  {
+    \@@_point_process:nn
+      { \@@_path_update_limits:nn }
+      { \draw_point_transform:n { 0pt , \box_dp:N #1 } }
+    \@@_point_process:nn
+      { \@@_path_update_limits:nn }
+      { \draw_point_transform:n { \box_wd:N #1 , \box_dp:N #1 } }
+    \@@_point_process:nn
+      { \@@_path_update_limits:nn }
+      { \draw_point_transform:n { 0pt , \box_ht:N #1 } }
+    \@@_point_process:nn
+      { \@@_path_update_limits:nn }
+      { \draw_point_transform:n { \box_wd:N #1 , \box_ht:N #1 } }
+    \group_begin:
+      \hbox_set:Nn \l_@@_tmp_box
+        {
+          \use:x
+            {
+              \driver_draw_box_use:Nnnnn #1
+                { \fp_use:N \l_@@_matrix_a_fp }
+                { \fp_use:N \l_@@_matrix_b_fp }
+                { \fp_use:N \l_@@_matrix_c_fp }
+                { \fp_use:N \l_@@_matrix_d_fp }
+            }
+        }
+      \hbox_set:Nn \l_@@_tmp_box
+        {
+          \tex_kern:D \l_@@_xshift_dim
+          \box_move_up:nn { \l_@@_yshift_dim }
+            { \box_use_drop:N \l_@@_tmp_box }
+        }
+      \box_set_ht:Nn \l_@@_tmp_box { 0pt }
+      \box_set_dp:Nn \l_@@_tmp_box { 0pt }
+      \box_set_wd:Nn \l_@@_tmp_box { 0pt }
+      \box_use_drop:N \l_@@_tmp_box
+    \group_end:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</initex|package>
+%    \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
diff --git a/l3experimental/l3draw/l3draw-scopes.dtx b/l3experimental/l3draw/l3draw-scopes.dtx
index 9a450c6..374ed8c 100644
--- a/l3experimental/l3draw/l3draw-scopes.dtx
+++ b/l3experimental/l3draw/l3draw-scopes.dtx
@@ -228,87 +228,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \subsection{Inserting boxes}
-%
-% Inserting boxes requires us to \enquote{interrupt} the drawing state,
-% so is closely linked to scoping. At the same time, there are a few
-% additional features required to make text work in a flexible way.
-%
-% \begin{variable}{\l_@@_tmp_box}
-%    \begin{macrocode}
-\box_new:N \l_@@_tmp_box
-%    \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}{\draw_hbox_set:Nn}
-%   Collect up the input and box, reset all of the structures and typeset.
-%   Note that in \pkg{pgf} the various reset parts are set up in an auxiliary,
-%   but this is not done here at present as it is all done only once.
-%    \begin{macrocode}
-\cs_new_protected:Npn \draw_hbox_set:Nn #1#2
-  {
-    \hbox_set:Nn #1
-      {
-        \color_ensure_current:
-        \@@_scope_bb_begin:
-        \draw_path_scope_begin:
-        \draw_transform_matrix_reset:
-        \draw_transform_shift_reset:
-          #2
-        \draw_path_scope_end:
-        \@@_scope_bb_end:
-      }
-  }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\draw_hbox_use:N}
-%   Before inserting a box, we need to make sure that the bounding box is being
-%   updated correctly. As drawings track transformations as a whole, rather
-%   than as separate operations, we do the insertion using an almost-raw
-%   matrix.
-%    \begin{macrocode}
-\cs_new_protected:Npn \draw_hbox_use:N #1
-  {
-    \@@_point_process:nn
-      { \@@_path_update_limits:nn }
-      { \draw_point_transform:n { 0pt , \box_dp:N #1 } }
-    \@@_point_process:nn
-      { \@@_path_update_limits:nn }
-      { \draw_point_transform:n { \box_wd:N #1 , \box_dp:N #1 } }
-    \@@_point_process:nn
-      { \@@_path_update_limits:nn }
-      { \draw_point_transform:n { 0pt , \box_ht:N #1 } }
-    \@@_point_process:nn
-      { \@@_path_update_limits:nn }
-      { \draw_point_transform:n { \box_wd:N #1 , \box_ht:N #1 } }
-    \group_begin:
-      \hbox_set:Nn \l_@@_tmp_box
-        {
-          \use:x
-            {
-              \driver_draw_box_use:Nnnnn #1
-                { \fp_use:N \l_@@_matrix_a_fp }
-                { \fp_use:N \l_@@_matrix_b_fp }
-                { \fp_use:N \l_@@_matrix_c_fp }
-                { \fp_use:N \l_@@_matrix_d_fp }
-            }
-        }
-      \hbox_set:Nn \l_@@_tmp_box
-        {
-          \tex_kern:D \l_@@_xshift_dim
-          \box_move_up:nn { \l_@@_yshift_dim }
-            { \box_use_drop:N \l_@@_tmp_box }
-        }
-      \box_set_ht:Nn \l_@@_tmp_box { 0pt }
-      \box_set_dp:Nn \l_@@_tmp_box { 0pt }
-      \box_set_wd:Nn \l_@@_tmp_box { 0pt }
-      \box_use_drop:N \l_@@_tmp_box
-    \group_end:
-  }
-%    \end{macrocode}
-% \end{macro}
-%
 %    \begin{macrocode}
 %</initex|package>
 %    \end{macrocode}
diff --git a/l3experimental/l3draw/l3draw.ins b/l3experimental/l3draw/l3draw.ins
index d7c3616..e91015c 100644
--- a/l3experimental/l3draw/l3draw.ins
+++ b/l3experimental/l3draw/l3draw.ins
@@ -54,6 +54,7 @@ and all files in that bundle must be distributed together.
 \generate{\file{l3draw.sty}
   {
     \from{l3draw.dtx}            {package}
+    \from{l3draw-boxes.dtx}      {package}
     \from{l3draw-paths.dtx}      {package}
     \from{l3draw-points.dtx}     {package}
     \from{l3draw-scopes.dtx}     {package}
diff --git a/l3experimental/l3draw/testfiles/m3draw000.tlg b/l3experimental/l3draw/testfiles/m3draw000.tlg
index 7a7c1a3..4a13dff 100644
--- a/l3experimental/l3draw/testfiles/m3draw000.tlg
+++ b/l3experimental/l3draw/testfiles/m3draw000.tlg
@@ -4,6 +4,7 @@ Author: Joseph Wright
 (l3draw.sty
  (l3color.sty
 )
+\l__draw_tmp_box=\box...
 \g__draw_path_lastx_dim=\dimen...
 \g__draw_path_lasty_dim=\dimen...
 \g__draw_path_xmax_dim=\dimen...
@@ -37,7 +38,6 @@ Author: Joseph Wright
 \l__draw_xmin_dim=\dimen...
 \l__draw_ymax_dim=\dimen...
 \l__draw_ymin_dim=\dimen...
-\l__draw_tmp_box=\box...
 \g__draw_softpath_buffer_a_int=\count...
 \g__draw_softpath_buffer_b_int=\count...
 \g__draw_softpath_lastx_dim=\dimen...





More information about the latex3-commits mailing list