SystemFont
继承: Font
< Resource
< RefCounted
< Object
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.
属性
属性说明
bool
allow_system_fallback = true
If set to true
, system fonts can be automatically used as fallbacks.
FontAntialiasing antialiasing = 1
void
set_antialiasing ( value: FontAntialiasing )- FontAntialiasing get_antialiasing ( )
Font anti-aliasing mode.
bool
disable_embedded_bitmaps = true
If set to true
, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
bool
font_italic = false
If set to true
, italic or oblique font is preferred.
PackedStringArray
font_names = PackedStringArray()
void
set_font_names ( value:PackedStringArray
)PackedStringArray
get_font_names ( )
Array of font family names to search, first matching font found is used.
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
Preferred font stretch amount, compared to a normal width. A percentage value between 50%
and 200%
.
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
.
bool
force_autohinter = false
If set to true
, auto-hinting is supported and preferred over font built-in hinting.
bool
generate_mipmaps = false
If set to true
, generate mipmaps for the font textures.
Hinting hinting = 1
Font hinting mode.
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.
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.
bool
multichannel_signed_distance_field = false
void
set_multichannel_signed_distance_field ( value:bool
)bool
is_multichannel_signed_distance_field ( )
If set to true
, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
float
oversampling = 0.0
Font oversampling factor, if set to 0.0
global oversampling factor is used instead.
SubpixelPositioning subpixel_positioning = 1
void
set_subpixel_positioning ( value: SubpixelPositioning )- SubpixelPositioning get_subpixel_positioning ( )
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.SUBPIXEL_POSITIONING_AUTO
to automatically enable it based on the font size.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。