Font

    Inherited By: , DynamicFont

    Category: Core

    Internationalized font and text drawing support.

    • void draw ( canvas_item, Vector2 position, string, Color modulate=Color( 1, 1, 1, 1 ), clip_w=-1, Color outline_modulate=Color( 1, 1, 1, 1 ) ) const

    Draw “string” into a canvas item using the font at a given position, with “modulate” color, and optionally clipping the width. “position” specifies the baseline, not the top. To draw from the top, ascent must be added to the Y axis.


    • draw_char ( RID canvas_item, position, int char, next=-1, Color modulate=Color( 1, 1, 1, 1 ), outline=false ) const

    Draw character “char” into a canvas item using the font at a given position, with “modulate” color, and optionally kerning if “next” is passed. clipping the width. “position” specifies the baseline, not the top. To draw from the top, ascent must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character.


    • float get_ascent ( ) const

    Returns the font ascent (number of pixels above the baseline).



    • get_height ( ) const

    Returns the total font height (ascent plus descent) in pixels.


    • Vector2 get_string_size ( string ) const

    Returns the size of a string, taking kerning and advance into account.


    • bool has_outline ( ) const


    • void update_changes ( )

    After editing a font (changing size, ascent, char rects, etc.). Call this function to propagate changes to controls that might use it.