sb.getStringSize(font, font_size, string, width, data)
Calculate the area in pixels which the given string will occupy on the screen.
Parameters: font - The name of the font to render in font_size - The size of the font to render in string - The string to render width - A clipping width (in pixels) for the string, used to calculate how many characters fit data - An object containing additional options. Valid options are: length - number of characters to process spacing - letter spacing parameter wrapping - boolean to activate wrapping logic Return: An object with the following variables: width - width of the widest line in the body of text height - total height of the wrapped text in pixels n_lines - number of lines the text fills when wrapped
Example:
var options = {wrapping : true}; var t = sb.getStringSize('fonts/Roboto-ThinItalic.ttf', 72, 'How long is this string?', 600, options);