123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ResourceImporterDynamicFont.xml.
- .. _class_ResourceImporterDynamicFont:
- ResourceImporterDynamicFont
- ===========================
- **Inherits:** :ref:`ResourceImporter<class_ResourceImporter>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Imports a TTF, TTC, OTF, OTC, WOFF or WOFF2 font file for font rendering that adapts to any size.
- .. rst-class:: classref-introduction-group
- 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 :ref:`ResourceImporterBMFont<class_ResourceImporterBMFont>` and :ref:`ResourceImporterImageFont<class_ResourceImporterImageFont>`.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - `Dynamic fonts - Using fonts <../tutorials/ui/gui_using_fonts.html#dynamic-fonts>`__
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`allow_system_fallback<class_ResourceImporterDynamicFont_property_allow_system_fallback>` | ``true`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`int<class_int>` | :ref:`antialiasing<class_ResourceImporterDynamicFont_property_antialiasing>` | ``1`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`compress<class_ResourceImporterDynamicFont_property_compress>` | ``true`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`disable_embedded_bitmaps<class_ResourceImporterDynamicFont_property_disable_embedded_bitmaps>` | ``true`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`Array<class_Array>` | :ref:`fallbacks<class_ResourceImporterDynamicFont_property_fallbacks>` | ``[]`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`force_autohinter<class_ResourceImporterDynamicFont_property_force_autohinter>` | ``false`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`generate_mipmaps<class_ResourceImporterDynamicFont_property_generate_mipmaps>` | ``false`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`int<class_int>` | :ref:`hinting<class_ResourceImporterDynamicFont_property_hinting>` | ``1`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`language_support<class_ResourceImporterDynamicFont_property_language_support>` | ``{}`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`int<class_int>` | :ref:`msdf_pixel_range<class_ResourceImporterDynamicFont_property_msdf_pixel_range>` | ``8`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`int<class_int>` | :ref:`msdf_size<class_ResourceImporterDynamicFont_property_msdf_size>` | ``48`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`multichannel_signed_distance_field<class_ResourceImporterDynamicFont_property_multichannel_signed_distance_field>` | ``false`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`opentype_features<class_ResourceImporterDynamicFont_property_opentype_features>` | ``{}`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`oversampling<class_ResourceImporterDynamicFont_property_oversampling>` | ``0.0`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`Array<class_Array>` | :ref:`preload<class_ResourceImporterDynamicFont_property_preload>` | ``[]`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`script_support<class_ResourceImporterDynamicFont_property_script_support>` | ``{}`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`int<class_int>` | :ref:`subpixel_positioning<class_ResourceImporterDynamicFont_property_subpixel_positioning>` | ``4`` |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_ResourceImporterDynamicFont_property_allow_system_fallback:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **allow_system_fallback** = ``true`` :ref:`🔗<class_ResourceImporterDynamicFont_property_allow_system_fallback>`
- 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 :ref:`fallbacks<class_ResourceImporterDynamicFont_property_fallbacks>`.
- \ **Note:** The appearance of system fonts varies across platforms. Loading system fonts is only supported on Windows, macOS, Linux, Android and iOS.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_antialiasing:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **antialiasing** = ``1`` :ref:`🔗<class_ResourceImporterDynamicFont_property_antialiasing>`
- 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 :ref:`subpixel_positioning<class_ResourceImporterDynamicFont_property_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 :ref:`ProjectSettings.gui/theme/lcd_subpixel_layout<class_ProjectSettings_property_gui/theme/lcd_subpixel_layout>`, which also allows falling back to grayscale antialiasing.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_compress:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **compress** = ``true`` :ref:`🔗<class_ResourceImporterDynamicFont_property_compress>`
- If ``true``, uses lossless compression for the resulting font.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_disable_embedded_bitmaps:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **disable_embedded_bitmaps** = ``true`` :ref:`🔗<class_ResourceImporterDynamicFont_property_disable_embedded_bitmaps>`
- If set to ``true``, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_fallbacks:
- .. rst-class:: classref-property
- :ref:`Array<class_Array>` **fallbacks** = ``[]`` :ref:`🔗<class_ResourceImporterDynamicFont_property_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 :ref:`language_support<class_ResourceImporterDynamicFont_property_language_support>` and :ref:`script_support<class_ResourceImporterDynamicFont_property_script_support>`). See also :ref:`allow_system_fallback<class_ResourceImporterDynamicFont_property_allow_system_fallback>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_force_autohinter:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **force_autohinter** = ``false`` :ref:`🔗<class_ResourceImporterDynamicFont_property_force_autohinter>`
- If ``true``, forces generation of hinting data for the font using `FreeType <https://freetype.org/>`__'s autohinter. This will make :ref:`hinting<class_ResourceImporterDynamicFont_property_hinting>` effective with fonts that don't include hinting data.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_generate_mipmaps:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **generate_mipmaps** = ``false`` :ref:`🔗<class_ResourceImporterDynamicFont_property_generate_mipmaps>`
- If ``true``, this font will have mipmaps generated. This prevents text from looking grainy when a :ref:`Control<class_Control>` is scaled down, or when a :ref:`Label3D<class_Label3D>` is viewed from a long distance (if :ref:`Label3D.texture_filter<class_Label3D_property_texture_filter>` is set to a mode that displays mipmaps).
- Enabling :ref:`generate_mipmaps<class_ResourceImporterDynamicFont_property_generate_mipmaps>` increases font generation time and memory usage. Only enable this setting if you actually need it.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_hinting:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **hinting** = ``1`` :ref:`🔗<class_ResourceImporterDynamicFont_property_hinting>`
- 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 :ref:`force_autohinter<class_ResourceImporterDynamicFont_property_force_autohinter>`).
- \ **None:** Smoothest appearance, which can make the font look blurry at small sizes.
- \ **Light:** Sharp result by snapping glyph edges to pixels on the Y axis only.
- \ **Full:** Sharpest by snapping glyph edges to pixels on both X and Y axes.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_language_support:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **language_support** = ``{}`` :ref:`🔗<class_ResourceImporterDynamicFont_property_language_support>`
- Override the list of languages supported by this font. If left empty, this is supplied by the font metadata. There is usually no need to change this. See also :ref:`script_support<class_ResourceImporterDynamicFont_property_script_support>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_msdf_pixel_range:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **msdf_pixel_range** = ``8`` :ref:`🔗<class_ResourceImporterDynamicFont_property_msdf_pixel_range>`
- The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, :ref:`msdf_pixel_range<class_ResourceImporterDynamicFont_property_msdf_pixel_range>` must be set to at least *twice* the size of the largest font outline. The default :ref:`msdf_pixel_range<class_ResourceImporterDynamicFont_property_msdf_pixel_range>` value of ``8`` allows outline sizes up to ``4`` to look correct.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_msdf_size:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **msdf_size** = ``48`` :ref:`🔗<class_ResourceImporterDynamicFont_property_msdf_size>`
- Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering. Only effective if :ref:`multichannel_signed_distance_field<class_ResourceImporterDynamicFont_property_multichannel_signed_distance_field>` is ``true``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_multichannel_signed_distance_field:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **multichannel_signed_distance_field** = ``false`` :ref:`🔗<class_ResourceImporterDynamicFont_property_multichannel_signed_distance_field>`
- If set to ``true``, the font will use multichannel signed distance field (MSDF) for crisp rendering at any size. Since this approach does not rely on rasterizing the font every time its size changes, this allows for resizing the font in real-time without any performance penalty. Text will also not look grainy for :ref:`Control<class_Control>`\ s that are scaled down (or for :ref:`Label3D<class_Label3D>`\ s viewed from a long distance).
- MSDF font rendering can be combined with :ref:`generate_mipmaps<class_ResourceImporterDynamicFont_property_generate_mipmaps>` to further improve font rendering quality when scaled down.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_opentype_features:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **opentype_features** = ``{}`` :ref:`🔗<class_ResourceImporterDynamicFont_property_opentype_features>`
- The OpenType features to enable, disable or set a value for this font. This can be used to enable optional features provided by the font, such as ligatures or alternative glyphs. The list of supported OpenType features varies on a per-font basis.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_oversampling:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **oversampling** = ``0.0`` :ref:`🔗<class_ResourceImporterDynamicFont_property_oversampling>`
- If set to a value greater than ``0.0``, overrides the oversampling factor for the font. This can be used to render the font at a higher or lower resolution than intended without affecting its physical size. In most cases, this should be left at ``0.0``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_preload:
- .. rst-class:: classref-property
- :ref:`Array<class_Array>` **preload** = ``[]`` :ref:`🔗<class_ResourceImporterDynamicFont_property_preload>`
- The glyph ranges to prerender. This can avoid stuttering during gameplay when new characters need to be rendered, especially if :ref:`subpixel_positioning<class_ResourceImporterDynamicFont_property_subpixel_positioning>` is enabled. The downside of using preloading is that initial project load times will increase, as well as memory usage.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_script_support:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **script_support** = ``{}`` :ref:`🔗<class_ResourceImporterDynamicFont_property_script_support>`
- Override the list of language scripts supported by this font. If left empty, this is supplied by the font metadata. There is usually no need to change this. See also :ref:`language_support<class_ResourceImporterDynamicFont_property_language_support>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterDynamicFont_property_subpixel_positioning:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **subpixel_positioning** = ``4`` :ref:`🔗<class_ResourceImporterDynamicFont_property_subpixel_positioning>`
- Subpixel positioning improves font rendering appearance, especially at smaller font sizes. The downside is that it takes more time to initially render the font, which can cause stuttering during gameplay, especially if used with large font sizes. This should be set to **Disabled** for fonts with a pixel art appearance.
- \ **Disabled:** No subpixel positioning. Lowest quality, fastest rendering.
- \ **Auto:** Use subpixel positioning at small font sizes (the chosen quality varies depending on font size). Large fonts will not use subpixel positioning. This is a good tradeoff between performance and quality.
- \ **One Half of a Pixel:** Always perform intermediate subpixel positioning regardless of font size. High quality, slow rendering.
- \ **One Quarter of a Pixel:** Always perform precise subpixel positioning regardless of font size. Highest quality, slowest rendering.
- \ **Auto (Except Pixel Fonts):** **Disabled** for the pixel style fonts (each glyph contours contain only straight horizontal and vertical lines), **Auto** for the other fonts.
- .. |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.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|