Font

This module can create font for in memory and return its handle that can be used with some Windows API’s.  It can also assign this font to the control, draw text on screen and measure it using DrawText with CALCRECT flag.

Summary
FontThis module can create font for in memory and return its handle that can be used with some Windows API’s.
FontCreates the font and optimally, sets it for the control.
DrawTextDraws text using specified font on device context or calculates width and height of the text.
About

Font

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

Creates the font and optimally, 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 font, pass its handle here.
BRedrawIf this parameter is TRUE, the control redraws itself.  By default FALSE.

Returns

Font handle.

DrawText

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

Draws text using specified font on 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, uses the system font to calculate text metrics.
FlagsDrawing/Calculating flags.  Space separated combination of flag names.
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

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

For the description of the flags see http://msdn.microsoft.com/en-us/library/ms901121.aspx.

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 = false)
Creates the font and optimally, sets it for the control.
Font_DrawText(Text,  
DC = "",
Font = "",
Flags = "",
Rect = "")
Draws text using specified font on device context or calculates width and height of the text.
Close