[wxPython-users] Font Size differences between platforms
Harald Stürzebecher
harald.stuerzebecher at gmail.com
Sat Mar 24 19:22:33 PDT 2007
2007/3/24, Paul McNett <p at ulmcnett.com>:
> Dj Gilcrease wrote:
> > On 3/24/07, Paul McNett <p at ulmcnett.com> wrote:
> >> I played with Mac's anti-aliasing settings which made no visual
> >> difference. Anyway, is there supposed to be a 1:1 correlation between
> >> pixels and points (I didn't think so)?
> >
> > No 1pt is 1/72 of an inch, so if your screen resolution is 96dpi
> > (Fairly standard now) an 8pt font should be 11 px high (10.7
> > actually), a 12pt font would be 16 px high etc (pt/.75)
>
> Thanks for the clarification and reminder of how this stuff relates!
>
>
[...]
>
> On Windows, I get:
> 13
> 16
> 19
> 23
>
> On Ubuntu:
> 13
> 17
> 19
> 23
>
> On OS X:
> 9
> 12
> 15
> 17
>
> So, your guess is correct. Any ideas on how to solve this cross-platform
> problem in a general way?
Get the default values from the window manager?
I'm not sure how to do that (google points to "defaultGuiFont =
wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
") but I think it is the only user-friendly way to handle the situation.
Any default set by the programmer might be totally wrong:
- small font on high resolution screen -> unreadable
- big font on small screen -> OK button unreachable below visible area
I already had to deal with both cases, didn't like it at all. ;-)
If it is impossible to get a default font size from the window manager
it might be possible to adjust the values depending on screen
resolution (GetDisplaySize, GetDisplaySizeMM). That would result in
the same size on all systems without adding special code for OS X.
On at least one of my Linux boxes it's possible to set the screen
resolution to 120 dpi in the KDE settings. As these settings are used
during program startup I managed to create two console windows with
the same font size setting and different font sizes on screen. Other
operating systems/window managers might support different screen
resolutions, too.
Harald Stürzebecher
More information about the wxpython-users
mailing list