Files
godot-docs-l10n/classes/zh_Hans/class_fontfile.rst

1478 lines
93 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_FontFile:
FontFile
========
**继承:** :ref:`Font<class_Font>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
存放字体源数据和预渲染字形的缓存,从动态字体或位图字体导入。
.. rst-class:: classref-introduction-group
描述
----
**FontFile** 包含了一组字形,代表从字体文件中导入的 Unicode 字符,还包含了光栅化字形的缓存,以及一组备用的回退 :ref:`Font<class_Font>`\ 。
要访问字体的 OpenType 变体,创建模拟的粗体/斜体版本,或者绘制文本行,请使用 :ref:`FontVariation<class_FontVariation>`\ 。
要进行更复杂的文本处理,请将 :ref:`FontVariation<class_FontVariation>`:ref:`TextLine<class_TextLine>`:ref:`TextParagraph<class_TextParagraph>` 结合使用。
支持的字体格式:
- 动态字体导入器TrueType.ttf、TrueType 合集(.ttc、OpenType.otf、OpenType 合集(.otc、WOFF.woff、WOFF2.woff2、Type 1.pfb.pfm
- 位图字体导入器AngelCode BMFont.fnt.font支持文本和二进制版本 3格式变体。
- 等宽图像字体导入器:所有支持的图像格式。
\ **注意:**\ 字符character是一种表示某个项目字母、数字等的抽象符号。
\ **注意:**\ 字形glphy是一种位图或形状用于根据上下文绘制一个或多个字符。字形索引绑定的是某个字体数据源。
\ **注意:**\ 如果所有字体数据源都不包含字符串中某个字符的字形,那么该字符就会被替换为一个中间是对应十六进制码的方框。
.. tabs::
.. code-tab:: gdscript
var f = load("res://BarlowCondensed-Bold.ttf")
$Label.add_theme_font_override("font", f)
$Label.add_theme_font_size_override("font_size", 64)
.. code-tab:: csharp
var f = ResourceLoader.Load<FontFile>("res://BarlowCondensed-Bold.ttf");
GetNode("Label").AddThemeFontOverride("font", f);
GetNode("Label").AddThemeFontSizeOverride("font_size", 64);
.. rst-class:: classref-introduction-group
教程
----
- :doc:`运行时文件加载与保存 <../tutorials/io/runtime_file_loading_and_saving>`
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`allow_system_fallback<class_FontFile_property_allow_system_fallback>` | ``true`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` | :ref:`antialiasing<class_FontFile_property_antialiasing>` | ``1`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`data<class_FontFile_property_data>` | ``PackedByteArray()`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`disable_embedded_bitmaps<class_FontFile_property_disable_embedded_bitmaps>` | ``true`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`fixed_size<class_FontFile_property_fixed_size>` | ``0`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`FixedSizeScaleMode<enum_TextServer_FixedSizeScaleMode>` | :ref:`fixed_size_scale_mode<class_FontFile_property_fixed_size_scale_mode>` | ``0`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`String<class_String>` | :ref:`font_name<class_FontFile_property_font_name>` | ``""`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`font_stretch<class_FontFile_property_font_stretch>` | ``100`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| |bitfield|\[:ref:`FontStyle<enum_TextServer_FontStyle>`\] | :ref:`font_style<class_FontFile_property_font_style>` | ``0`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`font_weight<class_FontFile_property_font_weight>` | ``400`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`force_autohinter<class_FontFile_property_force_autohinter>` | ``false`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`generate_mipmaps<class_FontFile_property_generate_mipmaps>` | ``false`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`Hinting<enum_TextServer_Hinting>` | :ref:`hinting<class_FontFile_property_hinting>` | ``1`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`keep_rounding_remainders<class_FontFile_property_keep_rounding_remainders>` | ``true`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`modulate_color_glyphs<class_FontFile_property_modulate_color_glyphs>` | ``false`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` | ``16`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`msdf_size<class_FontFile_property_msdf_size>` | ``48`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` | ``false`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`opentype_feature_overrides<class_FontFile_property_opentype_feature_overrides>` | ``{}`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`oversampling<class_FontFile_property_oversampling>` | ``0.0`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`String<class_String>` | :ref:`style_name<class_FontFile_property_style_name>` | ``""`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
| :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` | :ref:`subpixel_positioning<class_FontFile_property_subpixel_positioning>` | ``1`` |
+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_cache<class_FontFile_method_clear_cache>`\ (\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_glyphs<class_FontFile_method_clear_glyphs>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_kerning_map<class_FontFile_method_clear_kerning_map>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_size_cache<class_FontFile_method_clear_size_cache>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_textures<class_FontFile_method_clear_textures>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_cache_ascent<class_FontFile_method_get_cache_ascent>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_cache_count<class_FontFile_method_get_cache_count>`\ (\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_cache_descent<class_FontFile_method_get_cache_descent>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_cache_scale<class_FontFile_method_get_cache_scale>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_cache_underline_position<class_FontFile_method_get_cache_underline_position>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_cache_underline_thickness<class_FontFile_method_get_cache_underline_thickness>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_char_from_glyph_index<class_FontFile_method_get_char_from_glyph_index>`\ (\ size\: :ref:`int<class_int>`, glyph_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_embolden<class_FontFile_method_get_embolden>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_extra_baseline_offset<class_FontFile_method_get_extra_baseline_offset>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_extra_spacing<class_FontFile_method_get_extra_spacing>`\ (\ cache_index\: :ref:`int<class_int>`, spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_face_index<class_FontFile_method_get_face_index>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_glyph_advance<class_FontFile_method_get_glyph_advance>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_glyph_index<class_FontFile_method_get_glyph_index>`\ (\ size\: :ref:`int<class_int>`, char\: :ref:`int<class_int>`, variation_selector\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_glyph_list<class_FontFile_method_get_glyph_list>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_glyph_offset<class_FontFile_method_get_glyph_offset>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_glyph_size<class_FontFile_method_get_glyph_size>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_glyph_texture_idx<class_FontFile_method_get_glyph_texture_idx>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Rect2<class_Rect2>` | :ref:`get_glyph_uv_rect<class_FontFile_method_get_glyph_uv_rect>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_kerning<class_FontFile_method_get_kerning>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph_pair\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] | :ref:`get_kerning_list<class_FontFile_method_get_kerning_list>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_language_support_override<class_FontFile_method_get_language_support_override>`\ (\ language\: :ref:`String<class_String>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_language_support_overrides<class_FontFile_method_get_language_support_overrides>`\ (\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_script_support_override<class_FontFile_method_get_script_support_override>`\ (\ script\: :ref:`String<class_String>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_script_support_overrides<class_FontFile_method_get_script_support_overrides>`\ (\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] | :ref:`get_size_cache_list<class_FontFile_method_get_size_cache_list>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_texture_count<class_FontFile_method_get_texture_count>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Image<class_Image>` | :ref:`get_texture_image<class_FontFile_method_get_texture_image>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_texture_offsets<class_FontFile_method_get_texture_offsets>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform2D<class_Transform2D>` | :ref:`get_transform<class_FontFile_method_get_transform>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_variation_coordinates<class_FontFile_method_get_variation_coordinates>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_bitmap_font<class_FontFile_method_load_bitmap_font>`\ (\ path\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_dynamic_font<class_FontFile_method_load_dynamic_font>`\ (\ path\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_cache<class_FontFile_method_remove_cache>`\ (\ cache_index\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_glyph<class_FontFile_method_remove_glyph>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_kerning<class_FontFile_method_remove_kerning>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph_pair\: :ref:`Vector2i<class_Vector2i>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_language_support_override<class_FontFile_method_remove_language_support_override>`\ (\ language\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_script_support_override<class_FontFile_method_remove_script_support_override>`\ (\ script\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_size_cache<class_FontFile_method_remove_size_cache>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_texture<class_FontFile_method_remove_texture>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`render_glyph<class_FontFile_method_render_glyph>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, index\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`render_range<class_FontFile_method_render_range>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, start\: :ref:`int<class_int>`, end\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cache_ascent<class_FontFile_method_set_cache_ascent>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, ascent\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cache_descent<class_FontFile_method_set_cache_descent>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, descent\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cache_scale<class_FontFile_method_set_cache_scale>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, scale\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cache_underline_position<class_FontFile_method_set_cache_underline_position>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, underline_position\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cache_underline_thickness<class_FontFile_method_set_cache_underline_thickness>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, underline_thickness\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_embolden<class_FontFile_method_set_embolden>`\ (\ cache_index\: :ref:`int<class_int>`, strength\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_extra_baseline_offset<class_FontFile_method_set_extra_baseline_offset>`\ (\ cache_index\: :ref:`int<class_int>`, baseline_offset\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_extra_spacing<class_FontFile_method_set_extra_spacing>`\ (\ cache_index\: :ref:`int<class_int>`, spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_face_index<class_FontFile_method_set_face_index>`\ (\ cache_index\: :ref:`int<class_int>`, face_index\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_glyph_advance<class_FontFile_method_set_glyph_advance>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph\: :ref:`int<class_int>`, advance\: :ref:`Vector2<class_Vector2>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_glyph_offset<class_FontFile_method_set_glyph_offset>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, offset\: :ref:`Vector2<class_Vector2>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_glyph_size<class_FontFile_method_set_glyph_size>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, gl_size\: :ref:`Vector2<class_Vector2>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_glyph_texture_idx<class_FontFile_method_set_glyph_texture_idx>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, texture_idx\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_glyph_uv_rect<class_FontFile_method_set_glyph_uv_rect>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, uv_rect\: :ref:`Rect2<class_Rect2>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_kerning<class_FontFile_method_set_kerning>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph_pair\: :ref:`Vector2i<class_Vector2i>`, kerning\: :ref:`Vector2<class_Vector2>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_language_support_override<class_FontFile_method_set_language_support_override>`\ (\ language\: :ref:`String<class_String>`, supported\: :ref:`bool<class_bool>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_script_support_override<class_FontFile_method_set_script_support_override>`\ (\ script\: :ref:`String<class_String>`, supported\: :ref:`bool<class_bool>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_texture_image<class_FontFile_method_set_texture_image>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`, image\: :ref:`Image<class_Image>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_texture_offsets<class_FontFile_method_set_texture_offsets>`\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`, offset\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_transform<class_FontFile_method_set_transform>`\ (\ cache_index\: :ref:`int<class_int>`, transform\: :ref:`Transform2D<class_Transform2D>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_variation_coordinates<class_FontFile_method_set_variation_coordinates>`\ (\ cache_index\: :ref:`int<class_int>`, variation_coordinates\: :ref:`Dictionary<class_Dictionary>`\ ) |
+--------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_FontFile_property_allow_system_fallback:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **allow_system_fallback** = ``true`` :ref:`🔗<class_FontFile_property_allow_system_fallback>`
.. rst-class:: classref-property-setget
- |void| **set_allow_system_fallback**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_allow_system_fallback**\ (\ )
如果设置为 ``true``\ ,则可以自动将系统字体作为回退使用。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_antialiasing:
.. rst-class:: classref-property
:ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **antialiasing** = ``1`` :ref:`🔗<class_FontFile_property_antialiasing>`
.. rst-class:: classref-property-setget
- |void| **set_antialiasing**\ (\ value\: :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>`\ )
- :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **get_antialiasing**\ (\ )
字体抗锯齿模式。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_data:
.. rst-class:: classref-property
:ref:`PackedByteArray<class_PackedByteArray>` **data** = ``PackedByteArray()`` :ref:`🔗<class_FontFile_property_data>`
.. rst-class:: classref-property-setget
- |void| **set_data**\ (\ value\: :ref:`PackedByteArray<class_PackedByteArray>`\ )
- :ref:`PackedByteArray<class_PackedByteArray>` **get_data**\ (\ )
动态字体源文件的内容。
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedByteArray<class_PackedByteArray>` for more details.
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_disable_embedded_bitmaps:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **disable_embedded_bitmaps** = ``true`` :ref:`🔗<class_FontFile_property_disable_embedded_bitmaps>`
.. rst-class:: classref-property-setget
- |void| **set_disable_embedded_bitmaps**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_disable_embedded_bitmaps**\ (\ )
如果为 ``true``\ ,则会禁用内嵌字体位图的加载(仅包含位图的字体以及彩色字体会禁用该属性)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_fixed_size:
.. rst-class:: classref-property
:ref:`int<class_int>` **fixed_size** = ``0`` :ref:`🔗<class_FontFile_property_fixed_size>`
.. rst-class:: classref-property-setget
- |void| **set_fixed_size**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_fixed_size**\ (\ )
字体大小,仅用于位图字体。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_fixed_size_scale_mode:
.. rst-class:: classref-property
:ref:`FixedSizeScaleMode<enum_TextServer_FixedSizeScaleMode>` **fixed_size_scale_mode** = ``0`` :ref:`🔗<class_FontFile_property_fixed_size_scale_mode>`
.. rst-class:: classref-property-setget
- |void| **set_fixed_size_scale_mode**\ (\ value\: :ref:`FixedSizeScaleMode<enum_TextServer_FixedSizeScaleMode>`\ )
- :ref:`FixedSizeScaleMode<enum_TextServer_FixedSizeScaleMode>` **get_fixed_size_scale_mode**\ (\ )
缩放模式,只有 :ref:`fixed_size<class_FontFile_property_fixed_size>` 大于零的位图字体会使用。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_font_name:
.. rst-class:: classref-property
:ref:`String<class_String>` **font_name** = ``""`` :ref:`🔗<class_FontFile_property_font_name>`
.. rst-class:: classref-property-setget
- |void| **set_font_name**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **get_font_name**\ (\ )
字体家族名称。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_font_stretch:
.. rst-class:: classref-property
:ref:`int<class_int>` **font_stretch** = ``100`` :ref:`🔗<class_FontFile_property_font_stretch>`
.. rst-class:: classref-property-setget
- |void| **set_font_stretch**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_font_stretch**\ (\ )
与正常宽度相比的字体的拉伸量。 一个介于 ``50%````200%`` 之间的百分比值。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_font_style:
.. rst-class:: classref-property
|bitfield|\[:ref:`FontStyle<enum_TextServer_FontStyle>`\] **font_style** = ``0`` :ref:`🔗<class_FontFile_property_font_style>`
.. rst-class:: classref-property-setget
- |void| **set_font_style**\ (\ value\: |bitfield|\[:ref:`FontStyle<enum_TextServer_FontStyle>`\]\ )
- |bitfield|\[:ref:`FontStyle<enum_TextServer_FontStyle>`\] **get_font_style**\ (\ )
字体样式标志。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_font_weight:
.. rst-class:: classref-property
:ref:`int<class_int>` **font_weight** = ``400`` :ref:`🔗<class_FontFile_property_font_weight>`
.. rst-class:: classref-property-setget
- |void| **set_font_weight**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_font_weight**\ (\ )
该字体的字重(粗度)。一个在 ``100...999`` 范围内的值,正常字体字重为 ``400``\ ,粗体字体字重为 ``700``\ 。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_force_autohinter:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **force_autohinter** = ``false`` :ref:`🔗<class_FontFile_property_force_autohinter>`
.. rst-class:: classref-property-setget
- |void| **set_force_autohinter**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_force_autohinter**\ (\ )
如果设置为 ``true``\ 则支持自动提示并且优先于字体内置提示。仅由动态字体使用MSDF 字体不支持提示)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_generate_mipmaps:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **generate_mipmaps** = ``false`` :ref:`🔗<class_FontFile_property_generate_mipmaps>`
.. rst-class:: classref-property-setget
- |void| **set_generate_mipmaps**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_generate_mipmaps**\ (\ )
如果设置为 ``true``\ ,则为字体纹理生成 mipmap。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_hinting:
.. rst-class:: classref-property
:ref:`Hinting<enum_TextServer_Hinting>` **hinting** = ``1`` :ref:`🔗<class_FontFile_property_hinting>`
.. rst-class:: classref-property-setget
- |void| **set_hinting**\ (\ value\: :ref:`Hinting<enum_TextServer_Hinting>`\ )
- :ref:`Hinting<enum_TextServer_Hinting>` **get_hinting**\ (\ )
字体微调模式。仅由动态字体使用。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_keep_rounding_remainders:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **keep_rounding_remainders** = ``true`` :ref:`🔗<class_FontFile_property_keep_rounding_remainders>`
.. rst-class:: classref-property-setget
- |void| **set_keep_rounding_remainders**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_keep_rounding_remainders**\ (\ )
如果设置为 ``true``\ ,则将字形与像素边界对齐时会累积舍入余数,确保字形的分布更加均匀。如果启用了次像素定位则该设置无效。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_modulate_color_glyphs:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **modulate_color_glyphs** = ``false`` :ref:`🔗<class_FontFile_property_modulate_color_glyphs>`
.. rst-class:: classref-property-setget
- |void| **set_modulate_color_glyphs**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_modulate_color_glyphs**\ (\ )
如果设为 ``true``\ ,则绘制彩色字形时会应用颜色调制,否则只会对灰度字形应用。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_msdf_pixel_range:
.. rst-class:: classref-property
:ref:`int<class_int>` **msdf_pixel_range** = ``16`` :ref:`🔗<class_FontFile_property_msdf_pixel_range>`
.. rst-class:: classref-property-setget
- |void| **set_msdf_pixel_range**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_msdf_pixel_range**\ (\ )
最小和最大可表示的有符号距离之间的形状周围的范围宽度。如果使用字体轮廓,\ :ref:`msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` 必须至少设置为最大字体轮廓大小的\ *两倍*\ 。\ :ref:`msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` 的默认值为 ``16``\ ,允许大小最大到 ``8`` 的轮廓看起来正确。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_msdf_size:
.. rst-class:: classref-property
:ref:`int<class_int>` **msdf_size** = ``48`` :ref:`🔗<class_FontFile_property_msdf_size>`
.. rst-class:: classref-property-setget
- |void| **set_msdf_size**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_msdf_size**\ (\ )
用于生成 MSDF 纹理的源字体大小。较高的值允许更高的精度,但渲染速度较慢并且需要更多内存。只有当注意到字形渲染中明显缺乏精度时,才增加该属性的值。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_multichannel_signed_distance_field:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **multichannel_signed_distance_field** = ``false`` :ref:`🔗<class_FontFile_property_multichannel_signed_distance_field>`
.. rst-class:: classref-property-setget
- |void| **set_multichannel_signed_distance_field**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_multichannel_signed_distance_field**\ (\ )
如果被设置为 ``true``\ 则所有大小的字形进行渲染时都使用从动态字体矢量数据中生成的单个多通道带符号距离场MSDF。由于这种方法不依赖于在每次字体大小发生变化时对字体进行栅格化因此可以实时调整字体大小而不会造成任何性能损失。对于按比例缩小的 :ref:`Control<class_Control>`\ (或从远距离查看的 :ref:`Label3D<class_Label3D>`\ 文本也不会看起来有颗粒感。有一个缺点MSDF 不提供字体提示。缺少字体提示可能会导致大小较小的字体的清晰度和可读性较差。
\ **注意:**\ 如果使用字体轮廓,\ :ref:`msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` 必须至少设置为最大字体轮廓大小的\ *两倍*\ 。
\ **注意:**\ MSDF 字体渲染不能正确渲染具有重叠形状的字形。根据 OpenType 标准,重叠形状是无效的,但在许多字体文件中仍然很常见,尤其是那些由 Google 字体转换的字体文件。为避免字形重叠的问题,请考虑直接从字体开发公司下载字体文件,而不是依赖 Google 字体。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_opentype_feature_overrides:
.. rst-class:: classref-property
:ref:`Dictionary<class_Dictionary>` **opentype_feature_overrides** = ``{}`` :ref:`🔗<class_FontFile_property_opentype_feature_overrides>`
.. rst-class:: classref-property-setget
- |void| **set_opentype_feature_overrides**\ (\ value\: :ref:`Dictionary<class_Dictionary>`\ )
- :ref:`Dictionary<class_Dictionary>` **get_opentype_feature_overrides**\ (\ )
字体 OpenType 特性集覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_oversampling:
.. rst-class:: classref-property
:ref:`float<class_float>` **oversampling** = ``0.0`` :ref:`🔗<class_FontFile_property_oversampling>`
.. rst-class:: classref-property-setget
- |void| **set_oversampling**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_oversampling**\ (\ )
如果设为正数,则会覆盖使用该字体的视口的过采样系数。见 :ref:`Viewport.oversampling<class_Viewport_property_oversampling>`\ 。该值不会覆盖 ``draw_*`` 方法的 ``oversampling`` 参数。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_style_name:
.. rst-class:: classref-property
:ref:`String<class_String>` **style_name** = ``""`` :ref:`🔗<class_FontFile_property_style_name>`
.. rst-class:: classref-property-setget
- |void| **set_font_style_name**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **get_font_style_name**\ (\ )
字体样式名称。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_property_subpixel_positioning:
.. rst-class:: classref-property
:ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **subpixel_positioning** = ``1`` :ref:`🔗<class_FontFile_property_subpixel_positioning>`
.. rst-class:: classref-property-setget
- |void| **set_subpixel_positioning**\ (\ value\: :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>`\ )
- :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **get_subpixel_positioning**\ (\ )
字体字形的子像素定位模式。子像素定位为较小的字体提供了更清晰的文本和更好的字距调整,但代价是更高的内存占用和更低的字体光栅化速度。使用 :ref:`TextServer.SUBPIXEL_POSITIONING_AUTO<class_TextServer_constant_SUBPIXEL_POSITIONING_AUTO>` 来根据字体大小自动启用它。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_FontFile_method_clear_cache:
.. rst-class:: classref-method
|void| **clear_cache**\ (\ ) :ref:`🔗<class_FontFile_method_clear_cache>`
移除所有字体缓存条目。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_clear_glyphs:
.. rst-class:: classref-method
|void| **clear_glyphs**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_FontFile_method_clear_glyphs>`
从字体缓存条目中,移除所有渲染的字形信息。
\ **注意:**\ 该函数不会移除与字形相关的纹理,请使用 :ref:`remove_texture()<class_FontFile_method_remove_texture>` 手动移除它们。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_clear_kerning_map:
.. rst-class:: classref-method
|void| **clear_kerning_map**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_clear_kerning_map>`
移除所有字距调整覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_clear_size_cache:
.. rst-class:: classref-method
|void| **clear_size_cache**\ (\ cache_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_clear_size_cache>`
从缓存条目中移除所有的字体大小。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_clear_textures:
.. rst-class:: classref-method
|void| **clear_textures**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_FontFile_method_clear_textures>`
从字体缓存条目中,移除所有纹理。
\ **注意:**\ 该函数不会移除与纹理相关的字形,请使用 :ref:`remove_glyph()<class_FontFile_method_remove_glyph>` 手动移除它们。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_cache_ascent:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_cache_ascent**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_cache_ascent>`
返回字体的上升幅度(超出基线的像素数)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_cache_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_cache_count**\ (\ ) |const| :ref:`🔗<class_FontFile_method_get_cache_count>`
返回字体缓存条目的数量。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_cache_descent:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_cache_descent**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_cache_descent>`
返回字体的减少量(低于基线的像素数)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_cache_scale:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_cache_scale**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_cache_scale>`
返回颜色位图字体的缩放系数。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_cache_underline_position:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_cache_underline_position**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_cache_underline_position>`
返回基线下方下划线的像素偏移。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_cache_underline_thickness:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_cache_underline_thickness**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_cache_underline_thickness>`
返回下划线的粗细度,单位为像素。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_char_from_glyph_index:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_char_from_glyph_index**\ (\ size\: :ref:`int<class_int>`, glyph_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_char_from_glyph_index>`
返回与 ``glyph_index`` 关联的字符代码,如果 ``glyph_index`` 无效则返回 ``0``\ 。见 :ref:`get_glyph_index()<class_FontFile_method_get_glyph_index>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_embolden:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_embolden**\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_embolden>`
返回加粗强度,如果不等于零,则加粗字体轮廓。负值会减小轮廓粗细。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_extra_baseline_offset:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_extra_baseline_offset**\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_extra_baseline_offset>`
返回额外的基线偏移(作为字体高度的一部分)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_extra_spacing:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_extra_spacing**\ (\ cache_index\: :ref:`int<class_int>`, spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`\ ) |const| :ref:`🔗<class_FontFile_method_get_extra_spacing>`
返回 ``spacing`` 的间距,单位为像素(与字体大小无关)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_face_index:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_face_index**\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_face_index>`
返回 TrueType / OpenType 集合中的活动字体索引。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_advance:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_glyph_advance**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_advance>`
返回字形前进量(下一个字形的偏移量)。
\ **注意:**\ 字形轮廓的前进量,与基础字形的前进量相同,不会被保存。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_index:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_glyph_index**\ (\ size\: :ref:`int<class_int>`, char\: :ref:`int<class_int>`, variation_selector\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_index>`
返回 ``char`` 的字形索引,可以用 ``variation_selector`` 修改。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_list:
.. rst-class:: classref-method
:ref:`PackedInt32Array<class_PackedInt32Array>` **get_glyph_list**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_list>`
返回缓存条目中的已渲染字形列表。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_offset:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_glyph_offset**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_offset>`
返回字形的基线偏移量。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_size:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_glyph_size**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_size>`
返回字形大小。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_texture_idx:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_glyph_texture_idx**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_texture_idx>`
返回包含该字形的缓存纹理的索引。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_glyph_uv_rect:
.. rst-class:: classref-method
:ref:`Rect2<class_Rect2>` **get_glyph_uv_rect**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_glyph_uv_rect>`
返回包含该字形的缓存纹理中的矩形。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_kerning:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_kerning**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph_pair\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_FontFile_method_get_kerning>`
返回字形对的字距调整。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_kerning_list:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] **get_kerning_list**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_kerning_list>`
返回字距调整覆盖的列表。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_language_support_override:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_language_support_override**\ (\ language\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_FontFile_method_get_language_support_override>`
如果为 ``language`` 启用了支持覆盖,则返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_language_support_overrides:
.. rst-class:: classref-method
:ref:`PackedStringArray<class_PackedStringArray>` **get_language_support_overrides**\ (\ ) |const| :ref:`🔗<class_FontFile_method_get_language_support_overrides>`
返回语言支持覆盖的列表。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_script_support_override:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_script_support_override**\ (\ script\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_FontFile_method_get_script_support_override>`
如果为 ``script`` 启用了支持覆盖,则返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_script_support_overrides:
.. rst-class:: classref-method
:ref:`PackedStringArray<class_PackedStringArray>` **get_script_support_overrides**\ (\ ) |const| :ref:`🔗<class_FontFile_method_get_script_support_overrides>`
返回文字支持覆盖的列表。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_size_cache_list:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] **get_size_cache_list**\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_size_cache_list>`
返回缓存中字体大小的列表。每个大小都是由字体大小和轮廓大小组成的 :ref:`Vector2i<class_Vector2i>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_texture_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_texture_count**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_FontFile_method_get_texture_count>`
返回字体缓存条目所使用的纹理数。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_texture_image:
.. rst-class:: classref-method
:ref:`Image<class_Image>` **get_texture_image**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_texture_image>`
返回字体缓存纹理图像的副本。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_texture_offsets:
.. rst-class:: classref-method
:ref:`PackedInt32Array<class_PackedInt32Array>` **get_texture_offsets**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_texture_offsets>`
返回包含字形打包数据的数组副本。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_transform:
.. rst-class:: classref-method
:ref:`Transform2D<class_Transform2D>` **get_transform**\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_transform>`
返回应用于字体轮廓的 2D 变换,可用于倾斜、翻转和旋转字形。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_get_variation_coordinates:
.. rst-class:: classref-method
:ref:`Dictionary<class_Dictionary>` **get_variation_coordinates**\ (\ cache_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_FontFile_method_get_variation_coordinates>`
返回指定字体缓存条目的变体坐标。有关详细信息,请参阅 :ref:`Font.get_supported_variation_list()<class_Font_method_get_supported_variation_list>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_load_bitmap_font:
.. rst-class:: classref-method
:ref:`Error<enum_@GlobalScope_Error>` **load_bitmap_font**\ (\ path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_FontFile_method_load_bitmap_font>`
从文件 ``path`` 中加载一个 AngelCode BMFont (.fnt, .font) 位图字体。
\ **警告:**\ 该方法只能在编辑器中或需要在运行时加载外部字体的情况下使用,例如位于 ``user://`` 目录的字体。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_load_dynamic_font:
.. rst-class:: classref-method
:ref:`Error<enum_@GlobalScope_Error>` **load_dynamic_font**\ (\ path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_FontFile_method_load_dynamic_font>`
从文件 ``path`` 中加载 TrueType.ttf、OpenType.otf、WOFF.woff、WOFF2.woff2或 Type 1.pfb、.pfm动态字体。
\ **警告:**\ 该方法只能在编辑器中或需要在运行时加载外部字体的情况下使用,例如位于 ``user://`` 目录的字体。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_cache:
.. rst-class:: classref-method
|void| **remove_cache**\ (\ cache_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_remove_cache>`
删除指定的字体缓存条目。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_glyph:
.. rst-class:: classref-method
|void| **remove_glyph**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_remove_glyph>`
从缓存条目中移除指定的渲染的字形信息。
\ **注意:**\ 该函数不会移除与字形相关的纹理,请使用 :ref:`remove_texture()<class_FontFile_method_remove_texture>` 手动移除它们。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_kerning:
.. rst-class:: classref-method
|void| **remove_kerning**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph_pair\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_FontFile_method_remove_kerning>`
移除字形对的字距调整覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_language_support_override:
.. rst-class:: classref-method
|void| **remove_language_support_override**\ (\ language\: :ref:`String<class_String>`\ ) :ref:`🔗<class_FontFile_method_remove_language_support_override>`
移除语言支持覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_script_support_override:
.. rst-class:: classref-method
|void| **remove_script_support_override**\ (\ script\: :ref:`String<class_String>`\ ) :ref:`🔗<class_FontFile_method_remove_script_support_override>`
移除文字支持覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_size_cache:
.. rst-class:: classref-method
|void| **remove_size_cache**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_FontFile_method_remove_size_cache>`
从缓存条目中移除指定的字体大小。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_remove_texture:
.. rst-class:: classref-method
|void| **remove_texture**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_remove_texture>`
从缓存条目中移除指定的纹理。
\ **注意:**\ 该函数不会移除与纹理相关的字形,请使用 :ref:`remove_glyph()<class_FontFile_method_remove_glyph>` 手动移除它们。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_render_glyph:
.. rst-class:: classref-method
|void| **render_glyph**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_render_glyph>`
将指定的字符渲染到字体缓存纹理。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_render_range:
.. rst-class:: classref-method
|void| **render_range**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, start\: :ref:`int<class_int>`, end\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_render_range>`
将范围内的字符渲染到字体缓存纹理。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_cache_ascent:
.. rst-class:: classref-method
|void| **set_cache_ascent**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, ascent\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_cache_ascent>`
设置字体的升部(基线上方的像素数)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_cache_descent:
.. rst-class:: classref-method
|void| **set_cache_descent**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, descent\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_cache_descent>`
设置字体的降部(基线下方的像素数)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_cache_scale:
.. rst-class:: classref-method
|void| **set_cache_scale**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, scale\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_cache_scale>`
设置彩色位图字体的缩放系数。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_cache_underline_position:
.. rst-class:: classref-method
|void| **set_cache_underline_position**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, underline_position\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_cache_underline_position>`
设置基线下方下划线的像素偏移。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_cache_underline_thickness:
.. rst-class:: classref-method
|void| **set_cache_underline_thickness**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, underline_thickness\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_cache_underline_thickness>`
设置下划线的粗细度,单位为像素。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_embolden:
.. rst-class:: classref-method
|void| **set_embolden**\ (\ cache_index\: :ref:`int<class_int>`, strength\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_embolden>`
设置加粗强度,如果不等于零,则会加粗字体的轮廓。负值会减小轮廓的厚度。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_extra_baseline_offset:
.. rst-class:: classref-method
|void| **set_extra_baseline_offset**\ (\ cache_index\: :ref:`int<class_int>`, baseline_offset\: :ref:`float<class_float>`\ ) :ref:`🔗<class_FontFile_method_set_extra_baseline_offset>`
设置额外的基线偏移(作为字体高度的一部分)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_extra_spacing:
.. rst-class:: classref-method
|void| **set_extra_spacing**\ (\ cache_index\: :ref:`int<class_int>`, spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_set_extra_spacing>`
``spacing`` 的间距设置为 ``value``\ ,单位为像素(与字体大小无关)。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_face_index:
.. rst-class:: classref-method
|void| **set_face_index**\ (\ cache_index\: :ref:`int<class_int>`, face_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_set_face_index>`
在 TrueType / OpenType 集合中设置活动字体索引。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_glyph_advance:
.. rst-class:: classref-method
|void| **set_glyph_advance**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph\: :ref:`int<class_int>`, advance\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_FontFile_method_set_glyph_advance>`
设置字形前进量(下一个字形的偏移量)。
\ **注意:**\ 字形轮廓的前进量与基础字形的前进量相同,不会被保存。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_glyph_offset:
.. rst-class:: classref-method
|void| **set_glyph_offset**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, offset\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_FontFile_method_set_glyph_offset>`
设置字形相对于基线的偏移量。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_glyph_size:
.. rst-class:: classref-method
|void| **set_glyph_size**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, gl_size\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_FontFile_method_set_glyph_size>`
设置字形大小。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_glyph_texture_idx:
.. rst-class:: classref-method
|void| **set_glyph_texture_idx**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, texture_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontFile_method_set_glyph_texture_idx>`
设置包含该字形的缓存纹理的索引。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_glyph_uv_rect:
.. rst-class:: classref-method
|void| **set_glyph_uv_rect**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, glyph\: :ref:`int<class_int>`, uv_rect\: :ref:`Rect2<class_Rect2>`\ ) :ref:`🔗<class_FontFile_method_set_glyph_uv_rect>`
设置包含该字形的缓存纹理中,该字形的矩形区域。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_kerning:
.. rst-class:: classref-method
|void| **set_kerning**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`int<class_int>`, glyph_pair\: :ref:`Vector2i<class_Vector2i>`, kerning\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_FontFile_method_set_kerning>`
设置字形对的字距调整。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_language_support_override:
.. rst-class:: classref-method
|void| **set_language_support_override**\ (\ language\: :ref:`String<class_String>`, supported\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_FontFile_method_set_language_support_override>`
为 :ref:`Font.is_language_supported()<class_Font_method_is_language_supported>` 添加覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_script_support_override:
.. rst-class:: classref-method
|void| **set_script_support_override**\ (\ script\: :ref:`String<class_String>`, supported\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_FontFile_method_set_script_support_override>`
为 :ref:`Font.is_script_supported()<class_Font_method_is_script_supported>` 添加覆盖。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_texture_image:
.. rst-class:: classref-method
|void| **set_texture_image**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`, image\: :ref:`Image<class_Image>`\ ) :ref:`🔗<class_FontFile_method_set_texture_image>`
设置字体缓存纹理图像。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_texture_offsets:
.. rst-class:: classref-method
|void| **set_texture_offsets**\ (\ cache_index\: :ref:`int<class_int>`, size\: :ref:`Vector2i<class_Vector2i>`, texture_index\: :ref:`int<class_int>`, offset\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) :ref:`🔗<class_FontFile_method_set_texture_offsets>`
设置包含字形打包数据的数组。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_transform:
.. rst-class:: classref-method
|void| **set_transform**\ (\ cache_index\: :ref:`int<class_int>`, transform\: :ref:`Transform2D<class_Transform2D>`\ ) :ref:`🔗<class_FontFile_method_set_transform>`
设置应用于字体轮廓的 2D 变换,可用于倾斜、翻转、旋转字形。
.. rst-class:: classref-item-separator
----
.. _class_FontFile_method_set_variation_coordinates:
.. rst-class:: classref-method
|void| **set_variation_coordinates**\ (\ cache_index\: :ref:`int<class_int>`, variation_coordinates\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_FontFile_method_set_variation_coordinates>`
为指定的字体缓存条目设置变体坐标。有关详细信息,请参阅 :ref:`Font.get_supported_variation_list()<class_Font_method_get_supported_variation_list>`\ 。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`