[latex3-commits] [git/LaTeX3-latex3-latex3] main: Move most l3graphics interfaces internal (1fdd86e23)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Apr 6 08:40:54 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/1fdd86e23134f6cf217bcf78a457674a0ddb55a4

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

commit 1fdd86e23134f6cf217bcf78a457674a0ddb55a4
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Apr 6 07:40:54 2022 +0100

    Move most l3graphics interfaces internal


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

1fdd86e23134f6cf217bcf78a457674a0ddb55a4
 l3backend/l3backend-graphics.dtx                   |  68 +++----
 l3experimental/CHANGELOG.md                        |   1 +
 l3experimental/l3graphics/l3graphics.dtx           | 214 +++++++--------------
 .../l3graphics/testfiles/m3graphics000.tlg         |   8 +-
 4 files changed, 105 insertions(+), 186 deletions(-)

diff --git a/l3backend/l3backend-graphics.dtx b/l3backend/l3backend-graphics.dtx
index 37122b9a7..82542167c 100644
--- a/l3backend/l3backend-graphics.dtx
+++ b/l3backend/l3backend-graphics.dtx
@@ -69,7 +69,7 @@
 % \begin{macro}{\@@_backend_getbb_eps:n}
 %   Simply use the generic function.
 %    \begin{macrocode}
-\cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n
+\cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n
 %    \end{macrocode}
 % \end{macro}
 %
@@ -82,10 +82,10 @@
     \__kernel_backend_literal:x
       {
         PSfile = #1 \c_space_tl
-        llx = \dim_to_decimal_in_bp:n \l_graphics_llx_dim \c_space_tl
-        lly = \dim_to_decimal_in_bp:n \l_graphics_lly_dim \c_space_tl
-        urx = \dim_to_decimal_in_bp:n \l_graphics_urx_dim \c_space_tl
-        ury = \dim_to_decimal_in_bp:n \l_graphics_ury_dim
+        llx = \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl
+        lly = \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl
+        urx = \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl
+        ury = \dim_to_decimal_in_bp:n \l_@@_ury_dim
       }
   }
 %    \end{macrocode}
