Getting the systems default font
Posted: Wed Mar 25, 2009 5:18 pm
I need to get the font name, size, style of the Window Style. So I can create the gadgets with the correct size
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
; window to test with
OpenWindow(0,0,0,320,240,"")
; get its font
wfont = SendMessage_(WindowID(0),#WM_GETFONT,0,0)
If Not wfont
wfont = GetStockObject_(#DEFAULT_GUI_FONT)
EndIf
; find size for longest string you want to use
tmp = CreateImage(#PB_Any, 1024, 100)
StartDrawing(ImageOutput(tmp))
DrawingFont(wfont)
Debug TextWidth("this is the longest string I will want to write")
Debug TextHeight("This is how tall it will be")
StopDrawing()
FreeImage(tmp)
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow