Reputation: 2281
I'm facing a problem: I developed an app for Embedded Linux using Qt 4.8 where all the fonts are correct and fine. But when I compile the same app for Linux Ubuntu, all fonts become disorganized and ill-formed.
The be sure both had the same font configuration, I read the font configuration of one of the labels both in the Embedded compilation using QFont::toString()
and in the Ubuntu configuration and they were both equals (DejaVu Sans,20,-1,5,50,0,0,0,0,0
).
I also checked the default font configuration using the same function from QApplication::font()
and everything is the same.
Here is a picture of the correct version in Embedded Linux:
And here is the picture of labels with the same configuration:
The font values mentioned above are about the big title font in the top centre.
So what could be going on giving the fact I'm using the same Qt version (4.8), same OS (Linux, even tough one is Embedded for ARM and other is Ubuntu 14) and same font configuration in both? And how could I fix this so the Ubuntu fonts would like exactly like the Embedded Linux?
Upvotes: 0
Views: 597
Reputation: 3106
Install the same font. My guess is that DejaVu Sans is not installed on your Ubuntu system because of the ragged look of the text; Qt probably picked a substitute font.
Note that QFont::toString() only returns what you have set, not what is chosen by the underlying font system. Use QFontInfo to see what the 'real' font is:
The QFontInfo class provides the same access functions as QFont, e.g. family(), pointSize(), italic(), weight(), fixedPitch(), styleHint() etc. But whilst the QFont access functions return the values that were set, a QFontInfo object returns the values that apply to the font that will actually be used to draw the text.
Upvotes: 1