From 5cbb164e8978aa6fc23af8549e4f335057f17066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Thu, 6 Dec 2007 22:09:31 +0000 Subject: [PATCH] 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 --- src/tex2lyx/preamble.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) 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