[Development] Qt5 subpixel rendering differs from Qt4
Stanislav Baiduzhyi
baiduzhyi.devel at gmail.com
Mon Nov 10 12:04:27 CET 2014
Hi All,
Have anyone noticed that Qt5 subpixel font rendering is different from Qt4?
It is barely noticeable on cheaper TN-film LCD monitors, but it is very
obvious on more expensive ones, especially on high DPI, like 13" FullHD
zenbook with 169ppi.
I was trying to dig it up, but haven't found the reason. I hope someone
will be interested in it and will share some insights.
Here's what I found:
https://drive.google.com/open?id=0B5Kp-cB1sXJrTGJCTWE1VEQzM1U&authuser=0
Top is Qt 4.8.6 built from source tarball, bottom is 5.4.0git built 2 days
ago.
As you can see on the screenshot, they are pixel-to-pixel match, but Qt5 is
more transparent, which does not give enough contrast on zenbook monitor in
comparison to Qt4.
Here's what I found, most of it is in QFontEngineFT::loadGlyph:
1. FT_Load_Glyph arguments match perfectly from Qt4 to Qt5.
2. FT_Set_Transform arguments are identical for Qt4 and Qt5.
3. Qt5 exits early if fetchMetricsOnly == true, but changing that has no
effect on rendering.
4. FT_Library_SetLcdFilter is identical for Qt4 and Qt5, what you see on
the screenshot is FT_LCD_FILTER_DEFAULT (I have screenshots with other
filters, they are really different).
5. FT_Render_Glyph is identical for Qt4 and Qt5, both of them have
FT_RENDER_MODE_LCD.
5. convertRGBToARGB method did not change at all from Qt4 to Qt5. I
modified that method to print values right after freetype FT_Render_Glyph,
to make sure that freetype image is different, and not some issue higher in
Qt stack, and you can see the slot->bitmap.buffer image in hex at the end
of the message.
There is small application I wrote almost 4 years ago to teach myself
freetype, I was using it for experimenting, and I was not able to achieve
rendering similar to Qt5 with direct freetype no matter what flags I use:
https://github.com/Helbrass/openjdk-fontfix/tree/master/demo/freetype
So, if anyone can throw some suggestion or give me a direction, I will be
happy to dig more into this issue and hopefully contribute something
useful, as right now developing in Qt Creator is not as enjoyable for me as
it was in Qt4 days because of hard-to-read fonts.
===== Qt4, letter 'T' image buffer in hex:
0 7 2a 79 c7 eb f2 f2 f3 f8 ff ff ff ff f7 f3 f2 f2 e8 bb 63 1e 4 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 b 3c 9e e4 d9 85 2e 7 0 0 0 0 0 0 0 0 0
===== Qt5, letter 'T' image buffer in hex:
0 6 28 74 c4 ea f2 f2 f3 f8 ff ff ff ff f7 f3 f2 f2 e8 bd 67 20 4 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 a 39 99 e1 db 8b 31 8 0 0 0 0 0 0 0 0 0
--
Regards,
Stas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20141110/a094f3fe/attachment.html>
More information about the Development
mailing list