跳转至

BitmapFont

继承

Font

简要描述

使用[=] BMFont [/url]格式的字体呈现文本。

处理扩展名为.fnt的文件。

描述

使用包含纹理地图集的*.fnt字体渲染文本。

成员

类型 属性名 默认值
float ascent 0.0
bool distance_field false
BitmapFont fallback
float height 1.0

方法

返回值类型 方法名称
void add_char(character: int, texture: int, rect: Rect2, align: Vector2 = Vector2( 0, 0 ), advance: float = -1)
void add_kerning_pair(char_a: int, char_b: int, kerning: int)
void add_texture(texture: Texture)
void clear()
int create_from_fnt(path: String)
Vector2 get_char_size(char: int, next: int = 0) const
int get_kerning_pair(char_a: int, char_b: int) const
Texture get_texture(idx: int) const
int get_texture_count() const

常量

成员说明

  • float ascent
Default 0.0
setter set_ascent(value)
getter get_ascent
  • bool distance_field
Default false
setter set_distance_field_hint(value)
getter is_distance_field_hint
  • BitmapFont fallback
setter set_fallback(value)
getter get_fallback
  • float height
Default 1.0
setter set_height(value)
getter get_height

方法说明

  • add_char add_char(character: int, texture: int, rect: Rect2, align: Vector2 = Vector2( 0, 0 ), advance: float = -1)

在字体中添加一个字符,其中character是Unicode值,texture是纹理索引,rect是纹理中的区域


  • add_kerning_pair add_kerning_pair(char_a: int, char_b: int, kerning: int)

将字距调整对添加到BitmapFont


  • add_texture add_texture(texture: Texture)

将纹理添加到BitmapFont


  • clear clear()

清除所有字体数据和设置。


  • create_from_fnt create_from_fnt(path: String)

*.fnt文件中的path创建一个BitmapFont。


  • get_char_size get_char_size(char: int, next: int = 0) const

返回字符的大小,如果提供了下一个字符,则可以选择考虑调整字距。


  • get_kerning_pair get_kerning_pair(char_a: int, char_b: int) const

返回字距对作为差异。


  • get_texture get_texture(idx: int) const

返回索引为idx的字体图集纹理。


  • get_texture_count get_texture_count() const

返回BitmapFont地图集中的纹理数量。