In qfont_metrics.C, ascent/descent always return a positive value, which is
obviously wrong (this has a visual effect: write x' in mathed and the space
to the next line increases).
Reading the QT documentation, I made a patch that fixes this.
Index: qfont_metrics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/qfont_metrics.C,v
retrieving revision 1.16
diff -u -p -r1.16 qfont_metrics.C
--- qfont_metrics.C     20 Oct 2002 14:27:28 -0000      1.16
+++ qfont_metrics.C     21 Oct 2002 15:15:18 -0000
@@ -46,21 +46,23 @@ int maxAscent(LyXFont const & f)
 
 int maxDescent(LyXFont const & f)
 {
-       return metrics(f).descent();
+       return metrics(f).descent()+1;
+       // We add 1 as the value returned by QT is different than X
+       // See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
 }
 
 
 int ascent(char c, LyXFont const & f)
 {
        QRect r = metrics(f).boundingRect(c);
-       return abs(r.top());
+       return -r.top();
 }
 
 
 int descent(char c, LyXFont const & f)
 {
        QRect r = metrics(f).boundingRect(c);
-       return abs(r.bottom());
+       return r.bottom()+1;
 }
 
 


Reply via email to