chickadee » sdl2-ttf » size-text

size-text font textprocedure

Calculate the size of the surface that would be created if you rendered the given Latin-1 (ISO 8859-1) text using the ttf:font. See TTF_SizeText.

Returns two values, the calculated width and the height, as integers.

This is much faster than actually rendering the text, so you can use this to quickly predict how much space would be needed. This is useful for calculating word wrapping, alignment, truncation, etc.