]> git.lyx.org Git - features.git/commitdiff
fix font metrics with Qt/Win 3.2.1nc
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 7 Jan 2005 15:29:45 +0000 (15:29 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 7 Jan 2005 15:29:45 +0000 (15:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9455 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/qfont_metrics.C

index 0176107e67805f08a50202355a8434ab31873b5c..d2f582536640a409dedc4bacbfc7cede7b2ba67a 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-07  Ruurd Reitsma  <rareitsma@yahoo.com>
+
+       * qfont_metrics.C (ascent, descent): correct the metrics returned
+       by Qt/Win 3.2.1 non-commercial edition.
+
 2005-01-06  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * QDocument.C:
index 6c5a7e99692e93e663acaba6e079a575aa65d419..95bf5798570aca5fe539d8453eb0375c8faaa455 100644 (file)
@@ -65,7 +65,14 @@ int ascent(char c, LyXFont const & f)
        if (!lyx_gui::use_gui)
                return 1;
        QRect const & r = metrics(f).boundingRect(c);
+       // Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
+       // value by the height: (x, -y-height, width, height). 
+       // Other versions return: (x, -y, width, height)
+#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
+       return -(r.top() + r.height());
+#else
        return -r.top();
+#endif
 }
 
 
@@ -74,7 +81,14 @@ int descent(char c, LyXFont const & f)
        if (!lyx_gui::use_gui)
                return 1;
        QRect const & r = metrics(f).boundingRect(c);
-       return r.bottom()+1;
+       // Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
+       // value by the height: (x, -y-height, width, height). 
+       // Other versions return: (x, -y, width, height)
+#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
+       return r.bottom() + r.height() + 1;
+#else
+       return r.bottom() + 1;
+#endif
 }