[latex3-commits] [l3svn] branch master updated: Store/return ht/wd of images, not bounding box

noreply at latex-project.org noreply at latex-project.org
Wed May 17 09:39:46 CEST 2017


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  307dc53   Store/return ht/wd of images, not bounding box
307dc53 is described below

commit 307dc5341a6052720544b16f6223c11e73e79683
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed May 17 08:38:09 2017 +0100

    Store/return ht/wd of images, not bounding box
    
    You only need the llx/lly points if applying a viewport by telling the driver itself
    where to place the image. That only makes sense with some drivers (dvips, (x)dvipdfmx))
    and doesn't add much to the alternative of include the image 'naturally' then use a
    general box operation.
---
 l3kernel/l3drivers.dtx      |   40 ++++++++++++++--------------
 l3trial/l3image/l3image.dtx |   62 +++++++++++++------------------------------
 2 files changed, 39 insertions(+), 63 deletions(-)

diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index 5bdb092..72f3a68 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -738,12 +738,12 @@
   }
 \cs_new_protected:Npn \@@_image_getbb_auxi:n #1
   {
-    \int_if_exist:cTF { c__image_ #1 \l_@@_image_attr_tl _int }
+    \dim_if_exist:cTF { c__image_ #1 \l_@@_image_attr_tl _ht_dim }
       {
-        \dim_set_eq:Nc \l__image_urx_dim
-          { c__image_ #1 \l_@@_image_attr_tl _urx__dim }
-        \dim_set_eq:Nc \l__image_ury_dim
-          { c__image_ #1 \l_@@_image_attr_tl _ury__dim }
+        \dim_set_eq:Nc \l__image_ht_dim
+          { c__image_ #1 \l_@@_image_attr_tl _ht_dim }
+        \dim_set_eq:Nc \l__image_wd_dim
+          { c__image_ #1 \l_@@_image_attr_tl _wd_dim }
       }
       { \@@_image_getbb_auxii:n {#1} }
   }
@@ -757,14 +757,14 @@
       {#1}
     \hbox_set:Nn \l__image_tmp_box
       { \pdftex_pdfrefximage:D \pdftex_pdflastximage:D }
-    \dim_set:Nn \l__image_urx_dim { \box_wd:N \l__image_tmp_box }
-    \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box }
+    \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box }
+    \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box }
     \int_const:cn { c__image_ #1 \l_@@_image_attr_tl _int }
       { \tex_the:D \pdftex_pdflastximage:D }
-    \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _urx__dim }
-      { \l__image_urx_dim }
-    \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _ury__dim }
-      { \l__image_ury_dim }
+    \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _ht_dim }
+      { \l__image_ht_dim }
+    \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _wd_dim }
+      { \l__image_wd_dim }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1112,22 +1112,22 @@
 \cs_generate_variant:Nn \@@_image_getbb_auxiv:nnNnn { V }
 \cs_new_protected:Npn \@@_image_getbb_auxv:nNnn #1#2#3#4
   {
-    \dim_if_exist:cTF { c__image_ #1#3 _urx_dim }
+    \dim_if_exist:cTF { c__image_ #1#3 _ht_dim }
       {
-        \dim_set_eq:Nc \l__image_urx_dim { c__image_ #1#3 _urx__dim }
-        \dim_set_eq:Nc \l__image_ury_dim { c__image_ #1#3 _ury__dim }
+        \dim_set_eq:Nc \l__image_ht_dim { c__image_ #1#3 _ht_dim }
+        \dim_set_eq:Nc \l__image_wd_dim { c__image_ #1#3 _wd_dim }
       }
       { \@@_image_getbb_auxvi:nNnn {#1} #2 {#3} {#4} }
   }
 \cs_new_protected:Npn \@@_image_getbb_auxvi:nNnn #1#2#3#4
   {
     \hbox_set:Nn \l__image_tmp_box { #2 #1 ~ #4 }
-    \dim_set:Nn \l__image_urx_dim { \box_wd:N \l__image_tmp_box }
-    \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box }
-    \dim_const:cn { c__image_ #1#3 _urx__dim }
-      { \l__image_urx_dim }
-    \dim_const:cn { c__image_ #1#3 _ury__dim }
-      { \l__image_ury_dim }
+    \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box }
+    \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box }
+    \dim_const:cn { c__image_ #1#3 _ht__dim }
+      { \l__image_ht_dim }
+    \dim_const:cn { c__image_ #1#3 _wd__dim }
+      { \l__image_wd_dim }
   }
 \cs_new:Npn \@@_image_getbb_pagebox:w #1 box {#1}
 %    \end{macrocode}
diff --git a/l3trial/l3image/l3image.dtx b/l3trial/l3image/l3image.dtx
index 7186b55..f551a45 100644
--- a/l3trial/l3image/l3image.dtx
+++ b/l3trial/l3image/l3image.dtx
@@ -82,15 +82,12 @@
 %   specifications.
 % \end{variable}
 %
-% \begin{variable}[int]
-%   {
-%     \l__image_llx_dim, \l__image_lly_dim ,
-%     \l__image_urx_dim, \l__image_ury_dim
-%   }
-%   Dimensions holding the bounding box of the image file: |ll| = lower left,
-%   |ur| = upper right, |x| and |y| for horizontal and vertical, respectively.
+% \begin{variable}[int]{\l__image_ht_dim, \l__image_wd_dim}
+%   Dimensions holding the height and width of the image file.
 %   These values may be extracted/read from the image files themselves
-%   (see \cs{__image_extract_bb:n} and \cs{__image_read_bb:n}).
+%   (see \cs{__image_extract_bb:n} and \cs{__image_read_bb:n}).  Note that
+%   image files have no depth: they are always included such that the reference
+%   point is at $(0,0)$.
 % \end{variable}
 %
 % \begin{function}{\__image_extract_bb:n}
@@ -98,12 +95,8 @@
 %     \cs{__image_extract_bb:n} \meta{file}
 %   \end{syntax}
 %   Extracts bounding box data for the image \meta{file} using the |extractbb|
-%   utility, and stores the returned information in the dimensions
-%   \cs{l__image_llx_dim}, \emph{etc.} The boolean \cs{l__image_bb_found_bool}
-%   is set |true| on successful determination of a bounding box. In the case
-%   where no data is obtained, this variable is |false| and the four dimensions
-%   are set to place holders: |llx|/|lly| to $0\,\mathrm{bp}$ and |urx|/|ury| to
-%   $72\,\mathrm{bp}$.
+%   utility, and stores the size of the image file in \cs{l__image_ht_dim} and
+%   \cs{l__image_wd_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
@@ -134,13 +127,8 @@
 %   \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
-%   four values are used to set the dimensions \cs{l__image_llx_dim},
-%   \emph{etc.} The data format searched for depends on the option |hiresbb|.
-%   The boolean \cs{l__image_bb_found_bool} is set |true| on successful
-%   determination of a bounding box. In the
-%   case where no data is obtained, this variable is |false| and the
-%   four dimensions are set to place holders: |llx|/|lly| to $0\,\mathrm{bp}$
-%   and |urx|/|ury| to $72\,\mathrm{bp}$.
+%   values are used to set the variables \cs{l__image_ht_dim} and
+%   \cs{l__image_wd_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
@@ -199,17 +187,11 @@
 %
 % \subsection{Obtaining bounding box data}
 %
-% \begin{variable}[int]
-%   {
-%     \l__image_llx_dim , \l__image_lly_dim ,
-%     \l__image_urx_dim , \l__image_ury_dim
-%   }
+% \begin{variable}[int]{\l__image_ht_dim , \l__image_wd_dim}
 %   Storage for the return of results.
 %    \begin{macrocode}
-\dim_new:N \l__image_llx_dim
-\dim_new:N \l__image_lly_dim
-\dim_new:N \l__image_urx_dim
-\dim_new:N \l__image_ury_dim
+\dim_new:N \l__image_ht_dim
+\dim_new:N \l__image_wd_dim
 %    \end{macrocode}
 % \end{variable}
 %
@@ -275,12 +257,10 @@
 %   \begin{macrocode}
 \cs_new_protected:Npx \@@_read_bb_auxi:nnnn #1#2#3#4
   {
-    \dim_if_exist:cTF { c_@@_ #1#2 _llx_dim }
+    \dim_if_exist:cTF { c_@@_ #1#2 _ht_dim }
       {
-        \dim_set_eq:Nc \l__image_llx_dim { c_@@_ #1#2 _llx_dim }
-        \dim_set_eq:Nc \l__image_lly_dim { c_@@_ #1#2 _lly_dim }
-        \dim_set_eq:Nc \l__image_urx_dim { c_@@_ #1#2 _urx_dim }
-        \dim_set_eq:Nc \l__image_ury_dim { c_@@_ #1#2 _ury_dim }
+        \dim_set_eq:Nc \l__image_ht_dim { c_@@_ #1#2 _ht_dim }
+        \dim_set_eq:Nc \l__image_wd_dim { c_@@_ #1#2 _wd_dim }
       }
       { \@@_read_bb_auxii:nnn {#3} {#4} {#1} {#2} }
   }
@@ -297,10 +277,8 @@
           }
       }
     \ior_close:N \exp_not:N \l_@@_tmp_ior
-    \dim_const:cn { c_@@_ #3#4 _llx_dim } { \l__image_llx_dim }
-    \dim_const:cn { c_@@_ #3#4 _lly_dim } { \l__image_lly_dim }
-    \dim_const:cn { c_@@_ #3#4 _urx_dim } { \l__image_urx_dim }
-    \dim_const:cn { c_@@_ #3#4 _ury_dim } { \l__image_ury_dim }
+    \dim_const:cn { c_@@_ #3#4 _ht_dim } { \l__image_ht_dim }
+    \dim_const:cn { c_@@_ #3#4 _wd_dim } { \l__image_wd_dim }
   }
 \use:x
   {
@@ -340,10 +318,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_read_bb_auxv:w #1~#2~#3~#4~#5 \q_stop
   {
-    \dim_set:Nn \l__image_llx_dim { #1 bp }
-    \dim_set:Nn \l__image_lly_dim { #2 bp }
-    \dim_set:Nn \l__image_urx_dim { #3 bp }
-    \dim_set:Nn \l__image_ury_dim { #4 bp }
+    \dim_set:Nn \l__image_ht_dim { #4 bp - #2 bp }
+    \dim_set:Nn \l__image_wd_dim { #3 bp - #1 bp }
     \ior_map_break:
   }
 %    \end{macrocode}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list