Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

SystemFont

Inherits: Font < Resource < RefCounted < Object

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

Description

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 fine 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

bool

allow_system_fallback

true

FontAntialiasing

antialiasing

1

bool

font_italic

false

PackedStringArray

font_names

PackedStringArray()

int

font_stretch

100

int

font_weight

400

bool

force_autohinter

false

bool

generate_mipmaps

false

Hinting

hinting

1

int

msdf_pixel_range

16

int

msdf_size

48

bool

multichannel_signed_distance_field

false

float

oversampling

0.0

SubpixelPositioning

subpixel_positioning

1


Property Descriptions

bool allow_system_fallback = true

  • void set_allow_system_fallback ( bool value )

  • bool is_allow_system_fallback ( )

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


FontAntialiasing antialiasing = 1

Font anti-aliasing mode.


bool font_italic = false

  • void set_font_italic ( bool value )

  • bool get_font_italic ( )

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


PackedStringArray font_names = PackedStringArray()

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


int font_stretch = 100

  • void set_font_stretch ( int value )

  • int get_font_stretch ( )

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


int font_weight = 400

  • void set_font_weight ( int value )

  • int get_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.


bool force_autohinter = false

  • void set_force_autohinter ( bool value )

  • bool is_force_autohinter ( )