[Interest] Achieving resolution independent font sizes with Qt

Nikos Chantziaras realnc at gmail.com
Fri Jun 7 15:57:20 CEST 2013

Is there an approach I can take to make the font sizes in applications 
independent of the current resolution?  For example, let's say I choose 
a font with a 12pt size, meaning setting it with 
QFont::setPointSize(10).  If the font is displayed while the monitor's 
resolution is 1920x1080, the font is rather small.  Now if I quit the 
application, switch the monitor to 640x480 (scaling-up but preserving 
the aspect ratio), the font is quite big.  As a side effect of this, 
even if my application is going fullscreen and always using a display 
area of a 4:3 ratio, only about half the text fits when the resolution 
is 640x480.

What would be a good way of making sure that a font looks the same size 
on screen regardless of resolution?  I'm on Linux, but I'm hoping 
there's a portable way to achieve that.

More information about the Interest mailing list