:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Font.xml. .. _class_Font: Font ==== **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` **Inherited By:** :ref:`FontFile`, :ref:`FontVariation`, :ref:`SystemFont` Abstract base class for fonts and font variations. .. rst-class:: classref-introduction-group Description ----------- Abstract base class for different font types. It has methods for drawing text and font character introspection. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +------------------------------------------------------+-------------------------------------------------+--------+ | :ref:`Array`\[:ref:`Font`\] | :ref:`fallbacks` | ``[]`` | +------------------------------------------------------+-------------------------------------------------+--------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`draw_char`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`draw_char_outline`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, size\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_multiline_string`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_multiline_string_outline`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_string`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_string_outline`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`find_variation`\ (\ variation_coordinates\: :ref:`Dictionary`, face_index\: :ref:`int` = 0, strength\: :ref:`float` = 0.0, transform\: :ref:`Transform2D` = Transform2D(1, 0, 0, 1, 0, 0), spacing_top\: :ref:`int` = 0, spacing_bottom\: :ref:`int` = 0, spacing_space\: :ref:`int` = 0, spacing_glyph\: :ref:`int` = 0, baseline_offset\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_ascent`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_char_size`\ (\ char\: :ref:`int`, font_size\: :ref:`int`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_descent`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_face_count`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_font_name`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_font_stretch`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |bitfield|\[:ref:`FontStyle`\] | :ref:`get_font_style`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_font_style_name`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_font_weight`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_height`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_multiline_string_size`\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_opentype_features`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_ot_name_strings`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`RID`\] | :ref:`get_rids`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_spacing`\ (\ spacing\: :ref:`SpacingType`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_string_size`\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_supported_chars`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_supported_feature_list`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_supported_variation_list`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_underline_position`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_underline_thickness`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_char`\ (\ char\: :ref:`int`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_language_supported`\ (\ language\: :ref:`String`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_script_supported`\ (\ script\: :ref:`String`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_cache_capacity`\ (\ single_line\: :ref:`int`, multi_line\: :ref:`int`\ ) | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_Font_property_fallbacks: .. rst-class:: classref-property :ref:`Array`\[:ref:`Font`\] **fallbacks** = ``[]`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_fallbacks**\ (\ value\: :ref:`Array`\[:ref:`Font`\]\ ) - :ref:`Array`\[:ref:`Font`\] **get_fallbacks**\ (\ ) Array of fallback **Font**\ s to use as a substitute if a glyph is not found in this current **Font**. If this array is empty in a :ref:`FontVariation`, the :ref:`FontVariation.base_font`'s fallbacks are used instead. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_Font_method_draw_char: .. rst-class:: classref-method :ref:`float` **draw_char**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Draw a single Unicode character ``char`` into a canvas item using the font, at a given position, with ``modulate`` color. ``pos`` specifies the baseline, not the top. To draw from the top, *ascent* must be added to the Y axis. If ``oversampling`` is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. \ **Note:** Do not use this function to draw strings character by character, use :ref:`draw_string()` or :ref:`TextLine` instead. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_char_outline: .. rst-class:: classref-method :ref:`float` **draw_char_outline**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, size\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Draw a single Unicode character ``char`` outline into a canvas item using the font, at a given position, with ``modulate`` color and ``size`` outline size. ``pos`` specifies the baseline, not the top. To draw from the top, *ascent* must be added to the Y axis. If ``oversampling`` is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. \ **Note:** Do not use this function to draw strings character by character, use :ref:`draw_string()` or :ref:`TextLine` instead. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_multiline_string: .. rst-class:: classref-method |void| **draw_multiline_string**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Breaks ``text`` into lines using rules specified by ``brk_flags`` and draws it into a canvas item using the font, at a given position, with ``modulate`` color, optionally clipping the width and aligning horizontally. ``pos`` specifies the baseline of the first line, not the top. To draw from the top, *ascent* must be added to the Y axis. If ``oversampling`` is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. See also :ref:`CanvasItem.draw_multiline_string()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_multiline_string_outline: .. rst-class:: classref-method |void| **draw_multiline_string_outline**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Breaks ``text`` to the lines using rules specified by ``brk_flags`` and draws text outline into a canvas item using the font, at a given position, with ``modulate`` color and ``size`` outline size, optionally clipping the width and aligning horizontally. ``pos`` specifies the baseline of the first line, not the top. To draw from the top, *ascent* must be added to the Y axis. If ``oversampling`` is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. See also :ref:`CanvasItem.draw_multiline_string_outline()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_string: .. rst-class:: classref-method |void| **draw_string**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Draw ``text`` into a canvas item using the font, at a given position, with ``modulate`` color, optionally clipping the width and aligning horizontally. ``pos`` specifies the baseline, not the top. To draw from the top, *ascent* must be added to the Y axis. If ``oversampling`` is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. See also :ref:`CanvasItem.draw_string()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_string_outline: .. rst-class:: classref-method |void| **draw_string_outline**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Draw ``text`` outline into a canvas item using the font, at a given position, with ``modulate`` color and ``size`` outline size, optionally clipping the width and aligning horizontally. ``pos`` specifies the baseline, not the top. To draw from the top, *ascent* must be added to the Y axis. If ``oversampling`` is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. See also :ref:`CanvasItem.draw_string_outline()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_find_variation: .. rst-class:: classref-method :ref:`RID` **find_variation**\ (\ variation_coordinates\: :ref:`Dictionary`, face_index\: :ref:`int` = 0, strength\: :ref:`float` = 0.0, transform\: :ref:`Transform2D` = Transform2D(1, 0, 0, 1, 0, 0), spacing_top\: :ref:`int` = 0, spacing_bottom\: :ref:`int` = 0, spacing_space\: :ref:`int` = 0, spacing_glyph\: :ref:`int` = 0, baseline_offset\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Returns :ref:`TextServer` RID of the font cache for specific variation. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_ascent: .. rst-class:: classref-method :ref:`float` **get_ascent**\ (\ font_size\: :ref:`int` = 16\ ) |const| :ref:`🔗` Returns the average font ascent (number of pixels above the baseline). \ **Note:** Real ascent of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the ascent of empty line). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_char_size: .. rst-class:: classref-method :ref:`Vector2` **get_char_size**\ (\ char\: :ref:`int`, font_size\: :ref:`int`\ ) |const| :ref:`🔗` Returns the size of a character. Does not take kerning into account. \ **Note:** Do not use this function to calculate width of the string character by character, use :ref:`get_string_size()` or :ref:`TextLine` instead. The height returned is the font height (see also :ref:`get_height()`) and has no relation to the glyph height. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_descent: .. rst-class:: classref-method :ref:`float` **get_descent**\ (\ font_size\: :ref:`int` = 16\ ) |const| :ref:`🔗` Returns the average font descent (number of pixels below the baseline). \ **Note:** Real descent of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the descent of empty line). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_face_count: .. rst-class:: classref-method :ref:`int` **get_face_count**\ (\ ) |const| :ref:`🔗` Returns number of faces in the TrueType / OpenType collection. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_name: .. rst-class:: classref-method :ref:`String` **get_font_name**\ (\ ) |const| :ref:`🔗` Returns font family name. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_stretch: .. rst-class:: classref-method :ref:`int` **get_font_stretch**\ (\ ) |const| :ref:`🔗` Returns font stretch amount, compared to a normal width. A percentage value between ``50%`` and ``200%``. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_style: .. rst-class:: classref-method |bitfield|\[:ref:`FontStyle`\] **get_font_style**\ (\ ) |const| :ref:`🔗` Returns font style flags. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_style_name: .. rst-class:: classref-method :ref:`String` **get_font_style_name**\ (\ ) |const| :ref:`🔗` Returns font style name. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_weight: .. rst-class:: classref-method :ref:`int` **get_font_weight**\ (\ ) |const| :ref:`🔗` Returns weight (boldness) of the font. A value in the ``100...999`` range, normal font weight is ``400``, bold font weight is ``700``. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_height: .. rst-class:: classref-method :ref:`float` **get_height**\ (\ font_size\: :ref:`int` = 16\ ) |const| :ref:`🔗` Returns the total average font height (ascent plus descent) in pixels. \ **Note:** Real height of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the height of empty line). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_multiline_string_size: .. rst-class:: classref-method :ref:`Vector2` **get_multiline_string_size**\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| :ref:`🔗` Returns the size of a bounding box of a string broken into the lines, taking kerning and advance into account. See also :ref:`draw_multiline_string()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_opentype_features: .. rst-class:: classref-method :ref:`Dictionary` **get_opentype_features**\ (\ ) |const| :ref:`🔗` Returns a set of OpenType feature tags. More info: `OpenType feature tags `__. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_ot_name_strings: .. rst-class:: classref-method :ref:`Dictionary` **get_ot_name_strings**\ (\ ) |const| :ref:`🔗` Returns :ref:`Dictionary` with OpenType font name strings (localized font names, version, description, license information, sample text, etc.). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_rids: .. rst-class:: classref-method :ref:`Array`\[:ref:`RID`\] **get_rids**\ (\ ) |const| :ref:`🔗` Returns :ref:`Array` of valid **Font** :ref:`RID`\ s, which can be passed to the :ref:`TextServer` methods. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_spacing: .. rst-class:: classref-method :ref:`int` **get_spacing**\ (\ spacing\: :ref:`SpacingType`\ ) |const| :ref:`🔗` Returns the amount of spacing for the given ``spacing`` type. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_string_size: .. rst-class:: classref-method :ref:`Vector2` **get_string_size**\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| :ref:`🔗` Returns the size of a bounding box of a single-line string, taking kerning, advance and subpixel positioning into account. See also :ref:`get_multiline_string_size()` and :ref:`draw_string()`. For example, to get the string size as displayed by a single-line Label, use: .. tabs:: .. code-tab:: gdscript var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size")) .. code-tab:: csharp Label label = GetNode