Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SystemFont

繼承: Font < Resource < RefCounted < Object

從系統字形載入的字形。如果未在宿主作業系統上實作,則退回到預設主題字形。

說明

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.

屬性

bool

allow_system_fallback

true

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

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

SubpixelPositioning

subpixel_positioning

1


屬性說明

bool allow_system_fallback = true 🔗

  • void set_allow_system_fallback(value: bool)

  • bool is_allow_system_fallback()

如果設定為 true,則可以自動將系統字形作為退回使用。


FontAntialiasing antialiasing = 1 🔗

字形抗鋸齒模式。


bool disable_embedded_bitmaps = true 🔗

  • void set_disable_embedded_bitmaps(value: bool)

  • bool get_disable_embedded_bitmaps()

If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).


bool font_italic = false 🔗

  • void set_font_italic(value: bool)

  • bool get_font_italic()

如果設定為 true,則優先使用斜體(italic)或偽斜體(oblique)。


PackedStringArray font_names = PackedStringArray() 🔗

要搜索的字形家族名稱陣列,會使用第一個與之配對的字形。

Note: The returned array is copied and any changes to it will not update the original property value. See PackedStringArray for more details.


int font_stretch = 100 🔗

  • void set_font_stretch(value: int)

  • int get_font_stretch()

字形優先使用的拉伸量,相對於正常寬度。介於 50%200% 之間的百分比。


int font_weight = 400 🔗

  • void set_font_weight(value: int)

  • int get_font_weight()

字形優先使用的字重(粗度)。在 100...999 範圍內的值,正常字重為 400,粗體字重為 700


bool force_autohinter = false 🔗

  • void set_force_autohinter(value: bool)

  • bool is_force_autohinter()

如果設定為 true,則支援自動微調,優先於字形內建微調。


bool generate_mipmaps = false 🔗

  • void set_generate_mipmaps(value: bool)

  • bool get_generate_mipmaps()

如果設定為 true,則為字形紋理生成 mipmap。


Hinting hinting = 1 🔗

字形微調模式。


bool keep_rounding_remainders = true 🔗

  • void set_keep_rounding_remainders(value: bool)

  • bool get_keep_rounding_remainders()

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.


bool modulate_color_glyphs = false 🔗

  • void set_modulate_color_glyphs(value: bool)

  • bool is_modulate_color_glyphs()

If set to true, color modulation is applied when drawing colored glyphs, otherwise it's applied to the monochrome glyphs only.


int msdf_pixel_range = 16 🔗

  • void set_msdf_pixel_range(value: int)

  • int get_msdf_pixel_range()

最小和最大可表示的有符號距離之間的形狀周圍的範圍寬度。如果使用字形輪廓,msdf_pixel_range 必須至少設定為最大字形輪廓大小的兩倍msdf_pixel_range 的預設值為 16,允許大小最大到 8 的輪廓看起來正確。


int msdf_size = 48 🔗

  • void set_msdf_size(value: int)

  • int get_msdf_size()

用於生成 MSDF 紋理的源字形大小。較高的值允許更高的精度,但算繪速度較慢並且需要更多記憶體。只有當注意到字形算繪中明顯缺乏精度時,才增加該屬性的值。


bool multichannel_signed_distance_field = false 🔗

  • void set_multichannel_signed_distance_field(value: bool)

  • bool is_multichannel_signed_distance_field()

如果設定為 true,則所有大小的字形都將使用從動態字形向量資料生成的單個多通道帶符號距離場算繪。


float oversampling = 0.0 🔗

  • void set_oversampling(value: float)

  • float get_oversampling()

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.


SubpixelPositioning subpixel_positioning = 1 🔗

字形字形的次圖元定位模式。次圖元定位為較小的字形提供了更清晰的文字和更好的字偶距,但會犧牲記憶體佔用和字形柵格化速度。使用 TextServer.SUBPIXEL_POSITIONING_AUTO 可以根據字形大小自動啟用。