LuaBox
Loading...
Searching...
No Matches
DisplayTextSize.h File Reference
#include "lua_include.h"
#include "global.h"

Go to the source code of this file.

Functions

int DisplayTextSize (lua_State *L_)
 Calculate the pixel width and height of a text string on the sprite buffer.

Function Documentation

◆ DisplayTextSize()

int DisplayTextSize ( lua_State * L_)

Calculate the pixel width and height of a text string on the sprite buffer.

This function calculates the width and height of a given text string when drawn on the sprite buffer, taking into account the current font and an optional text size multiplier. It also accounts for multiple lines if the string contains \n characters.

Parameters
L_Lua state; expects arguments in order: 1: text string 2: text size (optional, default 1)
Returns
int Returns a Lua table with the following fields:
  • "x": pixel width of the text
  • "y": pixel height of the text, including multiple lines
Note
Uses the current font of the sprite buffer.