- 4.37.2.123. -
Table of Contents
4. Standard Units
4.37. Graph - Graph unit
4.37.2. Graph Unit Procedures and Functions
4.37.2.123. TextWidth function
4.37.2.123. TextWidth function
Targets: MS-DOS, Win32
Graph Unit
Returns the width of a string in pixels.
Declaration:
function TextWidth(TextString: string): DWORD;
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 (set by
SetTextStyle),
the string TMT is 24 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.
- 4.37.2.123. -