string_height

Returns the height in pixels of a string.

Syntax:

GML Code Example

string_height(string);


Argument Description
string The string to measure the height of.


Returns: Real


Description

This function will return the height (in pixels) of the input string. It is very handy for calculating distances between text elements based on the tallest of the letters that make up the string as it would be drawn with draw_text using the currently defined font.


Example:

GML Code Example

var hh;
 hh = string_height("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
 draw_text(32, 32, string(score));
 draw_text(32, 32 + hh, string(lives);
 

The above code will get the height of the given string and then draw two lines of text, using the returned string height as a separator.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here