Name
cscaledfont:TextExtents -- get text extents
Synopsis
t = cscaledfont:TextExtents(s$)
Function
Gets the extents for a string of text. The extents describe a user-space rectangle that encloses the "inked" portion of the text drawn at the origin (0,0) as it would be drawn by ccontext:ShowText() if the Cairographics state were set to the same font face, font matrix, ctm, and font options as the scaled font. Additionally, the XAdvance and YAdvance values indicate the amount by which the current point would be advanced by ccontext:ShowText().

Note that whitespace characters do not directly contribute to the size of the rectangle as contained in the Width and Height fields of the extents. They do contribute indirectly by changing the position of non-whitespace characters. In particular, trailing whitespace characters are likely to not affect the size of the rectangle, though they will affect the XAdvance and YAdvance values.

This function returns a table containing the text extents. See ccontext:TextExtents() for a description of all table members.

Inputs
s$
a string of text
Results
t
table containing the text extents (see above)

Show TOC