@@ -157,7 +157,7 @@
   }
 \cs_new_protected:Npn \@@_backend_getbb_auxi:n #1
   {
-    \graphics_bb_restore:xF { #1 \l_@@_graphics_attr_tl }
+    \@@_bb_restore:xF { #1 \l_@@_graphics_attr_tl }
       { \@@_backend_getbb_auxii:n {#1} }
   }
 %    \end{macrocode}
@@ -188,11 +188,11 @@
       {#1}
     \hbox_set:Nn \l_@@_internal_box
       { \tex_pdfrefximage:D \tex_pdflastximage:D }
-    \dim_set:Nn \l_graphics_urx_dim { \box_wd:N \l_@@_internal_box }
-    \dim_set:Nn \l_graphics_ury_dim { \box_ht:N \l_@@_internal_box }
+    \dim_set:Nn \l_@@_urx_dim { \box_wd:N \l_@@_internal_box }
+    \dim_set:Nn \l_@@_ury_dim { \box_ht:N \l_@@_internal_box }
     \int_const:cn { c_@@_graphics_ #1 \l_@@_graphics_attr_tl _int }
       { \tex_the:D \tex_pdflastximage:D }
-    \graphics_bb_save:x { #1 \l_@@_graphics_attr_tl }
+    \@@_bb_save:x { #1 \l_@@_graphics_attr_tl }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -253,7 +253,7 @@
             \sys_shell_now:n
               { repstopdf ~ #2 ~ #1 }
           }
-        \tl_set:Nn \l_graphics_name_tl {#1}
+        \tl_set:Nn \l_@@_final_name_str {#1}
         \@@_backend_getbb_pdf:n {#1}
       }
     \cs_new_protected:Npn \@@_backend_include_eps:n #1
@@ -291,20 +291,20 @@
 %   Simply use the generic functions: only for \texttt{dvipdfmx} in the
 %   extraction cases.
 %    \begin{macrocode}
-\cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n
+\cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n
 %<*dvipdfmx>
 \cs_new_protected:Npn \@@_backend_getbb_jpg:n #1
   {
     \int_zero:N \l_graphics_page_int
     \tl_clear:N \l_graphics_pagebox_tl
-    \graphics_extract_bb:n {#1}
+    \@@_extract_bb:n {#1}
   }
 \cs_new_eq:NN \@@_backend_getbb_png:n \@@_backend_getbb_jpg:n
 \cs_new_protected:Npn \@@_backend_getbb_pdf:n #1
   {
     \tl_clear:N \l_graphics_decodearray_tl
     \bool_set_false:N \l_graphics_interpolate_bool
-    \graphics_extract_bb:n {#1}
+    \@@_extract_bb:n {#1}
   }
 %</dvipdfmx>
 %    \end{macrocode}
@@ -335,10 +335,10 @@
     \__kernel_backend_literal:x
       {
         PSfile = #1 \c_space_tl
-        llx = \dim_to_decimal_in_bp:n \l_graphics_llx_dim \c_space_tl
-        lly = \dim_to_decimal_in_bp:n \l_graphics_lly_dim \c_space_tl
-        urx = \dim_to_decimal_in_bp:n \l_graphics_urx_dim \c_space_tl
-        ury = \dim_to_decimal_in_bp:n \l_graphics_ury_dim
+        llx = \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl
+        lly = \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl
+        urx = \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl
+        ury = \dim_to_decimal_in_bp:n \l_@@_ury_dim
       }
   }
 \cs_new_protected:Npn \@@_backend_include_jpg:n #1
@@ -399,10 +399,10 @@
           {
             pagebox ~ \l_graphics_pagebox_tl \c_space_tl
             bbox ~
-              \dim_to_decimal_in_bp:n \l_graphics_llx_dim \c_space_tl
-              \dim_to_decimal_in_bp:n \l_graphics_lly_dim \c_space_tl
-              \dim_to_decimal_in_bp:n \l_graphics_urx_dim \c_space_tl
-              \dim_to_decimal_in_bp:n \l_graphics_ury_dim \c_space_tl
+              \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl
+              \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl
+              \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl
+              \dim_to_decimal_in_bp:n \l_@@_ury_dim \c_space_tl
           }
         (#1)
         \bool_lazy_or:nnT
@@ -494,15 +494,15 @@
 \cs_generate_variant:Nn \@@_backend_getbb_auxiv:nnNnn { V }
 \cs_new_protected:Npn \@@_backend_getbb_auxv:nNnn #1#2#3#4
   {
-    \graphics_bb_restore:nF {#1#3}
+    \@@_bb_restore:nF {#1#3}
       { \@@_backend_getbb_auxvi:nNnn {#1} #2 {#3} {#4} }
   }
 \cs_new_protected:Npn \@@_backend_getbb_auxvi:nNnn #1#2#3#4
   {
     \hbox_set:Nn \l_@@_internal_box { #2 #1 ~ #4 }
-    \dim_set:Nn \l_graphics_urx_dim { \box_wd:N \l_@@_internal_box }
-    \dim_set:Nn \l_graphics_ury_dim { \box_ht:N \l_@@_internal_box }
-    \graphics_bb_save:n {#1#3}
+    \dim_set:Nn \l_@@_urx_dim { \box_wd:N \l_@@_internal_box }
+    \dim_set:Nn \l_@@_ury_dim { \box_ht:N \l_@@_internal_box }
+    \@@_bb_save:n {#1#3}
   }
 \cs_new:Npn \@@_backend_getbb_pagebox:w #1 box {#1}
 %    \end{macrocode}
@@ -548,7 +548,7 @@
 % \begin{macro}{\@@_backend_getbb_eps:n}
 %   Simply use the generic function.
 %    \begin{macrocode}
-\cs_new_eq:NN \@@_backend_getbb_eps:n \graphics_read_bb:n
+\cs_new_eq:NN \@@_backend_getbb_eps:n \@@_read_bb:n
 %    \end{macrocode}
 % \end{macro}
 %
@@ -559,7 +559,7 @@
   {
     \int_zero:N \l_graphics_page_int
     \tl_clear:N \l_graphics_pagebox_tl
-    \graphics_extract_bb:n {#1}
+    \@@_extract_bb:n {#1}
   }
 \cs_new_eq:NN \@@_backend_getbb_png:n \@@_backend_getbb_jpg:n
 %    \end{macrocode}
@@ -572,7 +572,7 @@
   {
     \tl_clear:N \l_graphics_decodearray_tl
     \bool_set_false:N \l_graphics_interpolate_bool
-    \graphics_extract_bb:n {#1}
+    \@@_extract_bb:n {#1}
   }
 %    \end{macrocode}
 % \end{macro}
@@ -591,10 +591,10 @@
     \__kernel_backend_literal:x
       {
         #1 = #2 \c_space_tl
-        llx = \dim_to_decimal_in_bp:n \l_graphics_llx_dim \c_space_tl
-        lly = \dim_to_decimal_in_bp:n \l_graphics_lly_dim \c_space_tl
-        urx = \dim_to_decimal_in_bp:n \l_graphics_urx_dim \c_space_tl
-        ury = \dim_to_decimal_in_bp:n \l_graphics_ury_dim
+        llx = \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl
+        lly = \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl
+        urx = \dim_to_decimal_in_bp:n \l_@@_urx_dim \c_space_tl
+        ury = \dim_to_decimal_in_bp:n \l_@@_ury_dim
       }
   }
 %    \end{macrocode}
@@ -615,8 +615,8 @@
      \__kernel_backend_literal:x
        {
          dvisvgm:img~
-         \dim_to_decimal:n { \l_graphics_ury_dim } ~
-         \dim_to_decimal:n { \l_graphics_ury_dim } ~
+         \dim_to_decimal:n { \l_@@_ury_dim } ~
+         \dim_to_decimal:n { \l_@@_ury_dim } ~
          \@@_backend_include_bitmap_quote:w #1 " #1 " \s_@@_stop
        }
   }
diff --git a/l3experimental/CHANGELOG.md b/l3experimental/CHANGELOG.md
index b12532edd..5fec52051 100644
--- a/l3experimental/CHANGELOG.md
+++ b/l3experimental/CHANGELOG.md
@@ -10,6 +10,7 @@ this project uses date-based 'snapshot' version identifiers.
 ### Changed
 - Return an empty `seq` when `\sys_shell_split_ls:nN` is applied with a
   glob which matched no entries
+- Heavily revise `l3graphics` to provide only necessary public interfaces
 
 ## [2022-02-05]
 
diff --git a/l3experimental/l3graphics/l3graphics.dtx b/l3experimental/l3graphics/l3graphics.dtx
index 2a8f9bb61..87406b0dc 100644
--- a/l3experimental/l3graphics/l3graphics.dtx
+++ b/l3experimental/l3graphics/l3graphics.dtx
@@ -54,11 +54,10 @@
 %
 % \section{\pkg{l3graphics} documentation}
 %
-% \subsection{Driver functions}
+% \subsection{Graphics data}
 %
 % Inclusion of graphic files requires a range of low-level data be passed to
-% the driver layer. These functions are primarily aimed at supporting this
-% work.
+% the backend. This is set up using a small number of variables.
 %
 % \begin{variable}{\l_graphics_decodearray_tl}
 %   Array to decode color in bitmap graphic: when non-empty, this should
@@ -86,93 +85,7 @@
 %   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
-%   $(\meta{urx},\meta{ury})$ for the graphic. For many graphics only the resulting
-%   height and width are significant, but this is driver-dependent.
-% \end{variable}
-%
-% \begin{variable}{\l_graphics_name_tl}
-%   The name of a graphics file being loaded: usually the same as the
-%   input file name, but may be altered by some drivers.
-% \end{variable}
-%
-% \begin{function}
-%   {
-%     \graphics_bb_save:n, \graphics_bb_save:x,
-%     \graphics_bb_restore:nF, \graphics_bb_restore:xF
-%   }
-%   \begin{syntax}
-%     \cs{graphics_bb_save:n} \Arg{graphic}
-%     \cs{graphics_bb_restore:nF} \Arg{graphic} \Arg{false code}
-%   \end{syntax}
-%   This pair of functions are used to cache the bounding box of an \meta{graphic}
-%   so that extraction/reading is only required once. The \texttt{save}
-%   function stores the values from \cs{l_graphics_llx_dim},
-%   \cs{l_graphics_lly_dim}, \cs{l_graphics_urx_dim} and
-%   \cs{l_graphics_ury_dim} as constants. The \texttt{restore} function will then
-%   look up values for the bounding box of an \meta{graphic} and set the four
-%   dimensions appropriately. For any one \meta{graphic} the bounding box will
-%   be constant, so the \texttt{save} function should only be called once. Thus
-%   a typical use case is
-%   \begin{verbatim}
-%   \graphics_bb_restore:nF { <name> }
-%     {
-%       % Code to read the bb
-%       \graphics_bb_save:n { <name> }
-%     }
-%   \end{verbatim}
-%   \emph{i.e.}~every use of a bounding box will attempt to restore saved data,
-%   and saving will only take place where that is not possible.
-%
-%   Note that the \meta{graphic} may not be a simple file name: a multi-page PDF,
-%   for example, will need to have the bounding box cached for each page used.
-% \end{function}
-%
-% \begin{function}{\graphics_extract_bb:n}
-%   \begin{syntax}
-%     \cs{graphics_extract_bb:n} \Arg{file}
-%   \end{syntax}
-%   Extracts bounding box data for the graphic \meta{file} using the |extractbb|
-%   utility, and stores the bounding box of the graphic file in
-%   \cs{l_graphics_llx_dim}, \cs{l_graphics_lly_dim}, \cs{l_graphics_urx_dim} and
-%   \cs{l_graphics_ury_dim}.
-%
-%   The \meta{file} name should be fully-qualified and sanitized: no search
-%   or other manipulation is carried out at this level. No check is made on
-%   the file \emph{type} at this stage: it is assumed that the driver code
-%   using this function has made such a check. File types such as |.pdf| and
-%   |.jpg| are appropriate for parsing using this function.
-%
-%   When \cs{l_graphics_page_int} is positive the appropriate page will be
-%   queried from the graphic file.
-%
-%   Note that this function requires pipe shell calls to be enabled: this is
-%   generally true but may require the option |--enable-pipes| to be enabled
-%   when running the \TeX{} job.
-% \end{function}
-%
-% \begin{function}{\graphics_read_bb:n}
-%   \begin{syntax}
-%     \cs{graphics_read_bb:n} \Arg{file}
-%   \end{syntax}
-%   Parses the graphic \meta{file} to find a PostScript-style bounding box
-%   line of the form
-%   \begin{verbatim}
-%   %%BoundingBox: llx lly urx urx
-%   \end{verbatim}
-%   where \meta{llx}, \meta{lly}, \meta{urx} and \meta{ury} are the corners
-%   of the bounding box expressed in PostScript (\enquote{big}) points. The
-%   values are stored in \cs{l_graphics_llx_dim}, \cs{l_graphics_lly_dim},
-%   \cs{l_graphics_urx_dim} and \cs{l_graphics_ury_dim}.
-%
-%   The \meta{file} name should be fully-qualified and sanitized: no search
-%   or other manipulation is carried out at this level. No check is made on
-%   the file \emph{type} at this stage: it is assumed that the driver code
-%   using this function has made such a check. File types such as |.eps| and
-%   |.bb|/|.xbb| are appropriate for parsing using this function.
-% \end{function}
+% \subsection{Including graphics}
 %
 % \begin{function}{\graphics_include:n, \graphics_include:nn}
 %   \begin{syntax}
@@ -213,6 +126,8 @@
 %   variable content. Spaces need not be quoted.
 % \end{variable}
 %
+% \subsection{Showing and logging included graphics}
+%
 % \begin{function}{\graphics_show_list:, \graphics_log_list:}
 %   \begin{syntax}
 %     \cs{graphics_show_list:}
@@ -284,60 +199,60 @@
 %
 % \begin{variable}
 %   {
-%     \l_graphics_llx_dim , \l_graphics_lly_dim,
-%     \l_graphics_urx_dim , \l_graphics_ury_dim
+%     \l_@@_llx_dim , \l_@@_lly_dim,
+%     \l_@@_urx_dim , \l_@@_ury_dim
 %   }
 %   Storage for the return of bounding box.
 %    \begin{macrocode}
-\dim_new:N \l_graphics_llx_dim
-\dim_new:N \l_graphics_lly_dim
-\dim_new:N \l_graphics_urx_dim
-\dim_new:N \l_graphics_ury_dim
+\dim_new:N \l_@@_llx_dim
+\dim_new:N \l_@@_lly_dim
+\dim_new:N \l_@@_urx_dim
+\dim_new:N \l_@@_ury_dim
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{macro}{\graphics_bb_save:n, \graphics_bb_save:x}
-% \begin{macro}{\graphics_bb_restore:nF, \graphics_bb_restore:xF}
+% \begin{macro}{\@@_bb_save:n, \@@_bb_save:x}
+% \begin{macro}{\@@_bb_restore:nF, \@@_bb_restore:xF}
 %   Caching graphic bounding boxes is sensible, and these functions are needed both
 %   here and for drive-specific work. So they are made available as documented
 %   functions. To save on registers, the \enquote{origin} is only saved if it is
 %   not at zero.
 %     \begin{macrocode}
-\cs_new_protected:Npn \graphics_bb_save:n #1
+\cs_new_protected:Npn \@@_bb_save:n #1
   {
     \dim_if_exist:cTF { c_@@_ #1 _urx_dim }
       { \msg_error:nnn { graphic } { bb-already-cached } {#1} }
       {
-        \dim_compare:nNnF \l_graphics_llx_dim = { 0pt }
-          { \dim_const:cn { c_@@_ #1 _llx_dim } { \l_graphics_llx_dim } }
-        \dim_compare:nNnF \l_graphics_lly_dim = { 0pt }
-          { \dim_const:cn { c_@@_ #1 _lly_dim } { \l_graphics_lly_dim } }
-        \dim_const:cn { c_@@_ #1 _urx_dim } { \l_graphics_urx_dim }
-        \dim_const:cn { c_@@_ #1 _ury_dim } { \l_graphics_ury_dim }
+        \dim_compare:nNnF \l_@@_llx_dim = { 0pt }
+          { \dim_const:cn { c_@@_ #1 _llx_dim } { \l_@@_llx_dim } }
+        \dim_compare:nNnF \l_@@_lly_dim = { 0pt }
+          { \dim_const:cn { c_@@_ #1 _lly_dim } { \l_@@_lly_dim } }
+        \dim_const:cn { c_@@_ #1 _urx_dim } { \l_@@_urx_dim }
+        \dim_const:cn { c_@@_ #1 _ury_dim } { \l_@@_ury_dim }
       }
   }
-\cs_generate_variant:Nn \graphics_bb_save:n { x }
-\cs_new_protected:Npn \graphics_bb_restore:nF #1#2
+\cs_generate_variant:Nn \@@_bb_save:n { x }
+\cs_new_protected:Npn \@@_bb_restore:nF #1#2
   {
     \dim_if_exist:cTF { c_@@_ #1 _urx_dim }
       {
-        \dim_set_eq:Nc \l_graphics_urx_dim { c_@@_ #1 _urx_dim }
-        \dim_set_eq:Nc \l_graphics_ury_dim { c_@@_ #1 _ury_dim }
+        \dim_set_eq:Nc \l_@@_urx_dim { c_@@_ #1 _urx_dim }
+        \dim_set_eq:Nc \l_@@_ury_dim { c_@@_ #1 _ury_dim }
         \dim_if_exist:cTF { c_@@_ #1 _llx_dim }
-          { \dim_set_eq:Nc \l_graphics_llx_dim { c_@@_ #1 _llx_dim } }
-          { \dim_zero:N \l_graphics_llx_dim }
+          { \dim_set_eq:Nc \l_@@_llx_dim { c_@@_ #1 _llx_dim } }
+          { \dim_zero:N \l_@@_llx_dim }
         \dim_if_exist:cTF { c_@@_ #1 _lly_dim }
-          { \dim_set_eq:Nc \l_graphics_lly_dim { c_@@_ #1 _lly_dim } }
-          { \dim_zero:N \l_graphics_lly_dim }
+          { \dim_set_eq:Nc \l_@@_lly_dim { c_@@_ #1 _lly_dim } }
+          { \dim_zero:N \l_@@_lly_dim }
       }
       {#2}
   }
-\cs_generate_variant:Nn \graphics_bb_restore:nF { x }
+\cs_generate_variant:Nn \@@_bb_restore:nF { x }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\graphics_extract_bb:n, \graphics_read_bb:n}
+% \begin{macro}{\@@_extract_bb:n, \@@_read_bb:n}
 % \begin{macro}{\@@_extract_bb_auix:nn, \@@_extract_bb_auix:Vn}
 % \begin{macro}{\@@_extract_bb_auxii:nnn}
 % \begin{macro}{\@@_extract_bb_auxiii:nnnn, \@@_extract_bb_auxiii:Vnnn}
@@ -357,7 +272,7 @@
 %  box has to be calculated by |extractbb|, with just the initial phase
 %  different.
 %    \begin{macrocode}
-\cs_new_protected:Npn \graphics_extract_bb:n #1
+\cs_new_protected:Npn \@@_extract_bb:n #1
   {
     \int_compare:nNnTF \l_graphics_page_int > 0
       { \@@_extract_bb_auxi:Vn \l_graphics_page_int {#1} }
@@ -382,7 +297,7 @@
       { \ior_shell_open:Nn \l_@@_tmp_ior { extractbb~#3-O~#1 } }
       { pipe-failed }
   }
-\cs_new_protected:Npn \graphics_read_bb:n #1
+\cs_new_protected:Npn \@@_read_bb:n #1
   {
     \@@_read_bb_auxi:nnnn {#1} { }
       { \ior_open:Nn \l_@@_tmp_ior {#1} }
@@ -401,7 +316,7 @@
 %   \begin{macrocode}
 \cs_new_protected:Npn \@@_read_bb_auxi:nnnn #1#2#3#4
   {
-    \graphics_bb_restore:nF {#1#2}
+    \@@_bb_restore:nF {#1#2}
       { \@@_read_bb_auxii:nnnn {#3} {#4} {#1} {#2} }
   }
 \cs_new_protected:Npx \@@_read_bb_auxii:nnnn #1#2#3#4
@@ -419,12 +334,12 @@
     \exp_not:n
       {
         \ior_close:N \l_@@_tmp_ior
-        \dim_compare:nNnF \l_graphics_llx_dim = { 0pt }
-          { \dim_const:cn { c_@@_ #3#4 _llx_dim } { \l_graphics_llx_dim } }
-        \dim_compare:nNnF \l_graphics_lly_dim = { 0pt }
-          { \dim_const:cn { c_@@_ #3#4 _lly_dim } { \l_graphics_lly_dim } }
-        \dim_const:cn { c_@@_ #3#4 _urx_dim } { \l_graphics_urx_dim }
-        \dim_const:cn { c_@@_ #3#4 _ury_dim } { \l_graphics_ury_dim }
+        \dim_compare:nNnF \l_@@_llx_dim = { 0pt }
+          { \dim_const:cn { c_@@_ #3#4 _llx_dim } { \l_@@_llx_dim } }
+        \dim_compare:nNnF \l_@@_lly_dim = { 0pt }
+          { \dim_const:cn { c_@@_ #3#4 _lly_dim } { \l_@@_lly_dim } }
+        \dim_const:cn { c_@@_ #3#4 _urx_dim } { \l_@@_urx_dim }
+        \dim_const:cn { c_@@_ #3#4 _ury_dim } { \l_@@_ury_dim }
       }
   }
 \use:x
@@ -465,10 +380,10 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_read_bb_auxv:w #1~#2~#3~#4~#5 \s_@@_stop
   {
-    \dim_set:Nn \l_graphics_llx_dim { #1 bp }
-    \dim_set:Nn \l_graphics_lly_dim { #2 bp }
-    \dim_set:Nn \l_graphics_urx_dim { #3 bp }
-    \dim_set:Nn \l_graphics_ury_dim { #4 bp }
+    \dim_set:Nn \l_@@_llx_dim { #1 bp }
+    \dim_set:Nn \l_@@_lly_dim { #2 bp }
+    \dim_set:Nn \l_@@_urx_dim { #3 bp }
+    \dim_set:Nn \l_@@_ury_dim { #4 bp }
     \ior_map_break:
   }
 %    \end{macrocode}
@@ -487,10 +402,13 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{variable}{\l_graphics_name_tl, \l_@@_name_tl}
+% \begin{variable}{\l_@@_final_name_str, \l_@@_full_name_str}
+%   The full name is as you'd expect the name including path and extension.
+%   The final name here reflects any conversions carried out by the backend,
+%   for example if an |.eps| is converted to |.pdf|.
 %    \begin{macrocode}
-\tl_new:N \l_graphics_name_tl
-\tl_new:N \l_@@_name_tl
+\str_new:N \l_@@_final_name_str
+\str_new:N \l_@@_full_name_str
 %    \end{macrocode}
 % \end{variable}
 %
@@ -556,9 +474,9 @@
   {
     \group_begin:
       \seq_set_eq:NN \l_file_search_path_seq \l_graphics_search_path_seq
-      \file_get_full_name:nNTF {#1} \l_@@_name_tl
+      \file_get_full_name:nNTF {#1} \l_@@_full_name_str
         {
-          \str_if_eq:eeTF { \l_@@_name_tl } { #1 .tex }
+          \str_if_eq:eeTF { \l_@@_full_name_str } { #1 .tex }
             { \@@_include_search:n {#1} }
             { \@@_include: }
         }
@@ -569,7 +487,7 @@
   {
     \seq_map_inline:Nn \l_graphics_search_ext_seq
       {
-        \file_get_full_name:nNT { #1 . ##1 } \l_@@_name_tl
+        \file_get_full_name:nNT { #1 . ##1 } \l_@@_full_name_str
           { \seq_map_break:n { \use_i:nnn \@@_include: } }
       }
     \use:n
@@ -577,7 +495,7 @@
   }
 \cs_new_protected:Npn \@@_include:
   {
-    \file_parse_full_name:VNNN \l_@@_name_tl
+    \file_parse_full_name:VNNN \l_@@_full_name_str
       \l_@@_dir_str \l_@@_name_str \l_@@_ext_str
     \exp_args:Ne \@@_include_auxi:n
       {
@@ -589,7 +507,7 @@
   {
     \group_begin:
       \seq_set_eq:NN \l_file_search_path_seq \l_graphics_search_path_seq
-      \file_get_full_name:nNTF {#1} \l_@@_name_tl
+      \file_get_full_name:nNTF {#1} \l_@@_full_name_str
         {
           \exp_args:Ne \@@_include_auxi:n
             { \str_foldcase:n {#1} }
@@ -608,12 +526,12 @@
     \mode_leave_vertical:
     \cs_if_exist:cTF { @@_backend_include_ #1 :n }
       {
-        \tl_set_eq:NN \l_graphics_name_tl \l_@@_name_tl
+        \tl_set_eq:NN \l_@@_final_name_str \l_@@_full_name_str
         \exp_args:NnV \use:c { @@_backend_getbb_ #1 :n }
-          \l_@@_name_tl
-        \seq_gput_right:NV \g_@@_record_seq \l_graphics_name_tl
+          \l_@@_full_name_str
+        \seq_gput_right:NV \g_@@_record_seq \l_@@_final_name_str
         \clist_if_exist:NT \@filelist
-          { \exp_args:NV \@addtofilelist \l_graphics_name_tl }
+          { \exp_args:NV \@addtofilelist \l_@@_final_name_str }
         \bool_if:NTF \l_graphics_draft_bool
           { \@@_include_auxiii:n }
           { \@@_include_auxiv:n }
@@ -623,21 +541,21 @@
   }
 \cs_new_protected:Npn \@@_include_auxiii:n #1
   {
-    \hbox_to_wd:nn { \l_graphics_urx_dim - \l_graphics_llx_dim }
+    \hbox_to_wd:nn { \l_@@_urx_dim - \l_@@_llx_dim }
       {
         \tex_vrule:D
         \tex_hss:D
         \vbox_to_ht:nn
-          { \l_graphics_ury_dim - \l_graphics_lly_dim }
+          { \l_@@_ury_dim - \l_@@_lly_dim }
           {
             \tex_hrule:D width
-              \dim_eval:n { \l_graphics_urx_dim - \l_graphics_llx_dim }
+              \dim_eval:n { \l_@@_urx_dim - \l_@@_llx_dim }
             \tex_vss:D
             \hbox_to_wd:nn
-              { \l_graphics_urx_dim - \l_graphics_llx_dim }
+              { \l_@@_urx_dim - \l_@@_llx_dim }
               {
                 \ttfamily
-                \tex_hss:D \l_@@_name_tl \tex_hss:D
+                \tex_hss:D \l_@@_full_name_str \tex_hss:D
               }
             \tex_vss:D
             \tex_hrule:D
@@ -651,13 +569,13 @@
     \hbox_set:Nn \l_@@_internal_box
       {
         \exp_args:NnV \use:c { @@_backend_include_ #1 :n }
-          \l_@@_name_tl
+          \l_@@_full_name_str
       }
     \box_set_dp:Nn \l_@@_internal_box { 0pt }
     \box_set_ht:Nn \l_@@_internal_box
-      { \l_graphics_ury_dim - \l_graphics_lly_dim }
+      { \l_@@_ury_dim - \l_@@_lly_dim }
      \box_set_wd:Nn \l_@@_internal_box
-      { \l_graphics_urx_dim - \l_graphics_llx_dim }
+      { \l_@@_urx_dim - \l_@@_llx_dim }
     \box_use_drop:N \l_@@_internal_box
   }
 %    \end{macrocode}
diff --git a/l3experimental/l3graphics/testfiles/m3graphics000.tlg b/l3experimental/l3graphics/testfiles/m3graphics000.tlg
index aa3885b15..21cdc7b2a 100644
--- a/l3experimental/l3graphics/testfiles/m3graphics000.tlg
+++ b/l3experimental/l3graphics/testfiles/m3graphics000.tlg
@@ -4,9 +4,9 @@ Author: Bruno Le Floch
 (l3graphics.sty
 Package: l3graphics ....-..-.. L3 Experimental graphics inclusion support
 \l_graphics_page_int=\count...
-\l_graphics_llx_dim=\dimen...
-\l_graphics_lly_dim=\dimen...
-\l_graphics_urx_dim=\dimen...
-\l_graphics_ury_dim=\dimen...
+\l__graphics_llx_dim=\dimen...
+\l__graphics_lly_dim=\dimen...
+\l__graphics_urx_dim=\dimen...
+\l__graphics_ury_dim=\dimen...
 \l__graphics_internal_box=\box...
 )





More information about the latex3-commits mailing list.