PDA

View Full Version : Large fonts on Linux and Solaris



doggrant
16th October 2009, 11:13
Hi All,

My app, which runs on Windows, Linux and Solaris, has normal size fonts in Windows, but the fonts in Linux and Solaris are too big.

On my development system, I run qtconfig and reduce the size of the fonts to a more acceptable level.

However, when deploying the software, what should I do? Since customers will not be able to make this change, unless I deploy qtconfig with my app.

Any ideas?

I'm wondering whether this is a way of embedding the fonts into the app, or something like that. I've had a search around this subject, but now found anything yet.

cheers,

David

high_flyer
16th October 2009, 11:23
Hi David,

I am not sure if this may help you, since I never had to deal with it my self, but, I think if you work with point size and not pixel size you can have a better control of how the fonts will look on any given display, since you the size is then defined by the dpi of the screen, so it should offer you some platform independence with the font size.
Have a look in the QFont documentation text.

doggrant
16th October 2009, 16:12
Hey High_Flyer,

Thanks for pointing me towards the settings in QFont. I've put the following code at the start of my app :-



QApplication app(argc, argv);

// Set the font size for solaris and linux
int DefaultFontSize = 0;

#ifdef __linux__
DefaultFontSize = 8;
#else if __sun
DefaultFontSize = 11;
#endif

// There is no need to set the font size on Windows
#ifndef WIN32
QFont AppFont = app.font();
AppFont.setPointSize(DefaultFontSize);
app.setFont(AppFont);
#endif


This sets the size of the font on linux and solaris at 8pt and 11pt, which on my system look the size i want. I'm going to test on other systems, but it looks like this does exactly what I want :)

David

high_flyer
16th October 2009, 16:14
Great!
Hope this solved your problem. :)