DynamicFont

Inherits: Font < Resource < Reference < Object

类别: 核心

简要说明

动态字体在运行时呈现矢量字体文件。

方法

无效

add_fallback ( DynamicFontData data )

DynamicFontData

get_fallback ( int idx ) const

int

get_fallback_count ( ) const

int

get_spacing ( int type ) const

无效

remove_fallback ( int idx )

无效

set_fallback ( int idx, DynamicFontData data )

无效

set_spacing ( int type, int value )

枚举

枚举 SpacingType

  • SPACING_TOP = 0 ---顶部间距。

  • SPACING_BOTTOM = 1 ---底部间距。

  • SPACING_CHAR = 2 ---字符间距。

  • SPACING_SPACE = 3 ---间距。

描述

动态字体在运行时动态呈现矢量字体文件(如ttf或otf),而不是使用预先呈现的纹理图集 BitmapFont . 这意味着更快的加载时间 BitmapFont 用于在运行时更改字体参数,如大小和间距。 DynamicFontData 用于引用字体文件路径。

var dynamic_font = DynamicFont.new()
dynamic_font.font_data = load("res://BarlowCondensed-Bold.ttf")
dynamic_font.size = 64
$"Label".set("custom_fonts/font", dynamic_font)

属性描述

  • int extra_spacing_bottom

违约

0

设定器

设置间距(值)

吸气剂

获取_间距()

底部的额外间距(像素)。

  • int extra_spacing_char

违约

0

设定器

设置间距(值)

吸气剂

获取_间距()

以像素为单位的额外字符间距。

  • int extra_spacing_space

违约

0

设定器

设置间距(值)

吸气剂

获取_间距()

以像素为单位的额外空间间隔。

  • int extra_spacing_top

违约

0

设定器

设置间距(值)

吸气剂

获取_间距()

顶部的额外间距(像素)。

设定器

设置字体数据(值)

吸气剂

获取字体数据()

字体数据。

违约

颜色(1,1,1,1)

设定器

设置轮廓颜色(值)

吸气剂

获取u轮廓u颜色()

  • int outline_size

违约

0

设定器

设置轮廓大小(值)

吸气剂

获取u大纲u大小()

违约

16

设定器

设置大小(值)

吸气剂

获取u大小()

字体大小。

违约

设定器

设置使用过滤器(值)

吸气剂

获取使用过滤器

如果 true ,使用过滤。

违约

设定器

设置“使用”mipmaps(值)

吸气剂

获取使用mipmaps()。

如果 true ,使用mipmapping。

方法说明

添加回退字体。

返回索引处的回退字体 idx .

  • int get_fallback_count ( ) const

返回回退字体的数目。

  • int get_spacing ( int type ) const

  • void remove_fallback ( int idx )

删除索引处的回退字体 idx .

在索引处设置回退字体 idx .

  • void set_spacing ( int type, int value )