Fix ascent()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5461 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-10-21 15:51:06 +00:00
parent e0660589c4
commit 5696dc3287
2 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2002-10-21 Dekel Tsur <dekelts@tau.ac.il>
* qfont_metrics.C (ascent): Fix returned value.
2002-10-21 Philippe Elie <phil.el@wanadoo.fr>
* QContentPane.h:

View File

@ -46,28 +46,28 @@ 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;
}
int lbearing(char c, LyXFont const & f)
{
lyxerr << "lb of " << c << " is " << metrics(f).leftBearing(c)
<< std::endl;
return metrics(f).leftBearing(c);
}