Table of Contents

Class SystemFont

Namespace
Godot
Assembly
GodotSharp.dll

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

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.

public class SystemFont : Font, IDisposable
Inheritance
SystemFont
Implements
Inherited Members

Constructors

SystemFont()

public SystemFont()

Properties

AllowSystemFallback

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

public bool AllowSystemFallback { get; set; }

Property Value

bool

Antialiasing

Font anti-aliasing mode.

public TextServer.FontAntialiasing Antialiasing { get; set; }

Property Value

TextServer.FontAntialiasing

FontItalic

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

public bool FontItalic { get; set; }

Property Value

bool

FontNames

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

public string[] FontNames { get; set; }

Property Value

string[]

FontStretch

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

public int FontStretch { get; set; }

Property Value

int

FontWeight

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

public int FontWeight { get; set; }

Property Value

int

ForceAutohinter

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

public bool ForceAutohinter { get; set; }

Property Value

bool

GenerateMipmaps

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

public bool GenerateMipmaps { get; set; }

Property Value

bool

Hinting

Font hinting mode.

public TextServer.Hinting Hinting { get; set; }

Property Value

TextServer.Hinting

MsdfPixelRange

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

public int MsdfPixelRange { get; set; }

Property Value

int

MsdfSize

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.

public int MsdfSize { get; set; }

Property Value

int

MultichannelSignedDistanceField

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

public bool MultichannelSignedDistanceField { get; set; }

Property Value

bool

Oversampling

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

public float Oversampling { get; set; }

Property Value

float

SubpixelPositioning

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 Auto to automatically enable it based on the font size.

public TextServer.SubpixelPositioning SubpixelPositioning { get; set; }

Property Value

TextServer.SubpixelPositioning

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool