[Lazarus] Font sizes on various platforms
bruce at causal.com
Wed Jul 8 01:27:26 CEST 2009
Graeme Geldenhuys wrote:
> Also does that mean I need to apply the same font size hack as the guy
> in the CSS article.
> ifdef MacOS
> NormalFontSize = 13
> elseif Windows
> NormalFontSize = 8
> elseif Linux
> NormalFontSize = 10
> NormalFontSize = 8 // ??? What would be correct as a default?
> Label.Font.Size = NormalFontSize;
A solution similar to this is what I have adopted for cross-platform
font size compatibility.
However to avoid polluting the code too much I make almost universal use
of the ParentFont property (ie, assigned True) and assign the font at
the root of the visual hierarchy (usually the form) at runtime based on
the platform DPI. It works well when all your widgets use the same font.
On a related note, I asked this questions a while back but got no
Bruce Tulloch wrote:
> My apologies if I've missed the obvious somewhere but how is the default
> font used by the form designer specified?
> If a form is created with the ParentFont property set to TRUE, from
> where does it get its font spec when it is open in the form designer?
> And how do I change this font spec without having to define it
> explicitly for every form (or frame) I create?
> Thx, Bruce.
More information about the Lazarus