[Interest] Font problem

Bo Thorsen bo at vikingsoft.eu
Tue Feb 17 10:45:38 CET 2015


Den 09-02-2015 kl. 22:31 skrev henning.carlsen at rosenkildeglas.dk:
> I have recently ported a QT4 on SUSELinux project into a QT5 Ubuntu.
>
> Most things are well but Boss complains that the text in fields and
> buttons are now exploding the frames.
>
> The font is newer set in the project, only sizes is set on widgets, so
> the default font is used.
>
> Investigating in the old project printing out the font() for a fields,
> reviles that “DejaVu Sans” is the font used.
>
> Even though I can’t find the font on the embedded disk running the system.
>
> On the QT5 the same font is still used but now being about 10-12% wider.
>
> Has the default font for QT been changed from QT4 to QT5 and how can I
> get hold on the original font used as default for QT4.

It sounds like you just need to change the font. As Lisandro mentioned, 
there are different fonts installed with different Linux distros, so 
this isn't an easy task.

If you really want to do this in a way that ensures a slim font, you 
have to write code to choose the proper font. Something like a list of 
font names to check, and a set of strings where you test the width of 
the printed string with each font until you find an acceptable font.

I hope this helps,

Bo Thorsen,
Director, Viking Software.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Interest mailing list