ResourceImporterImageFont
继承: ResourceImporter < RefCounted < Object
Imports a bitmap font where all glyphs have the same width and height.
描述
This image-based workflow can be easier to use than ResourceImporterBMFont, but it requires all glyphs to have the same width and height, glyph advances and drawing offsets can be customized. This makes ResourceImporterImageFont most suited to fixed-width fonts.
See also ResourceImporterDynamicFont.
教程
属性
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|
属性说明
字体的上高(基线上方的像素数)。如果设为 0
则使用字符高度的一半。
Rect2i character_margin = Rect2i(0, 0, 0, 0)
🔗
在每个导入的字形周围应用边距。如果你的字体图像包含参考线(以字形之间的线的形式)或者字符之间的间距看起来不正确,请尝试调整 character_margin。
PackedStringArray character_ranges = PackedStringArray()
🔗
从字体图像导入的字符范围。这是一个数组,能够对图像上的每一个位置做映射(使用图块坐标,而非像素坐标)。字体图集是从左到右、从上到下遍历的。可以使用十进制数字(127)、十六进制数字(0x007f
或 U+007f
)、单引号('~'
)来指定字符。在字符之间加上连字符指定的就是一个范围。
例如 0-127
表示的是完整的 ASCII 范围。这个范围也可以写作 0x0000-0x007f
(或者 U+0000-U+007f
)。再比如,' '-'~'
等价于 32-127
,表示的是可打印(可见)ASCII 字符的范围。
指定范围时如果在后面加上三个用空格分隔的整数值,就可以自定义字符的前进量和偏移(额外前进量、X 偏移量、Y 偏移量)。例如 'a'-'b' 4 5 2
就是将 a 和 b 这两个字符的前进量设为 char_width + 4
并将偏移量设为 Vector2(5, 2)
。
请确保 character_ranges 不超过 columns * rows 定义的数量。否则字体将无法导入。
Note: The returned array is copied and any changes to it will not update the original property value. See PackedStringArray for more details.
字体图像中的列数。另见 rows。
如果为 true
,则会对得到的字体使用无损压缩。
字体的下深(基线下方的像素数)。如果设为 0
则使用字符高度的一半。
回退字体列表,在这个位图字体中未找到某个字形时使用。优先尝试靠前的字体。
Rect2i image_margin = Rect2i(0, 0, 0, 0)
🔗
整个图像两侧的裁减边距。这可被用于裁减该图像包含属性信息或类似信息的部分。
PackedStringArray kerning_pairs = PackedStringArray()
🔗
字体中的字偶列表。字偶的作用是调整特定的两个字符的间距。
每个字符串都是由空格分隔的三个值:“from”字符串、“to”字符串、整数偏移量。两个字符串中的字符两两组合成字偶,例如 ab cd -3
会创建字偶 ac
、ad
、bc
、bd
,这些字偶的偏移量都是 -3
。
Note: The returned array is copied and any changes to it will not update the original property value. See PackedStringArray for more details.
字体图像中的行数。另见 columns。
字体缩放模式。