forked from maestrith/AHK-Studio
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dlg Font.ahk
14 lines (14 loc) · 912 Bytes
/
Dlg Font.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Dlg_Font(ByRef Style,Effects=1,window=""){
VarSetCapacity(LOGFONT,60),strput(style.font,&logfont+28,32,"CP0"),LogPixels:=DllCall("GetDeviceCaps","uint",DllCall("GetDC","uint",0),"uint",90),Effects:=0x041+(Effects?0x100:0)
for a,b in font:={16:"bold",20:"italic",21:"underline",22:"strikeout"}
if style[b]
NumPut(b="bold"?700:1,logfont,a)
style.size?NumPut(Floor(style.size*logpixels/72),logfont,0):NumPut(16,LOGFONT,0),VarSetCapacity(CHOOSEFONT,60,0),NumPut(60,CHOOSEFONT,0),NumPut(&LOGFONT,CHOOSEFONT,12),NumPut(Effects,CHOOSEFONT,20),NumPut(style.color,CHOOSEFONT,24),NumPut(window,CHOOSEFONT,4)
if !r:=DllCall("comdlg32\ChooseFontA","uint",&CHOOSEFONT)
return
Color:=NumGet(CHOOSEFONT,24),bold:=NumGet(LOGFONT,16)>=700?1:0,style:={size:NumGet(CHOOSEFONT,16)//10,font:StrGet(&logfont+28,"CP0"),color:color}
for a,b in font
style[b]:=NumGet(LOGFONT,a,"UChar")?1:0
style["bold"]:=bold
return 1
}