Hello,
is there a cross-platform way how to obtain real font size ? Currently all components has default size 0. But in real numbers it is usually 9 ~ 12 - depends on system setting. I would like to use smaller font, for example 2/3 of the default size. Is there something like: ?
Canvas.Font.Size := 2 * GetRealFontSize(Font.Size) div 3; (Of course there are many system setting for fonts. I'm interested in font-size of the most common components like TLabel). ?
Thanks.?
?
?
?
Mailing lists / lazarus / 2013-06
Real Font Size
7 messages · 3 people · –
- VVojtěch Čihák 3
- Zzeljko 3
- MMattias Gaertner 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Vojt?ch ?ih?k wrote 5 lines
There's no such function, but I guess that you can use LCLIntf.GetObject(MyControl.Font.Reference.Handle .....) and read lfHeight from there ?
zeljko
Show quoted text 10 lines
Problem is that the real font size requires the real font handle. We need some more flexible property to define the size relative to the default.
Mattias
There's no such function, but I guess that you can use…
Thanks, I tried:
?
uses ... LCLIntf, LCLType;?
?
var aLogFont: TLogFont;
begin
? ? LCLIntf.GetObject(Label1.Font.Reference.Handle, sizeof(TLogFont), @aLogFont); ? ? WriteLn(aLogFont.lfHeight); ??
?
but it doesn't work (returns -1 on Qt and 0 on GTK). lfFaceName works well, returns correctly "DejaVu Sans" for both Qt and GTK here.? ?
Vojt?ch?
______________________________________________________________
There's no such function, but I guess that you can use LCLIntf.GetObject(MyControl.Font.Reference.Handle .....) and read lfHeight from there ?
zeljko
Vojt?ch ?ih?k wrote 10 lines
hm .... this is from qtwinapi:
ALogFont^.lfHeight := AFont.getPixelSize;Qt returns pixelSize, but in case if it's -1 then getPointSize should be returned.
Pls open issue about this, I'll fix it.
Gtk2 returns only font name (other info isn't implemented) , so separate issue about this would be a "nice to have".
zeljko
Thanks, I tried: ? uses ... LCLIntf, LCLType;? ? var aLogFont: TLogFont; begin ? ?…
Vojt?ch ?ih?k wrote 10 lines
Qt is fixed and issue is resolved :)
z.
Thanks, I tested and closed.
______________________________________________________________
Od: "zeljko" Komu: "Vojt?ch ?ih?k" Datum: 17.06.2013 13:35 P?edm?t: Re: [Lazarus] Real Font Size
Qt is fixed and issue is resolved :)
z.
