[latex3-commits] [git/LaTeX3-latex3-latex3] master: Draft support for l3graphics (e37dc55)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sat May 11 13:18:11 CEST 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/e37dc555d63c4a9ee92e8d94640c5fd2ad748a73
>---------------------------------------------------------------
commit e37dc555d63c4a9ee92e8d94640c5fd2ad748a73
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sat May 11 12:18:11 2019 +0100
Draft support for l3graphics
The frame code is all low-level: should be replaced
at some stage with a proper implementation
(see e.g. xbox).
>---------------------------------------------------------------
e37dc555d63c4a9ee92e8d94640c5fd2ad748a73
l3experimental/l3graphics/l3graphics.dtx | 73 ++++++++++++++++++++++++------
1 file changed, 60 insertions(+), 13 deletions(-)
diff --git a/l3experimental/l3graphics/l3graphics.dtx b/l3experimental/l3graphics/l3graphics.dtx
index fa073ec..f75eaa6 100644
--- a/l3experimental/l3graphics/l3graphics.dtx
+++ b/l3experimental/l3graphics/l3graphics.dtx
@@ -79,6 +79,11 @@
% specifications.
% \end{variable}
%
+% \begin{variable}{\l_graphics_draft_bool}
+% Switch to enable draft mode: images are read but not included when this is
+% true.
+% \end{variable}
+%
% \begin{variable}
% {\l_graphics_llx_dim, \l_graphics_lly_dim, \l_graphics_urx_dim, \l_graphics_ury_dim}
% Dimensions which return the points $(\meta{llx},\meta{lly})$ and
@@ -453,6 +458,13 @@
% \end{macro}
% \end{macro}
%
+% \begin{variable}{\l_graphics_draft_bool}
+% Relevant to including graphics but not to reading them.
+% \begin{macrocode}
+\bool_new:N \l_graphics_draft_bool
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\l_@@_name_tl}
% \begin{macrocode}
\tl_new:N \l_@@_name_tl
@@ -497,7 +509,8 @@
% \begin{macro}{\@@_include_search:n}
% \begin{macro}{\@@_include:}
% \begin{macro}{\graphics_include:nn}
-% \begin{macro}{\@@_include:n, \@@_include_aux:n}
+% \begin{macro}
+% {\@@_include:n, \@@_include_auxi:n, \@@_include_auxii:n, \@@_include_auxiii:n}
% Actually including an image is relatively straight-forward: most of the
% work is done by the driver. We only have to deal with making sure the
% box has no apparent depth. Where the first given name is not found, we
@@ -545,8 +558,8 @@
\group_end:
}
\cs_new_protected:Npn \@@_include:n #1
- { \exp_args:Ne \@@_include_aux:n { \str_fold_case:n {#1} } }
-\cs_new_protected:Npn \@@_include_aux:n #1
+ { \exp_args:Ne \@@_include_auxi:n { \str_fold_case:n {#1} } }
+\cs_new_protected:Npn \@@_include_auxi:n #1
{
\mode_leave_vertical:
\cs_if_exist:cTF { driver_graphics_include_ #1 :n }
@@ -558,19 +571,53 @@
\clist_if_exist:NT \@filelist
{ \exp_args:NV \@addtofilelist \l_@@_name_tl }
%</package>
- \hbox_set:Nn \l_@@_internal_box
+ \bool_if:NTF \l_graphics_draft_bool
+ { \@@_include_auxii:n }
+ { \@@_include_auxiii:n }
+ {#1}
+ }
+ { \__kernel_msg_error:nnn { image } { unsupported-image-type } {#1} }
+ }
+\cs_new_protected:Npn \@@_include_auxii:n #1
+ {
+ \hbox_to_wd:nn { \l_graphics_urx_dim - \l_graphics_llx_dim }
+ {
+ \tex_vrule:D
+ \tex_hss:D
+ \vbox_to_ht:nn
+ { \l_graphics_ury_dim - \l_graphics_lly_dim }
{
- \exp_args:NnV \use:c { driver_graphics_include_ #1 :n }
- \l_@@_name_tl
+ \tex_hrule:D width
+ \dim_eval:n { \l_graphics_urx_dim - \l_graphics_llx_dim }
+ \tex_vss:D
+ \hbox_to_wd:nn
+ { \l_graphics_urx_dim - \l_graphics_llx_dim }
+ {
+%<*package>
+ \ttfamily
+%</package>
+ \tex_hss:D \l_@@_name_tl \tex_hss:D
+ }
+ \tex_vss:D
+ \tex_hrule:D
}
- \box_set_dp:Nn \l_@@_internal_box { 0pt }
- \box_set_ht:Nn \l_@@_internal_box
- { \l_graphics_ury_dim - \l_graphics_lly_dim }
- \box_set_wd:Nn \l_@@_internal_box
- { \l_graphics_urx_dim - \l_graphics_llx_dim }
- \box_use_drop:N \l_@@_internal_box
+ \tex_hss:D
+ \tex_vrule:D
}
- { \__kernel_msg_error:nnn { image } { unsupported-image-type } {#1} }
+ }
+\cs_new_protected:Npn \@@_include_auxiii:n #1
+ {
+ \hbox_set:Nn \l_@@_internal_box
+ {
+ \exp_args:NnV \use:c { driver_graphics_include_ #1 :n }
+ \l_@@_name_tl
+ }
+ \box_set_dp:Nn \l_@@_internal_box { 0pt }
+ \box_set_ht:Nn \l_@@_internal_box
+ { \l_graphics_ury_dim - \l_graphics_lly_dim }
+ \box_set_wd:Nn \l_@@_internal_box
+ { \l_graphics_urx_dim - \l_graphics_llx_dim }
+ \box_use_drop:N \l_@@_internal_box
}
% \end{macrocode}
% \end{macro}
More information about the latex3-commits
mailing list