chickadee » sdl2-ttf » size-utf8

size-utf8 font textprocedure

Calculate the size of the surface that would be created if you rendered the given UTF8 text using the ttf:font. See TTF_SizeUTF8.

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.