SystemFont
A font loaded from a system font. Falls back to a default theme font if not implemented on the host OS.
SystemFont.swift:20class SystemFont
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 fine control over its features.
Superclasses
class Font
Abstract base class for fonts and font variations.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var allowSystemFallback: Bool
If set to
true
, system fonts can be automatically used as fallbacks.var antialiasing: TextServer.FontAntialiasing
Font anti-aliasing mode.
var fontItalic: Bool
If set to
true
, italic or oblique font is preferred.var fontNames: PackedStringArray
Array of font family names to search, first matching font found is used.
var fontStretch: Int32
Preferred font stretch amount, compared to a normal width. A percentage value between
50%
and200%
.var fontWeight: Int32
Preferred weight (boldness) of the font. A value in the
100...999
range, normal font weight is400
, bold font weight is700
.var forceAutohinter: Bool
If set to
true
, auto-hinting is supported and preferred over font built-in hinting.var generateMipmaps: Bool
If set to
true
, generate mipmaps for the font textures.var hinting: TextServer.Hinting
Font hinting mode.
var msdfPixelRange: Int32
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 defaultmsdfPixelRange
value of16
allows outline sizes up to8
to look correct.var msdfSize: Int32
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 multichannelSignedDistanceField: Bool
If set to
true
, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.var oversampling: Double
Font oversampling factor, if set to
0.0
global oversampling factor is used instead.var subpixelPositioning: TextServer.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.