Table of Contents

Class SystemFont

A font loaded from a system font. Falls back to a default theme font if not implemented on the host OS.

Inheritance
SystemFont

Remarks

SystemFont loads a font from a system font with the first matching name from font_names.

It will attempt to match font style, but it's not guaranteed.

The returned font might be part of a font collection or be a variable font with OpenType "weight", "width" and/or "italic" features set.

You can create FontVariation of the system font for precise control over its features.

Note: This class is implemented on iOS, Linux, macOS and Windows, on other platforms it will fallback to default theme font.

Properties

allow_system_fallback

If set to true, system fonts can be automatically used as fallbacks.

var allow_system_fallback : bool = true

Property Value

bool

Remarks

  • void set_allow_system_fallback(bool value)
  • bool is_allow_system_fallback

antialiasing

Font anti-aliasing mode.

var antialiasing : int = 1

Property Value

int

Remarks

  • void set_antialiasing(int value)
  • int get_antialiasing

disable_embedded_bitmaps

If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).

var disable_embedded_bitmaps : bool = true

Property Value

bool

Remarks

  • void set_disable_embedded_bitmaps(bool value)
  • bool get_disable_embedded_bitmaps

font_italic

If set to true, italic or oblique font is preferred.

var font_italic : bool = false

Property Value

bool

Remarks

  • void set_font_italic(bool value)
  • bool get_font_italic

font_names

Array of font family names to search, first matching font found is used.

var font_names : PackedStringArray = PackedStringArray()

Property Value

PackedStringArray

Remarks

font_stretch

Preferred font stretch amount, compared to a normal width. A percentage value between 50% and 200%.

var font_stretch : int = 100

Property Value

int

Remarks

  • void set_font_stretch(int value)
  • int get_font_stretch

font_weight

Preferred weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.

var font_weight : int = 400

Property Value

int

Remarks

  • void set_font_weight(int value)
  • int get_font_weight

force_autohinter

If set to true, auto-hinting is supported and preferred over font built-in hinting.

var force_autohinter : bool = false

Property Value

bool

Remarks

  • void set_force_autohinter(bool value)
  • bool is_force_autohinter

generate_mipmaps

If set to true, generate mipmaps for the font textures.

var generate_mipmaps : bool = false

Property Value

bool

Remarks

  • void set_generate_mipmaps(bool value)
  • bool get_generate_mipmaps

hinting

Font hinting mode.

var hinting : int = 1

Property Value

int

Remarks

  • void set_hinting(int value)
  • int get_hinting

keep_rounding_remainders

If set to true, when aligning glyphs to the pixel boundaries rounding remainders are accumulated to ensure more uniform glyph distribution. This setting has no effect if subpixel positioning is enabled.

var keep_rounding_remainders : bool = true

Property Value

bool

Remarks

  • void set_keep_rounding_remainders(bool value)
  • bool get_keep_rounding_remainders

msdf_pixel_range

The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, msdf_pixel_range must be set to at least twice the size of the largest font outline. The default msdf_pixel_range value of 16 allows outline sizes up to 8 to look correct.

var msdf_pixel_range : int = 16

Property Value

int

Remarks

  • void set_msdf_pixel_range(int value)
  • int get_msdf_pixel_range

msdf_size

Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering.

var msdf_size : int = 48

Property Value

int

Remarks

  • void set_msdf_size(int value)
  • int get_msdf_size

multichannel_signed_distance_field

If set to true, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.

var multichannel_signed_distance_field : bool = false

Property Value

bool

Remarks

  • void set_multichannel_signed_distance_field(bool value)
  • bool is_multichannel_signed_distance_field

oversampling

Font oversampling factor, if set to 0.0 global oversampling factor is used instead.

var oversampling : float = 0.0

Property Value

float

Remarks

  • void set_oversampling(float value)
  • float get_oversampling

subpixel_positioning

Font glyph subpixel positioning mode. Subpixel positioning provides shaper text and better kerning for smaller font sizes, at the cost of memory usage and font rasterization speed. Use TextServer.SUBPIXEL_POSITIONING_AUTO to automatically enable it based on the font size.

var subpixel_positioning : int = 1

Property Value

int

Remarks

  • void set_subpixel_positioning(int value)
  • int get_subpixel_positioning