When I code:
SetFont(wMain, "", 15, 500)
which font gets set?
It will be the default font that is used for windows. From what I can see in the window properties settings (when I right click my desktop, select properties, choose the appearance tab, and click the advanced button), it's the same font that is used for titlebars.
The SETFONT command uses the CreateFontIndirect API to set the font for the window/control.
The API, in turn, uses the contents of a LOGFONT structure.
The SETFONT command fills the LOGFONT structure based upon user input.
The font name, lfFaceName , is one of the LOGFONT elements.
QuotelfFaceName
A null-terminated string that specifies the typeface name of the font. The length of this string must not exceed 32 characters, including the terminating null character. The EnumFontFamiliesEx function can be used to enumerate the typeface names of all currently available fonts. If lfFaceName is an empty string, GDI uses the first font that matches the other specified attributes.
LarryMc
Good information.
Thanks.
If youhave changed the font and want to go back to the default system font you can use:
SENDMESSAGE(win,WM_SETFONT,0,TRUE)
Some code to play with:
$include "windowssdk.inc"
LOGFONT lf
uint hfont
window w1
OPENWINDOW w1,0,0,350,350,@MINBOX|@MAXBOX|@SIZE,NULL,"Simple Window",&main
CONTROL w1,@button,"QUIT",10,100,100,50,0,23
PRINT w1,"Hello World"
move w1,0,30
'setfont (w1,"tahoma", 20, 700,0,23)
hfont=sendmessage(w1,WM_GETFONT,0,0,23)
if hfont=0
hfont = GetStockObject(DEFAULT_GUI_FONT)
endif
getobject(hfont,len(LOGFONT),lf)
print w1,lf.lfFaceName
WAITUNTIL w1 = 0
END
SUB main(),int
select @MESSAGE
case @IDCREATE
centerwindow w1
case @IDCLOSEWINDOW
CLOSEWINDOW w1
endselect
RETURN 0
ENDSUB
LarryMc