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
This commit is contained in:
Uwe Stöhr 2007-12-06 22:09:31 +00:00
parent 3fa9187e7c
commit 5cbb164e89

View File

@ -18,6 +18,7 @@
#include "Layout.h" #include "Layout.h"
#include "Lexer.h" #include "Lexer.h"
#include "TextClass.h" #include "TextClass.h"
#include "support/convert.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -42,6 +43,7 @@ using std::find;
using support::FileName; using support::FileName;
using support::libFileSearch; using support::libFileSearch;
using support::isStrDbl;
// special columntypes // special columntypes
extern std::map<char, int> special_columns; extern std::map<char, int> special_columns;
@ -218,8 +220,17 @@ void handle_package(string const & name, string const & opts)
h_font_sans = name; h_font_sans = name;
if (!opts.empty()) { if (!opts.empty()) {
scale = opts; scale = opts;
pos = scale.find("."); // the option is in the form "scaled=0.9"
h_font_sf_scale = scale.erase(0, pos + 1); // 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<string>(100 * convert<double>(scale));
h_font_sf_scale = scale;
}
}
} }
} }
// typewriter fonts // typewriter fonts
@ -227,8 +238,17 @@ void handle_package(string const & name, string const & opts)
h_font_typewriter = name; h_font_typewriter = name;
if (!opts.empty()) { if (!opts.empty()) {
scale = opts; scale = opts;
pos = scale.find("."); // the option is in the form "scaled=0.9"
h_font_tt_scale = scale.erase(0, pos + 1); // 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<string>(100 * convert<double>(scale));
h_font_tt_scale = scale;
}
}
} }
} }
// font uses old-style figure // font uses old-style figure