4.8.3 - Fonts rendering problem
Here is a screenshot of the problem i am having in my ui pages.
"Screenshot grabbed from target device":http://s27.postimg.org/epxrcn8mb/test.png
environment: Qt for Embedded 4.8.3 on Yocto, using QWS.
I set font properties via Qt Designer as described in attached screenshot. However the results on my target device are messed up like this:
- Antialiasing is arbitrary applied completely ignoring font preferences and instructions contained in fonts.
- Kerning preferences are ignored
- Fonts at 12pt size is exactly the same to 11pt size.
Any idea of why?
Hi and welcome to devnet,
Are you providing the same fonts in your target device ?
Yes. I put those fonts in the right place on the target and they are in truetype format. I also removed every other font to ensure system was using the right ones.
Did you check that you really get the font you are asking for ?
As I told I removed every other font in any format in the whole system; also, if I remove the three .ttf files in my fontdir i only get squares instead of glyphs, so I am pretty sure Qt is getting the fonts I am asking.
Being sure and checking are two different things, please verify that the font you get really is configured the way you asked them.
Also, you should try running the latest version, currently 4.8.6
I'm using a 4.8.6 version on x86_64.
In Qt for Embedded on QWS, I also had problems about ttf rendering for produce a clear text on a LCD.
- font hinting:
in QFontEngineFT constructor, by default hinting is disabled and I dont't find a way to change default_hint_style property in my application to activate it on a single font.
My hack is to apply a patch on Qt sources and change default_hint_style directly in the QFontEngineFT constructor putting my preferred hint_style value, but by this way I be good to apply the hint strategy to all fonts on my application and not on a single one.
diff -Naur qt-everywhere-opensource-src-4.8.6_orig/src/gui/text/qfontengine_ft.cpp qt-everywhere-opensource-src-4.8.6/src/gui/text/qfontengine_ft.cpp
--- qt-everywhere-opensource-src-4.8.6_orig/src/gui/text/qfontengine_ft.cpp 2014-09-09 16:25:54.055186643 +0200
+++ qt-everywhere-opensource-src-4.8.6/src/gui/text/qfontengine_ft.cpp 2014-09-09 16:13:44.055175077 +0200
antialias = true;
freetype = 0;
default_load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
- default_hint_style = HintNone;
- default_hint_style = HintFull;
subpixelType = Subpixel_None;
lcdFilterType = 0;
Is there a way to make it in the application?
antialiasing and ttf font cache:
when output a text, Qt4e caches all rendered fonts to have it ready for the future.
In Font cache are stored all single characters indexing by his characteristics (font name, size, style...), but qws not make difference about font with antialiasing and font without antialiasing.
This means that if application activate antialising property on a text to print "Hello", Qt cache all "Hello" characters rendered with antialiasing. For the future use of the same character with the same font carachteristic, Qt will provide always this character to display with antialiasing.
Is possible also to output a mixed string (any character with antialiasing and any other no).
For example, after output antialiased "Hello", if I want to output another similar string like "Hero" but with no antialiasing, the result will be a mixed string with "He" displayed with cached antialising, "r" without antialiasing and "o" with cached antialiasing.
I also see that font size 11pt and 12pt are exactly the same
- font hinting: