GetTextWidthHeight

Prototype

Matrix GetTextWidthHeight( String sText, String sTypeface, int nStyle, int nSize, Matrix mWidth, Matrix mHeight )

Return Value

The return value is 1 on success or 0 on failure.

Parameters

String sText
Specifies the text to be measured.

String sTypeface
Specifies the typeface name of the font.

int nStyle
A predefined constant specifying the style of the font. The valid values are STYLE_REGULAR, STYLE_BOLD, STYLE_ITALIC, and STYLE_BOLDITALIC.

int nSize
Specifies the point size (units of 1/72 inch) of the font.

Matrix mWidth
Upon successful return, this matrix contains the width of the specified text formatted in the specified font at screen resolution.

Matrix mHeight
Upon successful return, this matrix contains the height of the specified text formatted in the specified font at screen resolution.

Remarks

This module calculates the dimensions of the specified text formatted in the specified font at screen resolution. This module is usually used in conjunction with the Plot.DrawText method.

Example
text = "Hello World";
ok = GetTextWidthHeight( text, "Arial", STYLE_REGULAR, 10, width, height );
if ok then
    print width height;
else
    print "Function failed";