[Interest] Font measuring inconsistency between platforms in Qt5? Or, how best to draw characters with QPainter.

George Tasopoulos tasopoulos.yorghos at gmail.com
Sun Dec 29 18:44:56 CET 2013


Thanks for your reply.

This makes sense. But in this case shouldn't font drawing also draw at the
same size (i.e. 28 pixels high on Linux, 27 pixels high on Windows)?

--
Yours sincerely,
George Tasopoulos


On 29 December 2013 17:36, Christoph Feck <christoph at maxiom.de> wrote:

> On Sunday 29 December 2013 18:16:29 George Tasopoulos wrote:
> > QFont font("Liberation Mono", 18, QFont::Normal, false);
> > QFontMetrics metrics(font);
> > int x = metrics.height();
> >
> > On Windows x equals 27, which seems to be the correct value, but on
> > Linux it equals 28.
>
> The (pixel) height of the font is determined by DPI of the display, so
> it is correct that on different systems you get different results for
> the font metrics. After all, that's the reason the QFontMetrics class
> is provided, so that you can adapt to the resulting metrics.
>
> --
> Christoph Feck
> http://kdepepo.wordpress.com/
> KDE Quality Team
> openSUSE Review Team
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131229/ab605847/attachment.html>


More information about the Interest mailing list