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

George Tasopoulos tasopoulos.yorghos at gmail.com
Mon Dec 30 19:05:06 CET 2013


It turns out that this was a standard DCF: Documentation Comprehension
Failure.

The problem was that I cleared each cell using drawRect() instead of
fillRect(). drawRect apparently adds a stroke on the *outside* of the
rectangle's bounds and so it overlapped with nearby cells.

Thanks for the info about DPI, I understand it a lot better now.

--
Yours sincerely,
George Tasopoulos


On 29 December 2013 20:56, George Tasopoulos
<tasopoulos.yorghos at gmail.com>wrote:

> (This message will probably not appear in the right place in the thread)
>
> > >* 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)?
> *
> >
> > Only if both computers have the same DPI for the screen and the same font
> > rendering engines. Do you even have the Liberation Mono font installed on both
> > systems?
>
> I didn't explain that well enough: I don't mind if the size in one system
> isn't the same as the size in another system, what I want is to make sure
> there are no gaps between two rows of characters.
> Currently, in my Windows system the height is reported to be 27 and the
> characters are (apparently) drawn to be 27 pixels high, which is good, but
> in my Linux system the height is reported to be 28 and the characters are
> (apparently) NOT 28 pixels high, which is a problem.
>
> The font is installed in both systems and I also did a binary comparison
> between their font files. They're identical.
>
>
> --
> Yours sincerely,
> George Tasopoulos
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131230/4e110a69/attachment.html>


More information about the Interest mailing list