mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-24 09:16:43 +00:00
Docx writer: support relative image widths.
Image widths given in percent are interpreted to be relative to the text width. This is similar to the way percent widths are handled in other writers, e.g. HTML and LaTeX. Previously, percent widths were taken relative to the image's native size.
This commit is contained in:
@@ -1345,8 +1345,10 @@ inlineToOpenXML' opts (Image attr@(imgident, _, _) alt (src, title)) = do
|
||||
(xpt,ypt) = desiredSizeInPoints opts attr
|
||||
(either (const def) id (imageSize opts img))
|
||||
-- 12700 emu = 1 pt
|
||||
(xemu,yemu) = fitToPage (xpt * 12700, ypt * 12700)
|
||||
(pageWidth * 12700)
|
||||
pageWidthPt = case dimension Width attr of
|
||||
Just (Percent a) -> pageWidth * (floor $ a * 127)
|
||||
_ -> pageWidth * 12700
|
||||
(xemu,yemu) = fitToPage (xpt * 12700, ypt * 12700) pageWidthPt
|
||||
cNvPicPr = mknode "pic:cNvPicPr" [] $
|
||||
mknode "a:picLocks" [("noChangeArrowheads","1")
|
||||
,("noChangeAspect","1")] ()
|
||||
|
||||
Reference in New Issue
Block a user