[latex3-commits] [git/LaTeX3-latex3-latex3] main: Keep pagebox data as a tl (229e46a61)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Apr 6 13:57:24 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/229e46a61c786f5a909953e3657acdcf3d81bbc6

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

commit 229e46a61c786f5a909953e3657acdcf3d81bbc6
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Apr 6 10:28:00 2022 +0100

    Keep pagebox data as a tl


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

229e46a61c786f5a909953e3657acdcf3d81bbc6
 l3backend/l3backend-graphics.dtx         | 34 ++++++++++++++++++--------------
 l3experimental/l3graphics/l3graphics.dtx | 14 +++++++------
 2 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/l3backend/l3backend-graphics.dtx b/l3backend/l3backend-graphics.dtx
index 25d22d0cf..902985573 100644
--- a/l3backend/l3backend-graphics.dtx
+++ b/l3backend/l3backend-graphics.dtx
@@ -172,7 +172,7 @@
 \cs_new_protected:Npn \@@_backend_getbb_jpg:n #1
   {
     \int_zero:N \l_@@_page_int
-    \tl_clear:N \l_@@_pagebox_str
+    \tl_clear:N \l_@@_pagebox_tl
     \tl_set:Nx \l_@@_graphics_attr_tl
       {
         \tl_if_empty:NF \l_@@_decodearray_str
@@ -191,7 +191,7 @@
     \bool_set_false:N \l_@@_interpolate_bool
     \tl_set:Nx \l_@@_graphics_attr_tl
       {
-        : \l_@@_pagebox_str
+        : \l_@@_pagebox_tl
         \int_compare:nNnT \l_@@_page_int > 1
           { :P \int_use:N \l_@@_page_int }
       }
@@ -225,8 +225,8 @@
         }
       \int_compare:nNnT \l_@@_page_int > 0
         { page ~ \int_use:N \l_@@_page_int }
-      \tl_if_empty:NF \l_@@_pagebox_str
-        { \l_@@_pagebox_str }
+      \tl_if_empty:NF \l_@@_pagebox_tl
+        { \l_@@_pagebox_tl }
       {#1}
     \hbox_set:Nn \l_@@_internal_box
       { \tex_pdfrefximage:D \tex_pdflastximage:D }
@@ -356,7 +356,7 @@
 \cs_new_protected:Npn \@@_backend_getbb_jpg:n #1
   {
     \int_zero:N \l_@@_page_int
-    \tl_clear:N \l_@@_pagebox_str
+    \tl_clear:N \l_@@_pagebox_tl
     \@@_extract_bb:n {#1}
   }
 \cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n
@@ -425,8 +425,8 @@
   {
     \@@_backend_include_auxii:xnn
       {
-        \tl_if_empty:NF \l_@@_pagebox_str
-          { : \l_@@_pagebox_str }
+        \tl_if_empty:NF \l_@@_pagebox_tl
+          { : \l_@@_pagebox_tl }
         \int_compare:nNnT \l_@@_page_int > 1
           { :P \int_use:N \l_@@_page_int }
         \tl_if_empty:NF \l_@@_decodearray_str
@@ -462,9 +462,9 @@
         @graphic \int_use:c { c_@@_graphics_ #1#2 _int } ~
         \int_compare:nNnT \l_@@_page_int > 1
           { page ~ \int_use:N \l_@@_page_int \c_space_tl }
-        \tl_if_empty:NF \l_@@_pagebox_str
+        \tl_if_empty:NF \l_@@_pagebox_tl
           {
-            pagebox ~ \l_@@_pagebox_str \c_space_tl
+            pagebox ~ \l_@@_pagebox_tl \c_space_tl
             bbox ~
               \dim_to_decimal_in_bp:n \l_@@_llx_dim \c_space_tl
               \dim_to_decimal_in_bp:n \l_@@_lly_dim \c_space_tl
@@ -526,7 +526,7 @@
 \cs_new_protected:Npn \@@_backend_getbb_jpg:n #1
   {
     \int_zero:N \l_@@_page_int
-    \tl_clear:N \l_@@_pagebox_str
+    \tl_clear:N \l_@@_pagebox_tl
     \@@_backend_getbb_auxi:nN {#1} \tex_XeTeXpicfile:D
   }
 \cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n
@@ -549,8 +549,8 @@
 \cs_generate_variant:Nn \@@_backend_getbb_auxii:nnN { V }
 \cs_new_protected:Npn \@@_backend_getbb_auxiii:nNnn #1#2#3#4
   {
-    \tl_if_empty:NTF \l_@@_pagebox_str
-      { \@@_backend_getbb_auxiv:VnNnn \l_@@_pagebox_str }
+    \tl_if_empty:NTF \l_@@_pagebox_tl
+      { \@@_backend_getbb_auxiv:VnNnn \l_@@_pagebox_tl }
       { \@@_backend_getbb_auxv:nNnn }
       {#1} #2 {#3} {#4}
   }
@@ -559,7 +559,11 @@
     \use:x
       {
         \@@_backend_getbb_auxv:nNnn {#2} #3 { : #1 #4 }
-          { #5 ~ \@@_backend_getbb_pagebox:w #1 }
+          {
+            #5
+            \tl_if_blank:nF {#1}
+              { \c_space_tl \@@_backend_getbb_pagebox:w #1 }
+          }
       }
   }
 \cs_generate_variant:Nn \@@_backend_getbb_auxiv:nnNnn { V }
@@ -598,7 +602,7 @@
       \@@_backend_include_pdf_quote:w #1 "#1" \s_@@_stop \c_space_tl
       \int_compare:nNnT \l_@@_page_int > 0
         { page ~ \int_use:N \l_@@_page_int \c_space_tl }
-        \exp_after:wN \@@_backend_getbb_pagebox:w \l_@@_pagebox_str
+        \exp_after:wN \@@_backend_getbb_pagebox:w \l_@@_pagebox_tl
   }
 \cs_new:Npn \@@_backend_include_pdf_quote:w #1 " #2 " #3 \s_@@_stop
   { " #2 " }
@@ -641,7 +645,7 @@
 \cs_new_protected:Npn \@@_backend_getbb_jpg:n #1
   {
     \int_zero:N \l_@@_page_int
-    \tl_clear:N \l_@@_pagebox_str
+    \tl_clear:N \l_@@_pagebox_tl
     \@@_extract_bb:n {#1}
   }
 \cs_new_eq:NN \@@_backend_getbb_jpeg:n \@@_backend_getbb_jpg:n
diff --git a/l3experimental/l3graphics/l3graphics.dtx b/l3experimental/l3graphics/l3graphics.dtx
index b116e5216..6591b697f 100644
--- a/l3experimental/l3graphics/l3graphics.dtx
+++ b/l3experimental/l3graphics/l3graphics.dtx
@@ -193,16 +193,18 @@
 %     \l__@@_draft_bool      ,
 %     \l_@@_interpolate_bool ,
 %     \l_@@_page_int         ,
-%     \l_@@_pagebox_str      ,
+%     \l_@@_pagebox_tl       ,
 %     \l_@@_type_str
 %   }
 %   Keys which control features of graphics. The standard value of |pagebox|
 %   set up here should match the default for the backends themselves: in
 %   the absence of any other setting the |crop| should be used. Note that
 %   the variable \cs{l_@@_pagebox_str} can be empty internally, as backends
-%   which do not support |pagebox| are set up to clear it entirely.
+%   which do not support |pagebox| are set up to clear it entirely. The
+%   store for |pagebox| is a |tl| as that makes extracting the data
+%   easier for some backends.
 %    \begin{macrocode}
-\tl_new:N \l_@@_pagebox_str
+\tl_new:N \l_@@_pagebox_tl
 \keys_define:nn { graphics }
   {
     decodearray .str_set:N =
@@ -214,7 +216,7 @@
     pagebox .choices:nn =
       { art , bleed , crop , media , trim }
       {
-        \str_set:Nx \l_@@_pagebox_str
+        \tl_set:Nx \l_@@_pagebox_tl
            { \tl_use:N \l_keys_choice_tl box }
       } ,
     pagebox .initial:n =
@@ -315,9 +317,9 @@
 \cs_generate_variant:Nn \@@_extract_bb_auxi:nn { Vn }
 \cs_new_protected:Npn \@@_extract_bb_auxii:nnn #1#2#3
   {
-    \tl_if_empty:NTF \l_@@_pagebox_str
+    \tl_if_empty:NTF \l_@@_pagebox_tl
       { \@@_extract_bb_auxiv:nnn }
-      { \@@_extract_bb_auxiii:Vnnn \l_@@_pagebox_str }
+      { \@@_extract_bb_auxiii:Vnnn \l_@@_pagebox_tl }
       {#1} {#2} {#3}
   }
 \cs_new_protected:Npn \@@_extract_bb_auxiii:nnnn #1#2#3#4





More information about the latex3-commits mailing list.