:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the DynamicFont.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_DynamicFont: DynamicFont =========== **Inherits:** :ref:`Font` **<** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- DynamicFont renders vector font files at runtime. Properties ---------- +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`extra_spacing_bottom` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`extra_spacing_char` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`extra_spacing_space` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`extra_spacing_top` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`DynamicFontData` | :ref:`font_data` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`outline_color` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`outline_size` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`size` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`use_filter` | +-----------------------------------------------+------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`use_mipmaps` | +-----------------------------------------------+------------------------------------------------------------------------------+ Methods ------- +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_fallback` **(** :ref:`DynamicFontData` data **)** | +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`DynamicFontData` | :ref:`get_fallback` **(** :ref:`int` idx **)** const | +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_fallback_count` **(** **)** const | +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_fallback` **(** :ref:`int` idx **)** | +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_fallback` **(** :ref:`int` idx, :ref:`DynamicFontData` data **)** | +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ Enumerations ------------ .. _enum_DynamicFont_SpacingType: .. _class_DynamicFont_constant_SPACING_TOP: .. _class_DynamicFont_constant_SPACING_BOTTOM: .. _class_DynamicFont_constant_SPACING_CHAR: .. _class_DynamicFont_constant_SPACING_SPACE: enum **SpacingType**: - **SPACING_TOP** = **0** --- Spacing at the top. - **SPACING_BOTTOM** = **1** --- Spacing at the bottom. - **SPACING_CHAR** = **2** --- Character spacing. - **SPACING_SPACE** = **3** --- Space spacing. Description ----------- DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like :ref:`BitmapFont`. This trades the faster loading time of :ref:`BitmapFont`\ s for the ability to change font parameters like size and spacing during runtime. :ref:`DynamicFontData` is used for referencing the font file paths. :: var dynamic_font = DynamicFont.new() dynamic_font.font_data = load("res://BarlowCondensed-Bold.ttf") dynamic_font.size = 64 $"Label".set("custom_fonts/font", dynamic_font) Property Descriptions --------------------- .. _class_DynamicFont_property_extra_spacing_bottom: - :ref:`int` **extra_spacing_bottom** +----------+--------------------+ | *Setter* | set_spacing(value) | +----------+--------------------+ | *Getter* | get_spacing() | +----------+--------------------+ Extra spacing at the bottom in pixels. ---- .. _class_DynamicFont_property_extra_spacing_char: - :ref:`int` **extra_spacing_char** +----------+--------------------+ | *Setter* | set_spacing(value) | +----------+--------------------+ | *Getter* | get_spacing() | +----------+--------------------+ Extra character spacing in pixels. ---- .. _class_DynamicFont_property_extra_spacing_space: - :ref:`int` **extra_spacing_space** +----------+--------------------+ | *Setter* | set_spacing(value) | +----------+--------------------+ | *Getter* | get_spacing() | +----------+--------------------+ Extra space spacing in pixels. ---- .. _class_DynamicFont_property_extra_spacing_top: - :ref:`int` **extra_spacing_top** +----------+--------------------+ | *Setter* | set_spacing(value) | +----------+--------------------+ | *Getter* | get_spacing() | +----------+--------------------+ Extra spacing at the top in pixels. ---- .. _class_DynamicFont_property_font_data: - :ref:`DynamicFontData` **font_data** +----------+----------------------+ | *Setter* | set_font_data(value) | +----------+----------------------+ | *Getter* | get_font_data() | +----------+----------------------+ The font data. ---- .. _class_DynamicFont_property_outline_color: - :ref:`Color` **outline_color** +----------+--------------------------+ | *Setter* | set_outline_color(value) | +----------+--------------------------+ | *Getter* | get_outline_color() | +----------+--------------------------+ ---- .. _class_DynamicFont_property_outline_size: - :ref:`int` **outline_size** +----------+-------------------------+ | *Setter* | set_outline_size(value) | +----------+-------------------------+ | *Getter* | get_outline_size() | +----------+-------------------------+ ---- .. _class_DynamicFont_property_size: - :ref:`int` **size** +----------+-----------------+ | *Setter* | set_size(value) | +----------+-----------------+ | *Getter* | get_size() | +----------+-----------------+ The font size. ---- .. _class_DynamicFont_property_use_filter: - :ref:`bool` **use_filter** +----------+-----------------------+ | *Setter* | set_use_filter(value) | +----------+-----------------------+ | *Getter* | get_use_filter() | +----------+-----------------------+ If ``true``, filtering is used. ---- .. _class_DynamicFont_property_use_mipmaps: - :ref:`bool` **use_mipmaps** +----------+------------------------+ | *Setter* | set_use_mipmaps(value) | +----------+------------------------+ | *Getter* | get_use_mipmaps() | +----------+------------------------+ If ``true``, mipmapping is used. Method Descriptions ------------------- .. _class_DynamicFont_method_add_fallback: - void **add_fallback** **(** :ref:`DynamicFontData` data **)** Adds a fallback font. ---- .. _class_DynamicFont_method_get_fallback: - :ref:`DynamicFontData` **get_fallback** **(** :ref:`int` idx **)** const Returns the fallback font at index ``idx``. ---- .. _class_DynamicFont_method_get_fallback_count: - :ref:`int` **get_fallback_count** **(** **)** const Returns the number of fallback fonts. ---- .. _class_DynamicFont_method_remove_fallback: - void **remove_fallback** **(** :ref:`int` idx **)** Removes the fallback font at index ``idx``. ---- .. _class_DynamicFont_method_set_fallback: - void **set_fallback** **(** :ref:`int` idx, :ref:`DynamicFontData` data **)** Sets the fallback font at index ``idx``.