Merge pull request #6946 from mb21/icml-image-fit

ICML writer: fix image bounding box for custom widths/heights
This commit is contained in:
John MacFarlane 2020-12-12 08:28:14 -08:00 committed by GitHub
commit 3a7d97f02f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View file

@ -621,7 +621,12 @@ imageICML opts style attr (src, _) = do
image = inTags True "Image"
[("Self","ue6"), ("ItemTransform", scale<>" -"<>hw<>" -"<>hh)]
$ vcat [
inTags True "Properties" [] $ inTags True "Profile" [("type","string")] $ text "$ID/Embedded"
inTags True "Properties" [] $ vcat [
inTags True "Profile" [("type","string")] $ text "$ID/Embedded"
, selfClosingTag "GraphicBounds" [("Left","0"), ("Top","0")
, ("Right", showFl $ ow*ow / imgWidth)
, ("Bottom", showFl $ oh*oh / imgHeight)]
]
, selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", src')]
]
doc = inTags True "CharacterStyleRange" attrs

View file

@ -80,6 +80,7 @@
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="150" Bottom="150" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:lalune.jpg" />
</Image>

View file

@ -23,6 +23,7 @@
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:command/corrupt.svg" />
</Image>
@ -56,6 +57,7 @@
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:command/SVG_logo.svg" />
</Image>
@ -89,6 +91,7 @@
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:command/SVG_logo-without-xml-declaration.svg" />
</Image>
@ -122,6 +125,7 @@
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="109.5" Bottom="130.5" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:command/inkscape-cube.svg" />
</Image>

View file

@ -2800,6 +2800,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="150" Bottom="150" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:lalune.jpg" />
</Image>
@ -2836,6 +2837,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
<Profile type="string">
$ID/Embedded
</Profile>
<GraphicBounds Left="0" Top="0" Right="20" Bottom="22" />
</Properties>
<Link Self="ueb" LinkResourceURI="file:movie.jpg" />
</Image>