Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
None
-
4.8.6, 5.5.0
-
None
-
CentOS 6.3 / gnome
Description
I am using Qt 4.8.6 on CentOS 6.3 with Gnome.
I am calling setPixelSize(13) on a QFont object. The QFont object is set on a QPainter and I am calling QPainter::DrawText in the paintEvent of a QWidget.
When counting the pixels of the height of the text displayed on screen, I end up with 12 pixels instead of 13.
Switching off anti-aliasing doesn't solve the issue.
I also tried different pixel sizes and the actual size in pixel doesn't always match :
pixel size : 14 ; actual size : 14 pixels
pixel size : 13 ; actual size : 12 pixels
pixel size : 12 ; actual size : 10 pixels
pixel size : 11 ; actual size : 10 pixels
When using a tool similar to Qt (Ilog Views/ Rogue Wave Views) and the same font and same size, the actual size on the screen matches with the pixel size.
Why doesn't the actual size match with the pixel size with Qt ?
Re-opening 07/11/2019 :
I am using .ttf fonts. The issue happens with every .tff font i tried (including classic windows fonts like Arial). In all these fonts, the characters are smaller than the "em square".
With setPixelSize(13), characters are also formed differently compared to setPixelSize(14). For example, the upper parts of "H" and "B" are smaller compared to the upper part with size 13. That is not the case with size 14. I added a screenshot of H and B letters with size 13.
I tried native and raster modes with -graphicssystem option and the result is the same for both.
Does Qt uses Freetype library to display true type fonts on Linux ? Could the issue come from Freetype library rather than Qt code itself ?