String_height_ext - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

Notation

Description

Returns the height in pixels of the string in the current drawing font. sep indicates the separation distance between the lines of text in a multiline text. Use -1 to get the default distance. Note that this distance is from the top of each line to the next top. So small distances will make the text to overlap. This means that the default sep is . w is the width of the text in pixels. Lines that are longer than this width are split up at spaces. Use -1 to not split up lines. This function is usually used to precisely position graphics and text.

Parameters

  • string: The string for which the height should be returned.
  • sep indicates the separation distance between the lines of text in a multiline text. Use -1 to get the default distance.
  • w: Width of the text in pixels. Lines that are longer than this width are split up at spaces. Use -1 to not split up lines. If -1 is used, then its better and faster to use instead.

Return Values

Returns the height of the string in pixels.

Example Call

//draws a line at the left side of the string
draw_text_ext(10,10,"Some text, that is split up",-1,100);
h=string_height_ext("Some text, that is split up",-1,100);
draw_line(10,10,10,10+h);

NOTOC