DynamicFont renders vector font files at runtime.
    public class DynamicFont : Font

DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like BitmapFont. This trades the faster loading time of BitmapFonts for the ability to change font parameters like size and spacing during runtime. DynamicFontData is used for referencing the font file paths.

[codeblock]

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)

[/codeblock]

Inheritance Chain

Constructors

    public DynamicFont()

Properties

    public int ExtraSpacingBottom { get; set; }

Extra spacing at the bottom in pixels.

    public int ExtraSpacingChar { get; set; }

Extra character spacing in pixels.

    public int ExtraSpacingSpace { get; set; }

Extra space spacing in pixels.

    public int ExtraSpacingTop { get; set; }

Extra spacing at the top in pixels.

    public DynamicFontData FontData { get; set; }

The font data.

    public Color OutlineColor { get; set; }

    public int OutlineSize { get; set; }

    public int Size { get; set; }

The font size.

    public bool UseFilter { get; set; }

If true, filtering is used.

    public bool UseMipmaps { get; set; }

If true, mipmapping is used.

Methods

    public void AddFallback(DynamicFontData data)

Adds a fallback font.

    public DynamicFontData GetFallback(int idx)

Returns the fallback font at index idx.

    public int GetFallbackCount()

Returns the number of fallback fonts.

    [Obsolete("GetFontData is deprecated. Use the FontData property instead.")]
    public DynamicFontData GetFontData()

Getter for FontData

    [Obsolete("GetOutlineColor is deprecated. Use the OutlineColor property instead.")]
    public Color GetOutlineColor()

Getter for OutlineColor

    [Obsolete("GetOutlineSize is deprecated. Use the OutlineSize property instead.")]
    public int GetOutlineSize()

Getter for OutlineSize

    [Obsolete("GetSize is deprecated. Use the Size property instead.")]
    public int GetSize()

Getter for Size

    [Obsolete("GetSpacing is deprecated. Use the ExtraSpacingSpace property instead.")]
    public int GetSpacing(int type)

    [Obsolete("GetUseFilter is deprecated. Use the UseFilter property instead.")]
    public bool GetUseFilter()

Getter for UseFilter

    [Obsolete("GetUseMipmaps is deprecated. Use the UseMipmaps property instead.")]
    public bool GetUseMipmaps()

Getter for UseMipmaps

    public void RemoveFallback(int idx)

Removes the fallback font at index idx.

    public void SetFallback(int idx, DynamicFontData data)

Sets the fallback font at index idx.

    [Obsolete("SetFontData is deprecated. Use the FontData property instead.")]
    public void SetFontData(DynamicFontData data)

Setter for FontData

    [Obsolete("SetOutlineColor is deprecated. Use the OutlineColor property instead.")]
    public void SetOutlineColor(Color color)

Setter for OutlineColor

    [Obsolete("SetOutlineSize is deprecated. Use the OutlineSize property instead.")]
    public void SetOutlineSize(int size)

Setter for OutlineSize

    [Obsolete("SetSize is deprecated. Use the Size property instead.")]
    public void SetSize(int data)

Setter for Size

    [Obsolete("SetSpacing is deprecated. Use the ExtraSpacingSpace property instead.")]
    public void SetSpacing(int type, int value)

    [Obsolete("SetUseFilter is deprecated. Use the UseFilter property instead.")]
    public void SetUseFilter(bool enable)

Setter for UseFilter

    [Obsolete("SetUseMipmaps is deprecated. Use the UseMipmaps property instead.")]
    public void SetUseMipmaps(bool enable)

Setter for UseMipmaps

Inner Types

SpacingType

Name Value Description
Top 0 Spacing at the top.
Bottom 1 Spacing at the bottom.
Char 2 Character spacing.
Space 3 Space spacing.
Tags: