Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

ResourceImporterImageFont

Inherits: ResourceImporter < RefCounted < Object

Imports a fixed-width bitmap font where all glyphs have the same width and height.

Description

This image-based workflow can be easier to use than ResourceImporterBMFont, but it requires all glyphs to have the same width and height. This makes ResourceImporterImageFont most suited to fixed-width fonts.

See also ResourceImporterDynamicFont.

Tutorials

Properties

Rect2i

character_margin

Rect2i(0, 0, 0, 0)

PackedStringArray

character_ranges

PackedStringArray()

int

columns

1

bool

compress

true

Array

fallbacks

[]

Rect2i

image_margin

Rect2i(0, 0, 0, 0)

int

rows

1

int

scaling_mode

2


Property Descriptions

Rect2i character_margin = Rect2i(0, 0, 0, 0)

Margin applied around every imported glyph. If your font image contains guides (in the form of lines between glyphs) or if spacing between characters appears incorrect, try adjusting character_margin.


PackedStringArray character_ranges = PackedStringArray()

The character ranges to import from the font image. This is an array that maps each position on the image (in tile coordinates, not pixels). The font atlas is traversed from left to right and top to bottom. Characters can be specified with decimal numbers (127), hexadecimal numbers (0x007f) or between single quotes ('~'). Ranges can be specified with a hyphen between characters.

For instance, 0-127 (or 0x0000-0x007f) denotes the full ASCII range. As another example, ' '-'~' is equivalent to 32-127 and denotes the range of printable (visible) ASCII characters.

Make sure character_ranges doesn't exceed the number of columns * rows defined. Otherwise, the font will fail to import.


int columns =