gre.get_string_size

gre.get_string_size(
    font,
    font_size,
    string,
    length,
    width
)
            

Calculate the area in pixels which the given string will occupy on the screen. Optionally calculate how many characters can fit into a predefined screen area.

This call can only be made from the main Lua action execution thread.

Parameters:

        string          The string to render
        font            The name of the font to render in
        font_size       The size of the font to render in  
        string_length   The length of the string to render or 0 for all (optional)
        width           A clipping width (in pixels) for the string, used to calculate how many characters fit
        (optional, by default there is no clip)

Returns:

        A table containing the following entries:
        "num_bytes" number of bytes that will fit in the clip
  "width" string width in pixels as clipped by clip width
  "height" string height in pixels
        "line_height" height in pixels of the specified font