SystemFont
Resolves a font family installed in the operating system.
SystemFont resolves FontNames in the user environment. A developer-installed family may be missing elsewhere; the result, metrics and fallback depend on the system.
For predictable appearance, distribute a licensed FontFile with the project. SystemFont suits system tools and deliberate OS-font selection. Checking one Windows family does not prove identical cross-platform results.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
SystemFontConstructor
public SystemFont();Properties17
AllowSystemFallbackProperty
public bool AllowSystemFallback { get; set; }If set to true, system fonts can be automatically used as fallbacks.
AntialiasingProperty
public TextServer.FontAntialiasing Antialiasing { get; set; }Font anti-aliasing mode.
DisableEmbeddedBitmapsProperty
public bool DisableEmbeddedBitmaps { get; set; }If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
FontItalicProperty
public bool FontItalic { get; set; }If set to true, italic or oblique font is preferred.
FontNamesProperty
public string[] FontNames { get; set; }Family names to resolve through the OS. Family availability and final metrics vary between machines. Use FontFile for consistent distributed appearance.
FontStretchProperty
public int FontStretch { get; set; }Preferred font stretch amount, compared to a normal width. A percentage value between 50% and 200%.
FontWeightProperty
public int FontWeight { get; set; }Preferred weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.
ForceAutohinterProperty
public bool ForceAutohinter { get; set; }If set to true, auto-hinting is supported and preferred over font built-in hinting.
GenerateMipmapsProperty
public bool GenerateMipmaps { get; set; }If set to true, generate mipmaps for the font textures.
HintingProperty
public TextServer.Hinting Hinting { get; set; }Font hinting mode.
KeepRoundingRemaindersProperty
public bool KeepRoundingRemainders { get; set; }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.
ModulateColorGlyphsProperty
public bool ModulateColorGlyphs { get; set; }If set to true, color modulation is applied when drawing colored glyphs, otherwise it's applied to the monochrome glyphs only.
MsdfPixelRangeProperty
public int MsdfPixelRange { get; set; }The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, SystemFont.MsdfPixelRange must be set to at least twice the size of the largest font outline. The default SystemFont.MsdfPixelRange value of 16 allows outline sizes up to 8 to look correct.
MsdfSizeProperty
public int MsdfSize { get; set; }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.
MultichannelSignedDistanceFieldProperty
public bool MultichannelSignedDistanceField { get; set; }If set to true, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
OversamplingProperty
public float Oversampling { get; set; }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 [code skip-lint]oversampling parameter of [code skip-lint]draw_* methods.
SubpixelPositioningProperty
public TextServer.SubpixelPositioning SubpixelPositioning { get; set; }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.SubpixelPositioning.Auto to automatically enable it based on the font size.
Methods33
GetAntialiasingTextServer.FontAntialiasing
public TextServer.FontAntialiasing GetAntialiasing();TextServer.FontAntialiasingGetDisableEmbeddedBitmapsbool
public bool GetDisableEmbeddedBitmaps();boolGetFontItalicbool
public bool GetFontItalic();boolGetFontNamesstring[]
public string[] GetFontNames();string[]GetGenerateMipmapsbool
public bool GetGenerateMipmaps();boolGetHintingTextServer.Hinting
public TextServer.Hinting GetHinting();TextServer.HintingGetKeepRoundingRemaindersbool
public bool GetKeepRoundingRemainders();boolGetMsdfPixelRangeint
public int GetMsdfPixelRange();intGetMsdfSizeint
public int GetMsdfSize();intGetOversamplingfloat
public float GetOversampling();floatGetSubpixelPositioningTextServer.SubpixelPositioning
public TextServer.SubpixelPositioning GetSubpixelPositioning();TextServer.SubpixelPositioningIsAllowSystemFallbackbool
public bool IsAllowSystemFallback();boolIsForceAutohinterbool
public bool IsForceAutohinter();boolIsModulateColorGlyphsbool
public bool IsModulateColorGlyphs();boolIsMultichannelSignedDistanceFieldbool
public bool IsMultichannelSignedDistanceField();boolSetAllowSystemFallbackvoid
public void SetAllowSystemFallback(bool allowSystemFallback);| Name | Type | Default |
|---|---|---|
allowSystemFallback | bool | — |
SetAntialiasingvoid
public void SetAntialiasing(TextServer.FontAntialiasing antialiasing);| Name | Type | Default |
|---|---|---|
antialiasing | TextServer.FontAntialiasing | — |
SetDisableEmbeddedBitmapsvoid
public void SetDisableEmbeddedBitmaps(bool disableEmbeddedBitmaps);| Name | Type | Default |
|---|---|---|
disableEmbeddedBitmaps | bool | — |
SetFontItalicvoid
public void SetFontItalic(bool italic);| Name | Type | Default |
|---|---|---|
italic | bool | — |
SetFontNames2 overloads
public void SetFontNames(ReadOnlySpan<string> names);| Name | Type | Default |
|---|---|---|
names | ReadOnlySpan<string> | — |
public void SetFontNames(string[] names);| Name | Type | Default |
|---|---|---|
names | string[] | — |
SetFontStretchvoid
public void SetFontStretch(int stretch);| Name | Type | Default |
|---|---|---|
stretch | int | — |
SetFontWeightvoid
public void SetFontWeight(int weight);| Name | Type | Default |
|---|---|---|
weight | int | — |
SetForceAutohintervoid
public void SetForceAutohinter(bool forceAutohinter);| Name | Type | Default |
|---|---|---|
forceAutohinter | bool | — |
SetGenerateMipmapsvoid
public void SetGenerateMipmaps(bool generateMipmaps);| Name | Type | Default |
|---|---|---|
generateMipmaps | bool | — |
SetHintingvoid
public void SetHinting(TextServer.Hinting hinting);| Name | Type | Default |
|---|---|---|
hinting | TextServer.Hinting | — |
SetKeepRoundingRemaindersvoid
public void SetKeepRoundingRemainders(bool keepRoundingRemainders);| Name | Type | Default |
|---|---|---|
keepRoundingRemainders | bool | — |
SetModulateColorGlyphsvoid
public void SetModulateColorGlyphs(bool modulate);| Name | Type | Default |
|---|---|---|
modulate | bool | — |
SetMsdfPixelRangevoid
public void SetMsdfPixelRange(int msdfPixelRange);| Name | Type | Default |
|---|---|---|
msdfPixelRange | int | — |
SetMsdfSizevoid
public void SetMsdfSize(int msdfSize);| Name | Type | Default |
|---|---|---|
msdfSize | int | — |
SetMultichannelSignedDistanceFieldvoid
public void SetMultichannelSignedDistanceField(bool msdf);| Name | Type | Default |
|---|---|---|
msdf | bool | — |
SetOversamplingvoid
public void SetOversampling(float oversampling);| Name | Type | Default |
|---|---|---|
oversampling | float | — |
SetSubpixelPositioningvoid
public void SetSubpixelPositioning(TextServer.SubpixelPositioning subpixelPositioning);| Name | Type | Default |
|---|---|---|
subpixelPositioning | TextServer.SubpixelPositioning | — |