:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the FontData.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_FontData: FontData ======== **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Font source data and prerendered glyph cache, imported from dynamic or bitmap font. Supported font formats: - Dynamic font importer: TrueType (.ttf), OpenType (.otf), WOFF (.woff), Type 1 (.pfb, .pfm). - Bitmap font importer: AngelCode BMFont (.fnt, .font), text and binary (version 3) format variants. - Monospace image font importer: All supported image formats. Properties ---------- +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`bool` | :ref:`antialiased` | ``true`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`PackedByteArray` | :ref:`data` | ``PackedByteArray()`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`float` | :ref:`embolden` | ``0.0`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`fixed_size` | ``0`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`String` | :ref:`font_name` | ``""`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`font_style` | ``0`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`bool` | :ref:`force_autohinter` | ``false`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Hinting` | :ref:`hinting` | ``1`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`msdf_pixel_range` | ``16`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`msdf_size` | ``48`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`bool` | :ref:`multichannel_signed_distance_field` | ``false`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Dictionary` | :ref:`opentype_feature_overrides` | ``{}`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`float` | :ref:`oversampling` | ``0.0`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`String` | :ref:`style_name` | ``""`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`SubpixelPositioning` | :ref:`subpixel_positioning` | ``1`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Transform2D` | :ref:`transform` | ``Transform2D(1, 0, 0, 1, 0, 0)`` | +-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------------------+ Methods ------- +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_cache` **(** **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_glyphs` **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_kerning_map` **(** :ref:`int` cache_index, :ref:`int` size **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_size_cache` **(** :ref:`int` cache_index **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_textures` **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`find_cache` **(** :ref:`Dictionary` variation_coordinates **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_ascent` **(** :ref:`int` cache_index, :ref:`int` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_cache_count` **(** **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_cache_rid` **(** :ref:`int` cache_index **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_descent` **(** :ref:`int` cache_index, :ref:`int` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_glyph_advance` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`int` glyph **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_glyph_index` **(** :ref:`int` size, :ref:`int` char, :ref:`int` variation_selector **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_glyph_list` **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_glyph_offset` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_glyph_size` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_glyph_texture_idx` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_glyph_uv_rect` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_kerning` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`Vector2i` glyph_pair **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_kerning_list` **(** :ref:`int` cache_index, :ref:`int` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_language_support_override` **(** :ref:`String` language **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_language_support_overrides` **(** **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_scale` **(** :ref:`int` cache_index, :ref:`int` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_script_support_override` **(** :ref:`String` script **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_script_support_overrides` **(** **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_size_cache_list` **(** :ref:`int` cache_index **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_spacing` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`SpacingType` spacing_type **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_supported_chars` **(** **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_supported_feature_list` **(** **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_supported_variation_list` **(** **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_texture_count` **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Image` | :ref:`get_texture_image` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedInt32Array` | :ref:`get_texture_offsets` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_underline_position` **(** :ref:`int` cache_index, :ref:`int` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_underline_thickness` **(** :ref:`int` cache_index, :ref:`int` size **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_variation_coordinates` **(** :ref:`int` cache_index **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_char` **(** :ref:`int` char **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_language_supported` **(** :ref:`String` language **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_script_supported` **(** :ref:`String` script **)** |const| | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load_bitmap_font` **(** :ref:`String` path **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load_dynamic_font` **(** :ref:`String` path **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_cache` **(** :ref:`int` cache_index **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_glyph` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_kerning` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`Vector2i` glyph_pair **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_language_support_override` **(** :ref:`String` language **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_script_support_override` **(** :ref:`String` script **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_size_cache` **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_texture` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`render_glyph` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` index **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`render_range` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` start, :ref:`int` end **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_ascent` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` ascent **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_descent` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` descent **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_glyph_advance` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`int` glyph, :ref:`Vector2` advance **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_glyph_offset` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`Vector2` offset **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_glyph_size` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`Vector2` gl_size **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_glyph_texture_idx` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`int` texture_idx **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_glyph_uv_rect` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`Rect2` uv_rect **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_kerning` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`Vector2i` glyph_pair, :ref:`Vector2` kerning **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_language_support_override` **(** :ref:`String` language, :ref:`bool` supported **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_scale` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` scale **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_script_support_override` **(** :ref:`String` script, :ref:`bool` supported **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_spacing` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`SpacingType` spacing_type, :ref:`int` value **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture_image` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index, :ref:`Image` image **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture_offsets` **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index, :ref:`PackedInt32Array` offset **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_underline_position` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` underline_position **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_underline_thickness` **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` underline_thickness **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_variation_coordinates` **(** :ref:`int` cache_index, :ref:`Dictionary` variation_coordinates **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Property Descriptions --------------------- .. _class_FontData_property_antialiased: - :ref:`bool` **antialiased** +-----------+------------------------+ | *Default* | ``true`` | +-----------+------------------------+ | *Setter* | set_antialiased(value) | +-----------+------------------------+ | *Getter* | is_antialiased() | +-----------+------------------------+ If set to ``true``, font 8-bit anitialiased glyph rendering is supported and enabled. ---- .. _class_FontData_property_data: - :ref:`PackedByteArray` **data** +-----------+-----------------------+ | *Default* | ``PackedByteArray()`` | +-----------+-----------------------+ | *Setter* | set_data(value) | +-----------+-----------------------+ | *Getter* | get_data() | +-----------+-----------------------+ Contents of the dynamic font source file. ---- .. _class_FontData_property_embolden: - :ref:`float` **embolden** +-----------+---------------------+ | *Default* | ``0.0`` | +-----------+---------------------+ | *Setter* | set_embolden(value) | +-----------+---------------------+ | *Getter* | get_embolden() | +-----------+---------------------+ If is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness. ---- .. _class_FontData_property_fixed_size: - :ref:`int` **fixed_size** +-----------+-----------------------+ | *Default* | ``0`` | +-----------+-----------------------+ | *Setter* | set_fixed_size(value) | +-----------+-----------------------+ | *Getter* | get_fixed_size() | +-----------+-----------------------+ Font size, used only for the bitmap fonts. ---- .. _class_FontData_property_font_name: - :ref:`String` **font_name** +-----------+----------------------+ | *Default* | ``""`` | +-----------+----------------------+ | *Setter* | set_font_name(value) | +-----------+----------------------+ | *Getter* | get_font_name() | +-----------+----------------------+ Font family name. ---- .. _class_FontData_property_font_style: - :ref:`int` **font_style** +-----------+-----------------------+ | *Default* | ``0`` | +-----------+-----------------------+ | *Setter* | set_font_style(value) | +-----------+-----------------------+ | *Getter* | get_font_style() | +-----------+-----------------------+ Font style flags, see :ref:`FontStyle`. ---- .. _class_FontData_property_force_autohinter: - :ref:`bool` **force_autohinter** +-----------+-----------------------------+ | *Default* | ``false`` | +-----------+-----------------------------+ | *Setter* | set_force_autohinter(value) | +-----------+-----------------------------+ | *Getter* | is_force_autohinter() | +-----------+-----------------------------+ If set to ``true``, auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only. ---- .. _class_FontData_property_hinting: - :ref:`Hinting` **hinting** +-----------+--------------------+ | *Default* | ``1`` | +-----------+--------------------+ | *Setter* | set_hinting(value) | +-----------+--------------------+ | *Getter* | get_hinting() | +-----------+--------------------+ Font hinting mode. Used by dynamic fonts only. ---- .. _class_FontData_property_msdf_pixel_range: - :ref:`int` **msdf_pixel_range** +-----------+-----------------------------+ | *Default* | ``16`` | +-----------+-----------------------------+ | *Setter* | set_msdf_pixel_range(value) | +-----------+-----------------------------+ | *Getter* | get_msdf_pixel_range() | +-----------+-----------------------------+ The width of the range around the shape between the minimum and maximum representable signed distance. ---- .. _class_FontData_property_msdf_size: - :ref:`int` **msdf_size** +-----------+----------------------+ | *Default* | ``48`` | +-----------+----------------------+ | *Setter* | set_msdf_size(value) | +-----------+----------------------+ | *Getter* | get_msdf_size() | +-----------+----------------------+ Source font size used to generate MSDF textures. ---- .. _class_FontData_property_multichannel_signed_distance_field: - :ref:`bool` **multichannel_signed_distance_field** +-----------+-----------------------------------------------+ | *Default* | ``false`` | +-----------+-----------------------------------------------+ | *Setter* | set_multichannel_signed_distance_field(value) | +-----------+-----------------------------------------------+ | *Getter* | is_multichannel_signed_distance_field() | +-----------+-----------------------------------------------+ If set to ``true``, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. ---- .. _class_FontData_property_opentype_feature_overrides: - :ref:`Dictionary` **opentype_feature_overrides** +-----------+---------------------------------------+ | *Default* | ``{}`` | +-----------+---------------------------------------+ | *Setter* | set_opentype_feature_overrides(value) | +-----------+---------------------------------------+ | *Getter* | get_opentype_feature_overrides() | +-----------+---------------------------------------+ Font OpenType feature set override. ---- .. _class_FontData_property_oversampling: - :ref:`float` **oversampling** +-----------+-------------------------+ | *Default* | ``0.0`` | +-----------+-------------------------+ | *Setter* | set_oversampling(value) | +-----------+-------------------------+ | *Getter* | get_oversampling() | +-----------+-------------------------+ Font oversampling factor, if set to ``0.0`` global oversampling factor is used instead. Used by dynamic fonts only. ---- .. _class_FontData_property_style_name: - :ref:`String` **style_name** +-----------+----------------------------+ | *Default* | ``""`` | +-----------+----------------------------+ | *Setter* | set_font_style_name(value) | +-----------+----------------------------+ | *Getter* | get_font_style_name() | +-----------+----------------------------+ Font style name. ---- .. _class_FontData_property_subpixel_positioning: - :ref:`SubpixelPositioning` **subpixel_positioning** +-----------+---------------------------------+ | *Default* | ``1`` | +-----------+---------------------------------+ | *Setter* | set_subpixel_positioning(value) | +-----------+---------------------------------+ | *Getter* | get_subpixel_positioning() | +-----------+---------------------------------+ Font glyph sub-pixel positioning mode. Subpixel positioning provides shaper text and better kerning for smaller font sizes, at the cost of memory usage and font rasterization speed. Use :ref:`TextServer.SUBPIXEL_POSITIONING_AUTO` to automatically enable it based on the font size. ---- .. _class_FontData_property_transform: - :ref:`Transform2D` **transform** +-----------+-----------------------------------+ | *Default* | ``Transform2D(1, 0, 0, 1, 0, 0)`` | +-----------+-----------------------------------+ | *Setter* | set_transform(value) | +-----------+-----------------------------------+ | *Getter* | get_transform() | +-----------+-----------------------------------+ 2D transform, applied to the font outlines, can be used for slanting, flipping and rotating glyphs. For example, to simulate italic typeface by slanting, apply the following transform ``Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0)``. Method Descriptions ------------------- .. _class_FontData_method_clear_cache: - void **clear_cache** **(** **)** Removes all font cache entries. ---- .. _class_FontData_method_clear_glyphs: - void **clear_glyphs** **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** Removes all rendered glyphs information from the cache entry. \ **Note:** This function will not remove textures associated with the glyphs, use :ref:`remove_texture` to remove them manually. ---- .. _class_FontData_method_clear_kerning_map: - void **clear_kerning_map** **(** :ref:`int` cache_index, :ref:`int` size **)** Removes all kerning overrides. ---- .. _class_FontData_method_clear_size_cache: - void **clear_size_cache** **(** :ref:`int` cache_index **)** Removes all font sizes from the cache entry ---- .. _class_FontData_method_clear_textures: - void **clear_textures** **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** Removes all textures from font cache entry. \ **Note:** This function will not remove glyphs associated with the texture, use :ref:`remove_glyph` to remove them manually. ---- .. _class_FontData_method_find_cache: - :ref:`RID` **find_cache** **(** :ref:`Dictionary` variation_coordinates **)** |const| Returns existing or creates a new font cache entry for the specified variation coordinates. ---- .. _class_FontData_method_get_ascent: - :ref:`float` **get_ascent** **(** :ref:`int` cache_index, :ref:`int` size **)** |const| Returns the font ascent (number of pixels above the baseline). ---- .. _class_FontData_method_get_cache_count: - :ref:`int` **get_cache_count** **(** **)** |const| Returns number of the font cache entries. ---- .. _class_FontData_method_get_cache_rid: - :ref:`RID` **get_cache_rid** **(** :ref:`int` cache_index **)** |const| Returns text server font cache entry resource id. ---- .. _class_FontData_method_get_descent: - :ref:`float` **get_descent** **(** :ref:`int` cache_index, :ref:`int` size **)** |const| Returns font descent (number of pixels below the baseline). ---- .. _class_FontData_method_get_glyph_advance: - :ref:`Vector2` **get_glyph_advance** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`int` glyph **)** |const| Returns glyph advance (offset of the next glyph). \ **Note:** Advance for glyphs outlines is the same as the base glyph advance and is not saved. ---- .. _class_FontData_method_get_glyph_index: - :ref:`int` **get_glyph_index** **(** :ref:`int` size, :ref:`int` char, :ref:`int` variation_selector **)** |const| Returns the glyph index of a ``char``, optionally modified by the ``variation_selector``. ---- .. _class_FontData_method_get_glyph_list: - :ref:`Array` **get_glyph_list** **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** |const| Returns list of rendered glyphs in the cache entry. ---- .. _class_FontData_method_get_glyph_offset: - :ref:`Vector2` **get_glyph_offset** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| Returns glyph offset from the baseline. ---- .. _class_FontData_method_get_glyph_size: - :ref:`Vector2` **get_glyph_size** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| Returns glyph size. ---- .. _class_FontData_method_get_glyph_texture_idx: - :ref:`int` **get_glyph_texture_idx** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| Returns index of the cache texture containing the glyph. ---- .. _class_FontData_method_get_glyph_uv_rect: - :ref:`Rect2` **get_glyph_uv_rect** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** |const| Returns rectangle in the cache texture containing the glyph. ---- .. _class_FontData_method_get_kerning: - :ref:`Vector2` **get_kerning** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`Vector2i` glyph_pair **)** |const| Returns kerning for the pair of glyphs. ---- .. _class_FontData_method_get_kerning_list: - :ref:`Array` **get_kerning_list** **(** :ref:`int` cache_index, :ref:`int` size **)** |const| Returns list of the kerning overrides. ---- .. _class_FontData_method_get_language_support_override: - :ref:`bool` **get_language_support_override** **(** :ref:`String` language **)** |const| Returns ``true`` if support override is enabled for the ``language``. ---- .. _class_FontData_method_get_language_support_overrides: - :ref:`PackedStringArray` **get_language_support_overrides** **(** **)** |const| Returns list of language support overrides. ---- .. _class_FontData_method_get_scale: - :ref:`float` **get_scale** **(** :ref:`int` cache_index, :ref:`int` size **)** |const| Returns scaling factor of the color bitmap font. ---- .. _class_FontData_method_get_script_support_override: - :ref:`bool` **get_script_support_override** **(** :ref:`String` script **)** |const| Returns ``true`` if support override is enabled for the ``script``. ---- .. _class_FontData_method_get_script_support_overrides: - :ref:`PackedStringArray` **get_script_support_overrides** **(** **)** |const| Returns list of script support overrides. ---- .. _class_FontData_method_get_size_cache_list: - :ref:`Array` **get_size_cache_list** **(** :ref:`int` cache_index **)** |const| Returns list of the font sizes in the cache. Each size is ``Vector2i`` with font size and outline size. ---- .. _class_FontData_method_get_spacing: - :ref:`int` **get_spacing** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`SpacingType` spacing_type **)** |const| Returns extra spacing added between glyphs in pixels. ---- .. _class_FontData_method_get_supported_chars: - :ref:`String` **get_supported_chars** **(** **)** |const| Returns a string containing all the characters available in the font. ---- .. _class_FontData_method_get_supported_feature_list: - :ref:`Dictionary` **get_supported_feature_list** **(** **)** |const| Returns list of OpenType features supported by font. ---- .. _class_FontData_method_get_supported_variation_list: - :ref:`Dictionary` **get_supported_variation_list** **(** **)** |const| Returns list of supported `variation coordinates `__, each coordinate is returned as ``tag: Vector3i(min_value,max_value,default_value)``. Font variations allow for continuous change of glyph characteristics along some given design axis, such as weight, width or slant. ---- .. _class_FontData_method_get_texture_count: - :ref:`int` **get_texture_count** **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** |const| Returns number of textures used by font cache entry. ---- .. _class_FontData_method_get_texture_image: - :ref:`Image` **get_texture_image** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index **)** |const| Returns a copy of the font cache texture image. ---- .. _class_FontData_method_get_texture_offsets: - :ref:`PackedInt32Array` **get_texture_offsets** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index **)** |const| Returns a copy of the array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty. ---- .. _class_FontData_method_get_underline_position: - :ref:`float` **get_underline_position** **(** :ref:`int` cache_index, :ref:`int` size **)** |const| Returns pixel offset of the underline below the baseline. ---- .. _class_FontData_method_get_underline_thickness: - :ref:`float` **get_underline_thickness** **(** :ref:`int` cache_index, :ref:`int` size **)** |const| Returns thickness of the underline in pixels. ---- .. _class_FontData_method_get_variation_coordinates: - :ref:`Dictionary` **get_variation_coordinates** **(** :ref:`int` cache_index **)** |const| Returns variation coordinates for the specified font cache entry. See :ref:`get_supported_variation_list` for more info. ---- .. _class_FontData_method_has_char: - :ref:`bool` **has_char** **(** :ref:`int` char **)** |const| Returns ``true`` if a Unicode ``char`` is available in the font. ---- .. _class_FontData_method_is_language_supported: - :ref:`bool` **is_language_supported** **(** :ref:`String` language **)** |const| Returns ``true``, if font supports given language (`ISO 639 `__ code). ---- .. _class_FontData_method_is_script_supported: - :ref:`bool` **is_script_supported** **(** :ref:`String` script **)** |const| Returns ``true``, if font supports given script (`ISO 15924 `__ code). ---- .. _class_FontData_method_load_bitmap_font: - :ref:`Error` **load_bitmap_font** **(** :ref:`String` path **)** Loads an AngelCode BMFont (.fnt, .font) bitmap font from file ``path``. \ **Warning:** This method should only be used in the editor or in cases when you need to load external fonts at run-time, such as fonts located at the ``user://`` directory. ---- .. _class_FontData_method_load_dynamic_font: - :ref:`Error` **load_dynamic_font** **(** :ref:`String` path **)** Loads a TrueType (.ttf), OpenType (.otf), WOFF (.woff) or Type 1 (.pfb, .pfm) dynamic font from file ``path``. \ **Warning:** This method should only be used in the editor or in cases when you need to load external fonts at run-time, such as fonts located at the ``user://`` directory. ---- .. _class_FontData_method_remove_cache: - void **remove_cache** **(** :ref:`int` cache_index **)** Removes specified font cache entry. ---- .. _class_FontData_method_remove_glyph: - void **remove_glyph** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph **)** Removes specified rendered glyph information from the cache entry. \ **Note:** This function will not remove textures associated with the glyphs, use :ref:`remove_texture` to remove them manually. ---- .. _class_FontData_method_remove_kerning: - void **remove_kerning** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`Vector2i` glyph_pair **)** Removes kerning override for the pair of glyphs. ---- .. _class_FontData_method_remove_language_support_override: - void **remove_language_support_override** **(** :ref:`String` language **)** Remove language support override. ---- .. _class_FontData_method_remove_script_support_override: - void **remove_script_support_override** **(** :ref:`String` script **)** Removes script support override. ---- .. _class_FontData_method_remove_size_cache: - void **remove_size_cache** **(** :ref:`int` cache_index, :ref:`Vector2i` size **)** Removes specified font size from the cache entry. ---- .. _class_FontData_method_remove_texture: - void **remove_texture** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index **)** Removes specified texture from font cache entry. \ **Note:** This function will not remove glyphs associated with the texture, remove them manually, using :ref:`remove_glyph`. ---- .. _class_FontData_method_render_glyph: - void **render_glyph** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` index **)** Renders specified glyph the the font cache texture. ---- .. _class_FontData_method_render_range: - void **render_range** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` start, :ref:`int` end **)** Renders the range of characters to the font cache texture. ---- .. _class_FontData_method_set_ascent: - void **set_ascent** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` ascent **)** Sets the font ascent (number of pixels above the baseline). ---- .. _class_FontData_method_set_descent: - void **set_descent** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` descent **)** Sets the font descent (number of pixels below the baseline). ---- .. _class_FontData_method_set_glyph_advance: - void **set_glyph_advance** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`int` glyph, :ref:`Vector2` advance **)** Sets glyph advance (offset of the next glyph). \ **Note:** Advance for glyphs outlines is the same as the base glyph advance and is not saved. ---- .. _class_FontData_method_set_glyph_offset: - void **set_glyph_offset** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`Vector2` offset **)** Sets glyph offset from the baseline. ---- .. _class_FontData_method_set_glyph_size: - void **set_glyph_size** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`Vector2` gl_size **)** Sets glyph size. ---- .. _class_FontData_method_set_glyph_texture_idx: - void **set_glyph_texture_idx** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`int` texture_idx **)** Sets index of the cache texture containing the glyph. ---- .. _class_FontData_method_set_glyph_uv_rect: - void **set_glyph_uv_rect** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` glyph, :ref:`Rect2` uv_rect **)** Sets rectangle in the cache texture containing the glyph. ---- .. _class_FontData_method_set_kerning: - void **set_kerning** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`Vector2i` glyph_pair, :ref:`Vector2` kerning **)** Sets kerning for the pair of glyphs. ---- .. _class_FontData_method_set_language_support_override: - void **set_language_support_override** **(** :ref:`String` language, :ref:`bool` supported **)** Adds override for :ref:`is_language_supported`. ---- .. _class_FontData_method_set_scale: - void **set_scale** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` scale **)** Sets scaling factor of the color bitmap font. ---- .. _class_FontData_method_set_script_support_override: - void **set_script_support_override** **(** :ref:`String` script, :ref:`bool` supported **)** Adds override for :ref:`is_script_supported`. ---- .. _class_FontData_method_set_spacing: - void **set_spacing** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`SpacingType` spacing_type, :ref:`int` value **)** Sets extra spacing added between glyphs in pixels. ---- .. _class_FontData_method_set_texture_image: - void **set_texture_image** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index, :ref:`Image` image **)** Sets font cache texture image. ---- .. _class_FontData_method_set_texture_offsets: - void **set_texture_offsets** **(** :ref:`int` cache_index, :ref:`Vector2i` size, :ref:`int` texture_index, :ref:`PackedInt32Array` offset **)** Sets array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty (for the fonts without dynamic glyph generation support). ---- .. _class_FontData_method_set_underline_position: - void **set_underline_position** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` underline_position **)** Sets pixel offset of the underline below the baseline. ---- .. _class_FontData_method_set_underline_thickness: - void **set_underline_thickness** **(** :ref:`int` cache_index, :ref:`int` size, :ref:`float` underline_thickness **)** Sets thickness of the underline in pixels. ---- .. _class_FontData_method_set_variation_coordinates: - void **set_variation_coordinates** **(** :ref:`int` cache_index, :ref:`Dictionary` variation_coordinates **)** Sets variation coordinates for the specified font cache entry. See :ref:`get_supported_variation_list` for more info. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`