ODT writer: calculate aspect ratio for percentage-sized images (#3478)
closes #3239
This commit is contained in:
parent
d1b50a6c5d
commit
d0fc2f1573
2 changed files with 2 additions and 4 deletions
|
@ -156,8 +156,8 @@ transformPicMath opts (Image attr@(id', cls, _) lab (src,t)) = catchError
|
|||
let dims =
|
||||
case (getDim Width, getDim Height) of
|
||||
(Just w, Just h) -> [("width", show w), ("height", show h)]
|
||||
(Just w@(Percent _), Nothing) -> [("width", show w), ("style:rel-height", "scale")]
|
||||
(Nothing, Just h@(Percent _)) -> [("style:rel-width", "scale"), ("height", show h)]
|
||||
(Just w@(Percent p), Nothing) -> [("width", show w), ("height", show (p / ratio) ++ "%")]
|
||||
(Nothing, Just h@(Percent p)) -> [("width", show (p * ratio) ++ "%"), ("height", show h)]
|
||||
(Just w@(Inch i), Nothing) -> [("width", show w), ("height", show (i / ratio) ++ "in")]
|
||||
(Nothing, Just h@(Inch i)) -> [("width", show (i * ratio) ++ "in"), ("height", show h)]
|
||||
_ -> [("width", show ptX ++ "pt"), ("height", show ptY ++ "pt")]
|
||||
|
|
|
@ -476,8 +476,6 @@ inlineToOpenDocument o ils
|
|||
let getDims [] = []
|
||||
getDims (("width", w) :xs) = ("svg:width", w) : getDims xs
|
||||
getDims (("height", h):xs) = ("svg:height", h) : getDims xs
|
||||
getDims (x@("style:rel-width", _) :xs) = x : getDims xs
|
||||
getDims (x@("style:rel-height", _):xs) = x : getDims xs
|
||||
getDims (_:xs) = getDims xs
|
||||
return $ inTags False "draw:frame"
|
||||
(("draw:name", "img" ++ show id') : getDims kvs) $
|
||||
|
|
Loading…
Reference in a new issue