]> git.lyx.org Git - features.git/commitdiff
Fix scale parameter for fonts.
authorEnrico Forestieri <forenr@lyx.org>
Fri, 11 Jul 2014 14:12:08 +0000 (16:12 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 11 Jul 2014 14:12:08 +0000 (16:12 +0200)
When a font is scaled by a certain percentage in the document settings,
LyX was outputting a ridiculous parameter value. For example, if the
font is scaled 90%, the corresponding parameter was "scaled=0.899999976".
The patch avoids this and, in the previous case, one gets "scaled=0.9".
This is not only cosmetic, because in roundtrip conversions the parameter
would be continuosly changing.

This commit and b60b505f should be backported to the 2.1.x branch, where
reimporting with tex2lyx an exported document produces wrong results
(also in version 2.1.0).

src/LaTeXFonts.cpp

index 676179f5a5f7fa436e1ee808d54e92049ab761a8..9010615fcb4c19bf0307ef12e5c2795b46e0202b 100644 (file)
@@ -259,8 +259,9 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool
            && providesScale(ot1, complete, nomath)) {
                if (!os.str().empty())
                        os << ',';
-               os << subst(to_ascii(scaleoption_), "$$val",
-                           convert<std::string>(float(scale) / 100));
+               ostringstream value;
+               value << float(scale) / 100;
+               os << subst(to_ascii(scaleoption_), "$$val", value.str());
        }
        return os.str();
 }