LyX needs help: Broken font metrics computation

Michael Schmitt michael.schmitt at
Tue Jan 4 20:13:32 CET 2005

Dear Ralf, Christian, and all others,

as you have already noticed, the LyX team is working on a native Win32 port 
of their text processor, using your GPL'd QT/Win32. Things have progressed 
nicely in the last couple of weeks and Qt/Win32 seems to work quite well.

However, we have a serious problem with the computation of font metrics. I 
have generated a small test case that illustrates the problem:

#include <qapplication.h>

int main(int argc, char **argv) {
  QApplication app(argc, argv);
  QFont f("times",18,QFont::Bold);
  QFontMetrics fm(f);
  QRect r = fm.boundingRect('x');
  printf( "top: %d   bottom: %d",, r.bottom());
  return 0;

If you compile and run this program with GPL'd Qt/Win32, it outputs

   top: 16  bottom:36

However, if you run exactly the same program with Qt/X11 on cygwin (or on 
Linux), you get the following output:

  top: -9  bottom: -1

Quite clear the numbers do not have to be identical but the fact that they 
are once negative and once positive breaks our neck.

So... do you have any idea what is wrong?

Thanks in advance,


More information about the kde-cygwin mailing list