[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-cygwin
Subject: RE: LyX needs help: Broken font metrics computation
From: "Chris January" <chris () atomice ! net>
Date: 2005-01-05 9:29:55
Message-ID: 20050105093006.11005.qmail () ktown ! kde ! org
[Download RAW message or body]
> 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.top(), 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?
At a guess, Qt/X11 uses the bottom left of the character cell (or perhaps
baseline) as the origin and Qt/Win32 Free uses the top left of the character
cell. To find the height of the character, the procedure would be the same
on both platforms (bottom - top).
If you want the same pixel height on each platform be sure to use
Qfont.setPixelSize instead of Qfont.setPointSize.
Chris
_______________________________________________
kde-cygwin mailing list
kde-cygwin@kde.org
https://mail.kde.org/mailman/listinfo/kde-cygwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic