commit 47c52db13e2f58224d31a2e26a69320f1f5b16cf
Author: Richard Heck <[email protected]>
Date:   Sat Jul 30 21:57:52 2016 -0400

    Use scaling factor in XHTML output.
---
 src/insets/InsetGraphics.cpp |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 4619c61..4d850b5 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -962,10 +962,20 @@ docstring InsetGraphics::xhtml(XHTMLStream & xs, 
OutputParams const & op) const
        // really be better to do width and height conversion, rather than to 
output
        // these parameters here.
        string imgstyle;
-       if (!params().width.zero())
-               imgstyle += "width:" + params().width.asHTMLString() + ";";
-       if (!params().height.zero())
-               imgstyle += " height:" + params().height.asHTMLString() + ";";
+       bool const havewidth  = !params().width.zero();
+       bool const haveheight = !params().height.zero();
+       if (havewidth || haveheight) {
+               if (havewidth)
+                       imgstyle += "width:" + params().width.asHTMLString() + 
";";
+               if (haveheight)
+                       imgstyle += " height:" + params().height.asHTMLString() 
+ ";";
+       } else if (params().scale != "100") {
+               // Note that this will not have the same effect as in LaTeX 
export:
+               // There, the image will be scaled from its original size. 
Here, the
+               // percentage will be interpreted by the browser, and the image 
will
+               // be scaled to a percentage of the window size.
+               imgstyle = "width:" + params().scale + "%;";
+       }
        if (!imgstyle.empty())
                imgstyle = "style='" + imgstyle + "' ";
 

Reply via email to