Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
ResourceImporterDynamicFont¶
Inherits: ResourceImporter < RefCounted < Object
Imports a TTF, TTC, OTF, OTC, WOFF or WOFF2 font file for font rendering that adapts to any size.
Description¶
Unlike bitmap fonts, dynamic fonts can be resized to any size and still look crisp. Dynamic fonts also optionally support MSDF font rendering, which allows for run-time scale changes with no re-rasterization cost.
While WOFF and especially WOFF2 tend to result in smaller file sizes, there is no universally "better" font format. In most situations, it's recommended to use the font format that was shipped on the font developer's website.
See also ResourceImporterBMFont and ResourceImporterImageFont.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Property Descriptions¶
bool allow_system_fallback = true
If true
, automatically use system fonts as a fallback if a glyph isn't found in this dynamic font. This makes supporting CJK characters or emoji more straightforward, as you don't need to include a CJK/emoji font in your project. See also fallbacks.
Note: The appearance of system fonts varies across platforms. Loading system fonts is only supported on Windows, macOS, Linux, Android and iOS.
int antialiasing = 1
The font antialiasing method to use.
Disabled: Most suited for pixel art fonts, although you do not have to change the antialiasing from the default Grayscale if the font file was well-created and the font is used at an integer multiple of its intended size. If pixel art fonts have a bad appearance at their intended size, try setting subpixel_positioning to Disabled instead.
Grayscale: Use grayscale antialiasing. This is the approach used by the operating system on macOS, Android and iOS.
LCD Subpixel: Use antialiasing with subpixel patterns to make fonts sharper on LCD displays. This is the approach used by the operating system on Windows and most Linux distributions. The downside is that this can introduce "fringing" on edges, especially on display technologies that don't use standard RGB subpixels (such as OLED displays). The LCD subpixel layout is globally controlled by ProjectSettings.gui/theme/lcd_subpixel_layout, which also allows falling back to grayscale antialiasing.
bool compress = true
If true
, uses lossless compression for the resulting font.
Array fallbacks = []
List of font fallbacks to use if a glyph isn't found in this dynamic font. Fonts at the beginning of the array are attempted first, but fallback fonts that don't support the glyph's language and script are attempted last (see language_support and script_support). See also allow_system_fallback.
bool force_autohinter = false
If true
, forces generation of hinting data for the font using FreeType's autohinter. This will make hinting effective with fonts that don't include hinting data.
bool generate_mipmaps = false
If true
, this font will have mipmaps generated. This prevents text from looking grainy when a Control is scaled down, or when a Label3D is viewed from a long distance (if Label3D.texture_filter is set to a mode that displays mipmaps).
Enabling generate_mipmaps increases font generation time and memory usage. Only enable this setting if you actually need it.
int hinting = 1
The hinting mode to use. This controls how aggressively glyph edges should be snapped to pixels when rasterizing the font. Depending on personal preference, you may prefer using one hinting mode over the other. Hinting modes other than None are only effective if the font contains hinting data (see force_autohinter).