Font

Font functions.

Summary
FontFont functions.
FontCreates the font and optionally sets it for the control.
DrawTextDraws text using specified font on a device context or calculates width and height of the text.
About

Font

Font(HCtrl = "",
Font = "",
BRedraw = 1)

Creates the font and optionally sets it for the control.

Parameters

hCtrlHandle of the control.  If omitted, function will create font and return its handle.
FontAHK font definition (“s10 italic, Courier New”).  If you already have created the font, pass its handle here.
BRedrawIf this parameter is TRUE, the control redraws itself (default).

Returns

Font handle.

DrawText

Font_DrawText(Text,  
DC = "",
Font = "",
Flags = "",
Rect = "")

Draws text using specified font on a device context or calculates width and height of the text.

Parameters

TextText to be drawn or measured.
DCDevice context to use.  If omitted, function will use Desktop’s DC.
FontIf string, font description in AHK syntax.  If number, font handle.  If omitted, function will use the system font to calculate text metrics.
FlagsDrawing/Calculating flags.  Space separated combination of flag names.  For the description of the flags see http://msdn.microsoft.com/en-us/library/ms901121.aspx.
RectBounding rectangle.  Space separated list of left,top,right,bottom coordinates.  Width could also be used with CALCRECT WORDBREAK style to calculate word-wrapped height of the text given its width.

Flags

CALCRECT, BOTTOM, CALCRECT, CENTER, VCENTER, TABSTOP, SINGLELINE, RIGHT, NOPREFIX, NOCLIP, INTERNAL, EXPANDTABS, AHKSIZE.

Returns

Decimal number.  Width “.”  Height of text.  If AHKSIZE flag is set, the size will be returned as w%w% h%h%

About

Font(HCtrl = "",
Font = "",
BRedraw = 1)
Creates the font and optionally sets it for the control.
Font_DrawText(Text,  
DC = "",
Font = "",
Flags = "",
Rect = "")
Draws text using specified font on a device context or calculates width and height of the text.
Close