chars = TextFit(rastport, string, strLen, textExtent, constrainingExtent, strDirection,
D0 A1 A0 D0 A2 A3 D1
constrainingBitWidth, constrainingBitHeight)
D2 D3
ULONG TextFit(
struct RastPort *, STRPTR, UWORD,
This function determines how many of the characters of the provided string will fit into the space described by the constraining parameters. It also returns the extent of that number of characters.
The result is zero chars and an empty textExtent when the fit cannot be performed. This occurs not only when no text will fit in the provided constraints, but also when:
-
the RastPort rp's rp_TxSpacing sign and magnitude is so great it reverses the path of the text.
-
the constrainingExtent does not include x = 0.
Under V37, TextFit() would return one too few characters if the font was proportional. This can be worked around by passing (constrainingBitWidth + 1) for proportional fonts. This is fixed for V39.