chickadee » sdl2-ttf » size-unicode

size-unicode font unicodeprocedure

Calculate the size of the surface that would be created if you rendered the given 16-bit Unicode encoded text using the ttf:font. See TTF_SizeUNICODE.

unicode must be a pointer or locative to a null-terminated C array of 16-bit unsigned integers, representing Unicode text. (SRFI-4 u16vectors can be wrapped in a locative using make-locative.)

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.