From efb34ae38c6dd91d1ba106d96aa93a05e028cdb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 16 Oct 2002 16:11:12 +0000 Subject: [PATCH] font_loader.C (font_info): correct calculation of font size t size) for qt. From Dekel and with small change by me. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5427 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 5 +++++ src/frontends/qt2/qfont_loader.C | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 82a40093ce..462204f302 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,8 @@ +2002-10-16 Lars Gullik Bjønnes + + * qfont_loader.C (font_info): correct calculation of font size + (point size) for qt. + 2002-10-15 Lars Gullik Bjønnes * QBrowseBox.C (QBrowseBox): transpose const char diff --git a/src/frontends/qt2/qfont_loader.C b/src/frontends/qt2/qfont_loader.C index 16ea5e8c74..2f61d67e1f 100644 --- a/src/frontends/qt2/qfont_loader.C +++ b/src/frontends/qt2/qfont_loader.C @@ -4,7 +4,7 @@ * Licence details can be found in the file COPYING. * * \author Asger Alstrup - * \author John Levon + * \author John Levon * * Full author contact details are available in file CREDITS */ @@ -25,9 +25,9 @@ #if QT_VERSION < 0x030000 #include "support/lstrings.h" #endif - + using std::endl; - + qfont_loader::qfont_loader() { } @@ -43,7 +43,7 @@ void qfont_loader::update() int i1,i2,i3,i4; // fuck this ! - + for (i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) { for (i2 = 0; i1 < 2; ++i2) { for (i3 = 0; i1 < 4; ++i3) { @@ -55,11 +55,11 @@ void qfont_loader::update() } } - + QFont const & qfont_loader::get(LyXFont const & f) { QFont const & ret(getfontinfo(f)->font); - + if (lyxerr.debugging(Debug::FONT)) { lyxerr[Debug::FONT] << "Font '" << f.stateText(0) << "' matched by\n" << ret.rawName().latin1() << endl; @@ -67,7 +67,7 @@ QFont const & qfont_loader::get(LyXFont const & f) return ret; } - + qfont_loader::font_info::font_info(LyXFont const & f) : metrics(font) { @@ -106,12 +106,12 @@ qfont_loader::font_info::font_info(LyXFont const & f) font.setFamily("courier"); break; } - - font.setPointSize(int((lyxrc.font_sizes[f.size()] * lyxrc.dpi * - (lyxrc.zoom / 100.0)) / 72.27 + 0.5)); - + + font.setPointSizeFloat(lyxrc.font_sizes[f.size()] + * lyxrc.zoom / 100.0); + // FIXME: lyxrc, check for failure etc. - + switch (f.series()) { case LyXFont::MEDIUM_SERIES: font.setWeight(QFont::Normal); @@ -120,7 +120,7 @@ qfont_loader::font_info::font_info(LyXFont const & f) font.setWeight(QFont::Bold); break; } - + switch (f.realShape()) { case LyXFont::ITALIC_SHAPE: case LyXFont::SLANTED_SHAPE: @@ -148,7 +148,7 @@ qfont_loader::font_info const * qfont_loader::getfontinfo(LyXFont const & f) } } - + bool qfont_loader::available(LyXFont const & f) { if (!lyxrc.use_gui)