SystemFont
Inherits: Font < Resource < RefCounted < Object
Description
Section titled “Description”A font loaded from a system font. Falls back to a default theme font if not implemented on the host OS.
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
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | allow_system_fallback |
true |
| TextSystem.FontAntialiasing | antialiasing |
1 |
| bool | disable_embedded_bitmaps |
true |
| bool | font_italic |
false |
| PackedStringArray | font_names |
PackedStringArray() |
| int | font_stretch |
100 |
| int | font_weight |
400 |
| bool | force_autohinter |
false |
| bool | generate_mipmaps |
false |
| TextSystem.Hinting | hinting |
1 |
| bool | keep_rounding_remainders |
true |
| bool | modulate_color_glyphs |
false |
| int | msdf_pixel_range |
16 |
| int | msdf_size |
48 |
| bool | multichannel_signed_distance_field |
false |
| float | oversampling |
0.0 |
| TextSystem.SubpixelPositioning | subpixel_positioning |
1 |
Property descriptions
Section titled “Property descriptions”allow_system_fallback
bool allow_system_fallback = true
If set to true, system fonts can be automatically used as fallbacks.
antialiasing
TextSystem.FontAntialiasing antialiasing = 1
Font anti-aliasing mode.
disable_embedded_bitmaps
bool disable_embedded_bitmaps = true
If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
font_italic
bool font_italic = false
If set to true, italic or oblique font is preferred.
font_names
PackedStringArray font_names = PackedStringArray()
Array of font family names to search, first matching font found is used.
font_stretch
int font_stretch = 100
Preferred font stretch amount, compared to a normal width. A percentage value between 50% and 200%.
font_weight
int font_weight = 400
Preferred weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.
force_autohinter
bool force_autohinter = false
If set to true, auto-hinting is supported and preferred over font built-in hinting.
generate_mipmaps
bool generate_mipmaps = false
If set to true, generate mipmaps for the font textures.
hinting
TextSystem.Hinting hinting = 1
Font hinting mode.
keep_rounding_remainders
bool keep_rounding_remainders = true
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.
modulate_color_glyphs
bool modulate_color_glyphs = false
If set to true, color modulation is applied when drawing colored glyphs, otherwise it’s applied to the monochrome glyphs only.
msdf_pixel_range
int msdf_pixel_range = 16
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.
msdf_size
int msdf_size = 48
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.
multichannel_signed_distance_field
bool multichannel_signed_distance_field = false
If set to true, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
oversampling
float oversampling = 0.0
If set to a positive value, overrides the oversampling factor of the viewport this font is used in. See Viewport.oversampling. This value doesn’t override the oversampling parameter of draw_* methods.
subpixel_positioning
TextSystem.SubpixelPositioning subpixel_positioning = 1
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 TextSystem.SUBPIXEL_POSITIONING_AUTO to automatically enable it based on the font size.
