- get pixel width of text

Low-level graphics
(AFL 2.80)

SYNTAX GfxGetTextWidth(''text'')
FUNCTION The function returns pixel width of specified string. NOTE: it is slow because it has to create temporary DC and font to measure the text. It takes 40us (microseconds), that is about 40 times more than other Gfx functions.
EXAMPLE GfxSetZOrder(5 );
GfxSelectFont("Tahoma", 30 );
GfxSetTextColor( colorWhite );
text = "This is a test";
GfxTextOut(text, 0, 50);
GfxSetTextColor( colorRed );
GfxTextOut("second part in red", GfxGetTextWidth(text), 50 );
SEE ALSO GfxTextOut() function


The GfxGetTextWidth function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference