c6cea6e9b3
Thanks to @bojidar-bg's impressive work in #29380.
108 lines
3.9 KiB
XML
108 lines
3.9 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="DynamicFont" inherits="Font" category="Core" version="3.2">
|
|
<brief_description>
|
|
DynamicFont renders vector font files at runtime.
|
|
</brief_description>
|
|
<description>
|
|
DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like [BitmapFont]. This trades the faster loading time of [BitmapFont]s for the ability to change font parameters like size and spacing during runtime. [DynamicFontData] is used for referencing the font file paths.
|
|
[codeblock]
|
|
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)
|
|
[/codeblock]
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="add_fallback">
|
|
<return type="void">
|
|
</return>
|
|
<argument index="0" name="data" type="DynamicFontData">
|
|
</argument>
|
|
<description>
|
|
Adds a fallback font.
|
|
</description>
|
|
</method>
|
|
<method name="get_fallback" qualifiers="const">
|
|
<return type="DynamicFontData">
|
|
</return>
|
|
<argument index="0" name="idx" type="int">
|
|
</argument>
|
|
<description>
|
|
Returns the fallback font at index [code]idx[/code].
|
|
</description>
|
|
</method>
|
|
<method name="get_fallback_count" qualifiers="const">
|
|
<return type="int">
|
|
</return>
|
|
<description>
|
|
Returns the number of fallback fonts.
|
|
</description>
|
|
</method>
|
|
<method name="remove_fallback">
|
|
<return type="void">
|
|
</return>
|
|
<argument index="0" name="idx" type="int">
|
|
</argument>
|
|
<description>
|
|
Removes the fallback font at index [code]idx[/code].
|
|
</description>
|
|
</method>
|
|
<method name="set_fallback">
|
|
<return type="void">
|
|
</return>
|
|
<argument index="0" name="idx" type="int">
|
|
</argument>
|
|
<argument index="1" name="data" type="DynamicFontData">
|
|
</argument>
|
|
<description>
|
|
Sets the fallback font at index [code]idx[/code].
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="extra_spacing_bottom" type="int" setter="set_spacing" getter="get_spacing" default="0">
|
|
Extra spacing at the bottom in pixels.
|
|
</member>
|
|
<member name="extra_spacing_char" type="int" setter="set_spacing" getter="get_spacing" default="0">
|
|
Extra character spacing in pixels.
|
|
</member>
|
|
<member name="extra_spacing_space" type="int" setter="set_spacing" getter="get_spacing" default="0">
|
|
Extra space spacing in pixels.
|
|
</member>
|
|
<member name="extra_spacing_top" type="int" setter="set_spacing" getter="get_spacing" default="0">
|
|
Extra spacing at the top in pixels.
|
|
</member>
|
|
<member name="font_data" type="DynamicFontData" setter="set_font_data" getter="get_font_data" default="null">
|
|
The font data.
|
|
</member>
|
|
<member name="outline_color" type="Color" setter="set_outline_color" getter="get_outline_color" default="Color( 1, 1, 1, 1 )">
|
|
</member>
|
|
<member name="outline_size" type="int" setter="set_outline_size" getter="get_outline_size" default="0">
|
|
</member>
|
|
<member name="size" type="int" setter="set_size" getter="get_size" default="16">
|
|
The font size.
|
|
</member>
|
|
<member name="use_filter" type="bool" setter="set_use_filter" getter="get_use_filter" default="false">
|
|
If [code]true[/code], filtering is used.
|
|
</member>
|
|
<member name="use_mipmaps" type="bool" setter="set_use_mipmaps" getter="get_use_mipmaps" default="false">
|
|
If [code]true[/code], mipmapping is used.
|
|
</member>
|
|
</members>
|
|
<constants>
|
|
<constant name="SPACING_TOP" value="0" enum="SpacingType">
|
|
Spacing at the top.
|
|
</constant>
|
|
<constant name="SPACING_BOTTOM" value="1" enum="SpacingType">
|
|
Spacing at the bottom.
|
|
</constant>
|
|
<constant name="SPACING_CHAR" value="2" enum="SpacingType">
|
|
Character spacing.
|
|
</constant>
|
|
<constant name="SPACING_SPACE" value="3" enum="SpacingType">
|
|
Space spacing.
|
|
</constant>
|
|
</constants>
|
|
</class>
|