TCanvas.TextExtent function
Calculates the width and height for the specified Text using the Font for the canvas.
Declaration
function TextExtent(const Text: string): TSize; virtual; reintroduceArguments
Text | Text examined and measured in the method. |
Function result
TSize instance with the Width and Height for the text.
Description
TextExtent is a
TSize function used to get the width and
height for the specified Text using the Font for the canvas instance.
The TSize type in the return value returns the Width and Height for the Text in pixels using the cX (Width) and cY (Height) members. Both members are set to 0 if Text is an empty string (''), and when either the Handle or Font for the canvas are invalid. The CreateHandle and CreateFont methods are called to attempt to create the items when needed.
If the Font has the default un-initialized settings, the OnGetSystemFont event handler is signalled to get the default system font selected for the canvas.
TextExtent calls the GetTextExtentPoint routine in the widgetset interface to get the return value for the method.
TextExtent is used in methods like TextWidth, TextHeight and DoGetTextSize.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
