[latex3-commits] [git/LaTeX3-latex3-xxetex] main: more image scale options (3c56f3d)

David Carlisle d.p.carlisle at gmail.com
Sat Jan 28 20:21:17 CET 2023


Repository : https://github.com/latex3/xxetex
On branch  : main
Link       : https://github.com/latex3/xxetex/commit/3c56f3dfdb88e60fcd11c222ad2453cdbb713a28

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

commit 3c56f3dfdb88e60fcd11c222ad2453cdbb713a28
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sat Jan 28 19:21:17 2023 +0000

    more image scale options


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

3c56f3dfdb88e60fcd11c222ad2453cdbb713a28
 examples/test-pic1.tex |  7 +++++--
 xxetex.lua             | 22 +++++++++++++++++++---
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/examples/test-pic1.tex b/examples/test-pic1.tex
index e05c81c..0040b41 100644
--- a/examples/test-pic1.tex
+++ b/examples/test-pic1.tex
@@ -10,12 +10,15 @@
 \begin{document}
 
 
-1: [\XeTeXpicfile example-image.png ]
+0: [\XeTeXpicfile example-image.png ]
 
+1: [\XeTeXpicfile example-image.png  scaled 500 ]
 
-2: [\XeTeXpicfile example-image.png  scaled 500 ]
+2: [\XeTeXpicfile example-image.png  scaled 250 ]
 
 
+\clearpage
+
 3: [\XeTeXpicfile example-image.png  width 3cm ]
 
 
diff --git a/xxetex.lua b/xxetex.lua
index a173435..be1d96a 100644
--- a/xxetex.lua
+++ b/xxetex.lua
@@ -208,15 +208,31 @@ local t=img.scan{filename=filename}
 --t.filename =  token.scan_string()
 local scan=false
 -- ignore key order for now
+for i,v in pairs(img.fields()) do
+print (i .. ": " .. v .. "=" .. (t[v] or "?"))
+end
 repeat
   scan=false
   token.scan_keyword(' ')
-  local scale=1
   if token.scan_keyword('scaled') then
+    scan=true
+    scale=  0.001*token.scan_int()
+    print("xs: " .. scale .. " * " .. t.xsize.. " * " .. t.xres)
+    -- 65000???
+    t.width=scale*t.xsize  * 65000
+    t.height=scale*t.ysize  * 65000
+  end
+  token.scan_keyword(' ')
+  if token.scan_keyword('xscaled') then
+    scan=true
+    scale=  0.001*token.scan_int()
+    t.width=scale*t.xsize * 65000
+  end
+  token.scan_keyword(' ')
+  if token.scan_keyword('yscaled') then
     scan=true
     scale=  0.0001*token.scan_int()
-    -- t.width=scale*t.xsize
-    -- t.height=scale*t.ysize
+    -- t.height=scale*t.ysize * 65000
   end
   token.scan_keyword(' ')
   if token.scan_keyword('width') then





More information about the latex3-commits mailing list.