PDA

View Full Version : Font Selection Advice for GUI Linux supporting different resolutions.



nbkhwjm
19th December 2008, 06:08
I have an application that looks perfect on my development system, which is a laptop with screen resolution of 1024x768, running ubuntu 8.04. If i run my application on a system with the same resolution it looks fine

When i run it on a system with something like 1600x1200 resolution again ubuntu 8.04, the fonts look MASSIVE, way too large.

I felt this was a font selection issue, so i made sure i selected a font that would be on most systems "Helvetica". I since have seen that the proper font is being chosen, although it obviously doesnt look like it.

in main.cpp i have this to check.



QFont font( "Helvetica", 10 );
app.setFont( font );

QFontInfo info(font);
QString family = info.family();
qDebug() << "FONT:" << family;
qDebug( "Font size requested is : %d", font.pointSize() );
qDebug( "Font size actually used is: %d", info.pointSize() );


On my development system i get this in the console:
FONT: "Helvetica"
Font size requested is : 10
Font size actually used is: 11

on the other system (the one with the 1600x1200 screen resolution) I get this:
FONT: "Helvetica"
Font size requested is : 10
Font size actually used is: 9

So they should both be comparable, but they are not.

Any advice is appreciated, thanks

QT version 4.4.1

wysota
19th December 2008, 08:18
It is best not to select any font at all and let Qt use the default font (at least the font size). The effect you are getting seems to be caused by not applying layouts to your widgets.

nbkhwjm
19th December 2008, 21:49
not attempting to define the font does give better results, but it still isnt very pretty.

How do i go about setting BOLD and such, stylesheets instead of the designer "font" parameter?

wysota
20th December 2008, 00:12
You can set the bold parameter of the font. Just don't set the family. And please apply layouts to your widgets.