summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-odtimagesize.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/domfilters/make4ht-odtimagesize.lua')
-rw-r--r--Master/texmf-dist/scripts/make4ht/domfilters/make4ht-odtimagesize.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-odtimagesize.lua b/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-odtimagesize.lua
new file mode 100644
index 00000000000..92ce68dee4c
--- /dev/null
+++ b/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-odtimagesize.lua
@@ -0,0 +1,16 @@
+-- set correct dimensions to frames around images
+return function(dom)
+ local frames = dom:query_selector("draw|frame")
+ for _, frame in ipairs(frames) do
+ local images = frame:query_selector("draw|image")
+ if #images > 0 then
+ local image = images[1]
+ local width = image:get_attribute("svg:width")
+ local height = image:get_attribute("svg:height")
+ frame:set_attribute("svg:width", width)
+ frame:set_attribute("svg:height", height)
+ print("image dimensions", width, height)
+ end
+ end
+ return dom
+end