Language:
Русский
English
TextWidth (function) (Graph unit)
Returns the width of a string in pixels.
Declaration
function TextWidth(TextString: string): Word;
Target
Real, Protected
Remarks
Takes the string length, current font size, and multiplication factor, and determines the width of TextString in pixels. This is useful for computing view-port widths, sizing a title to make it fit on a graph or in a box, and so on.
For example, with the 8x8 bit-mapped font and a multiplication factor of 1 (set by SetTextStyle), the string Turbo is 40 pixels wide.
It is important to use TextWidth to compute the width of strings, instead of doing the computation manually. In that way, no source code modifications have to be made when different fonts are selected.
Restrictions
Must be in graphics mode.