string_width_ext

From ENIGMA

Jump to: navigation, search

Notation

string_width_ext(string,sep,w)

Description

Returns the width in pixels of the string in the current drawing font. sep is not used in this function and remains only for compatibility and consistency, so set it to whatever (usually -1). 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 width should be returned.
  • sep: Separation parameter is not used in this function and remains only for compatibility and consistency, so set it to whatever (usually -1).
  • 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 string_width(string) instead.

Return Values

Returns the width of the string in pixels.

Example Call

//draws a line above the string
draw_text_ext(10,10,"Some text, that is split up", -1, 100);
w=string_width_ext("Some text, that is split up",-1,100);
draw_line(10,10,10+w,10);
Personal tools