From: Uwe Stöhr Date: Thu, 6 Dec 2007 22:09:31 +0000 (+0000) Subject: preamble.cpp: correct recognition of all cases of font scalings (fix for method intro... X-Git-Tag: 1.6.10~7028 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5cbb164e8978aa6fc23af8549e4f335057f17066;p=features.git preamble.cpp: correct recognition of all cases of font scalings (fix for method introduced in r21970) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21994 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index b2ad48c856..1b59214a74 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -18,6 +18,7 @@ #include "Layout.h" #include "Lexer.h" #include "TextClass.h" +#include "support/convert.h" #include "support/filetools.h" #include "support/lstrings.h" @@ -42,6 +43,7 @@ using std::find; using support::FileName; using support::libFileSearch; +using support::isStrDbl; // special columntypes extern std::map special_columns; @@ -218,8 +220,17 @@ void handle_package(string const & name, string const & opts) h_font_sans = name; if (!opts.empty()) { scale = opts; - pos = scale.find("."); - h_font_sf_scale = scale.erase(0, pos + 1); + // the option is in the form "scaled=0.9" + // therefore cut of before the "=" + pos = scale.find("="); + if (pos != string::npos) { + scale.erase(0, pos + 1); + if (isStrDbl(scale)) { + // LyX needs the scale as integer, therfore multiply by 100 + scale = convert(100 * convert(scale)); + h_font_sf_scale = scale; + } + } } } // typewriter fonts @@ -227,8 +238,17 @@ void handle_package(string const & name, string const & opts) h_font_typewriter = name; if (!opts.empty()) { scale = opts; - pos = scale.find("."); - h_font_tt_scale = scale.erase(0, pos + 1); + // the option is in the form "scaled=0.9" + // therefore cut of before the "=" + pos = scale.find("="); + if (pos != string::npos) { + scale.erase(0, pos + 1); + if (isStrDbl(scale)) { + // LyX needs the scale as integer, therfore multiply by 100 + scale = convert(100 * convert(scale)); + h_font_tt_scale = scale; + } + } } } // font uses old-style figure