t = ccontext:TextExtents(s$)
XAdvance and YAdvance values indicate the amount by which the
current point would be advanced by ccontext:ShowText().
This function returns a table describing the text extents. The table contains the following fields:
XBearingYBearingWidthHeightXAdvanceYAdvance
Note that whitespace characters do not directly contribute to the
size of the rectangle (Width and Height). 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.
Also note that because text extents are in user-space coordinates, they are mostly, but not entirely, independent of the current transformation matrix. If you call ccontext:Scale() with scaling coefficients of 2.0 on each axis, the text will be drawn twice as big, but the reported text extents will not be doubled. They will change slightly due to hinting (so you can't assume that metrics are independent of the transformation matrix), but otherwise will remain unchanged.