Files
godot-docs-l10n/classes/zh_Hans/class_font.rst
Rémi Verschelde c3f2364c10 Sync classref with 4.6 branch
Lots of translations invalidated (fuzzied) as we just synced Weblate.
2025-12-19 16:39:51 +01:00

593 lines
83 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_Font:
Font
====
**继承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
**派生:** :ref:`FontFile<class_FontFile>`, :ref:`FontVariation<class_FontVariation>`, :ref:`SystemFont<class_SystemFont>`
字体和字体变体的抽象基类。
.. rst-class:: classref-introduction-group
描述
----
各种字体类型的抽象基类。提供了绘制文本以及内省字体字符的方法。
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+------------------------------------------------------+-------------------------------------------------+--------+
| :ref:`Array<class_Array>`\[:ref:`Font<class_Font>`\] | :ref:`fallbacks<class_Font_property_fallbacks>` | ``[]`` |
+------------------------------------------------------+-------------------------------------------------+--------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`draw_char<class_Font_method_draw_char>`\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`int<class_int>`, font_size\: :ref:`int<class_int>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`draw_char_outline<class_Font_method_draw_char_outline>`\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`int<class_int>`, font_size\: :ref:`int<class_int>`, size\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`draw_multiline_string<class_Font_method_draw_multiline_string>`\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`draw_multiline_string_outline<class_Font_method_draw_multiline_string_outline>`\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`draw_string<class_Font_method_draw_string>`\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`draw_string_outline<class_Font_method_draw_string_outline>`\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`find_variation<class_Font_method_find_variation>`\ (\ variation_coordinates\: :ref:`Dictionary<class_Dictionary>`, face_index\: :ref:`int<class_int>` = 0, strength\: :ref:`float<class_float>` = 0.0, transform\: :ref:`Transform2D<class_Transform2D>` = Transform2D(1, 0, 0, 1, 0, 0), spacing_top\: :ref:`int<class_int>` = 0, spacing_bottom\: :ref:`int<class_int>` = 0, spacing_space\: :ref:`int<class_int>` = 0, spacing_glyph\: :ref:`int<class_int>` = 0, baseline_offset\: :ref:`float<class_float>` = 0.0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_ascent<class_Font_method_get_ascent>`\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_char_size<class_Font_method_get_char_size>`\ (\ char\: :ref:`int<class_int>`, font_size\: :ref:`int<class_int>`\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_descent<class_Font_method_get_descent>`\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_face_count<class_Font_method_get_face_count>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_font_name<class_Font_method_get_font_name>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_font_stretch<class_Font_method_get_font_stretch>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |bitfield|\[:ref:`FontStyle<enum_TextServer_FontStyle>`\] | :ref:`get_font_style<class_Font_method_get_font_style>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_font_style_name<class_Font_method_get_font_style_name>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_font_weight<class_Font_method_get_font_weight>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_height<class_Font_method_get_height>`\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_multiline_string_size<class_Font_method_get_multiline_string_size>`\ (\ text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_opentype_features<class_Font_method_get_opentype_features>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_ot_name_strings<class_Font_method_get_ot_name_strings>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`RID<class_RID>`\] | :ref:`get_rids<class_Font_method_get_rids>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_spacing<class_Font_method_get_spacing>`\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_string_size<class_Font_method_get_string_size>`\ (\ text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_supported_chars<class_Font_method_get_supported_chars>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_supported_feature_list<class_Font_method_get_supported_feature_list>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_supported_variation_list<class_Font_method_get_supported_variation_list>`\ (\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_underline_position<class_Font_method_get_underline_position>`\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_underline_thickness<class_Font_method_get_underline_thickness>`\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_char<class_Font_method_has_char>`\ (\ char\: :ref:`int<class_int>`\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_language_supported<class_Font_method_is_language_supported>`\ (\ language\: :ref:`String<class_String>`\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_script_supported<class_Font_method_is_script_supported>`\ (\ script\: :ref:`String<class_String>`\ ) |const| |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cache_capacity<class_Font_method_set_cache_capacity>`\ (\ single_line\: :ref:`int<class_int>`, multi_line\: :ref:`int<class_int>`\ ) |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_Font_property_fallbacks:
.. rst-class:: classref-property
:ref:`Array<class_Array>`\[:ref:`Font<class_Font>`\] **fallbacks** = ``[]`` :ref:`🔗<class_Font_property_fallbacks>`
.. rst-class:: classref-property-setget
- |void| **set_fallbacks**\ (\ value\: :ref:`Array<class_Array>`\[:ref:`Font<class_Font>`\]\ )
- :ref:`Array<class_Array>`\[:ref:`Font<class_Font>`\] **get_fallbacks**\ (\ )
回退 **Font** 数组,会在这个当前 **Font** 中无法找到某个字形时用作替换。
如果 :ref:`FontVariation<class_FontVariation>` 中的这个数组为空,则会改用 :ref:`FontVariation.base_font<class_FontVariation_property_base_font>` 的回退字体。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_Font_method_draw_char:
.. rst-class:: classref-method
:ref:`float<class_float>` **draw_char**\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`int<class_int>`, font_size\: :ref:`int<class_int>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_draw_char>`
使用该字体将单个 Unicode 字符 ``char`` 绘制在画布项目中的给定的位置,颜色为 ``modulate``\ 。\ ``pos`` 指定的是基线位置而不是顶部。如果要按顶部位置绘制,则必须在 Y 轴中加入\ *升部*\ 。如果 ``oversampling`` 大于零,则会将其用作字体过采样系统,否则会使用视口的过采样设置。
\ **注意:**\ 请勿使用这个方法进行逐字符的绘制,请改用 :ref:`draw_string()<class_Font_method_draw_string>`:ref:`TextLine<class_TextLine>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_draw_char_outline:
.. rst-class:: classref-method
:ref:`float<class_float>` **draw_char_outline**\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`int<class_int>`, font_size\: :ref:`int<class_int>`, size\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_draw_char_outline>`
使用该字体将单个 Unicode 字符 ``char`` 的轮廓绘制在画布项目中的给定的位置,颜色为 ``modulate``\ 。\ ``pos`` 指定的是基线位置而不是顶部。如果要按顶部位置绘制,则必须在 Y 轴中加入\ *升部*\ 。如果 ``oversampling`` 大于零,则会将其用作字体过采样系统,否则会使用视口的过采样设置。
\ **注意:**\ 请勿使用这个方法进行逐字符的绘制,请改用 :ref:`draw_string()<class_Font_method_draw_string>`:ref:`TextLine<class_TextLine>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_draw_multiline_string:
.. rst-class:: classref-method
|void| **draw_multiline_string**\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_draw_multiline_string>`
使用 ``brk_flags`` 指定的规则对 ``text`` 进行断行,并使用该字体将其绘制在画布项目中的给定位置,颜色为 ``modulate``\ ,也可以指定裁剪宽度并进行水平对齐。\ ``pos`` 指定的是基线位置而不是顶部。如果要按顶部位置绘制,则必须在 Y 轴中加入\ *升部*\ 。如果 ``oversampling`` 大于零,则会将其用作字体过采样系统,否则会使用视口的过采样设置。
另见 :ref:`CanvasItem.draw_multiline_string()<class_CanvasItem_method_draw_multiline_string>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_draw_multiline_string_outline:
.. rst-class:: classref-method
|void| **draw_multiline_string_outline**\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_draw_multiline_string_outline>`
使用 ``brk_flags`` 指定的规则对 ``text`` 进行断行,并使用该字体将其轮廓绘制在画布项目中的给定位置,颜色为 ``modulate``\ ,也可以指定裁剪宽度并进行水平对齐。\ ``pos`` 指定的是基线位置而不是顶部。如果要按顶部位置绘制,则必须在 Y 轴中加入\ *升部*\ 。如果 ``oversampling`` 大于零,则会将其用作字体过采样系统,否则会使用视口的过采样设置。
另见 :ref:`CanvasItem.draw_multiline_string_outline()<class_CanvasItem_method_draw_multiline_string_outline>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_draw_string:
.. rst-class:: classref-method
|void| **draw_string**\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_draw_string>`
使用该字体将 ``text`` 绘制在画布项目中的给定位置,颜色为 ``modulate``\ ,也可以指定裁剪宽度并进行水平对齐。\ ``pos`` 指定的是基线位置而不是顶部。如果要按顶部位置绘制,则必须在 Y 轴中加入\ *升部*\ 。如果 ``oversampling`` 大于零,则会将其用作字体过采样系统,否则会使用视口的过采样设置。
另见 :ref:`CanvasItem.draw_string()<class_CanvasItem_method_draw_string>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_draw_string_outline:
.. rst-class:: classref-method
|void| **draw_string_outline**\ (\ canvas_item\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0, oversampling\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_draw_string_outline>`
使用该字体将 ``text`` 的轮廓绘制在画布项目中的给定位置,颜色为 ``modulate``\ ,也可以指定裁剪宽度并进行水平对齐。\ ``pos`` 指定的是基线位置而不是顶部。如果要按顶部位置绘制,则必须在 Y 轴中加入\ *升部*\ 。如果 ``oversampling`` 大于零,则会将其用作字体过采样系统,否则会使用视口的过采样设置。
另见 :ref:`CanvasItem.draw_string()<class_CanvasItem_method_draw_string>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_find_variation:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **find_variation**\ (\ variation_coordinates\: :ref:`Dictionary<class_Dictionary>`, face_index\: :ref:`int<class_int>` = 0, strength\: :ref:`float<class_float>` = 0.0, transform\: :ref:`Transform2D<class_Transform2D>` = Transform2D(1, 0, 0, 1, 0, 0), spacing_top\: :ref:`int<class_int>` = 0, spacing_bottom\: :ref:`int<class_int>` = 0, spacing_space\: :ref:`int<class_int>` = 0, spacing_glyph\: :ref:`int<class_int>` = 0, baseline_offset\: :ref:`float<class_float>` = 0.0\ ) |const| :ref:`🔗<class_Font_method_find_variation>`
返回特定变体的字体缓存的 :ref:`TextServer<class_TextServer>` RID。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_ascent:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_ascent**\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| :ref:`🔗<class_Font_method_get_ascent>`
返回平均上高(基线以上的像素数)。
\ **注意:**\ 字符串的实际上高是上下文相关的,并且可能与该函数返回的值有很大不同。仅将其用作粗略估计(例如作为空行的上高)。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_char_size:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_char_size**\ (\ char\: :ref:`int<class_int>`, font_size\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Font_method_get_char_size>`
返回字符的大小。不考虑字偶距。
\ **注意:**\ 不要使用这个函数逐个字符地计算字符串的宽度,而是使用 :ref:`get_string_size()<class_Font_method_get_string_size>`:ref:`TextLine<class_TextLine>`\ 。返回的高度是字体高度(另见 :ref:`get_height()<class_Font_method_get_height>`\ )并且与字形高度无关。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_descent:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_descent**\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| :ref:`🔗<class_Font_method_get_descent>`
返回平均下深(基线以下的像素数)。
\ **注意:**\ 字符串的真实下深是依赖于上下文的,并且可能与此函数返回的值有很大不同。仅将其用作粗略估计(例如作为空行的下深)。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_face_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_face_count**\ (\ ) |const| :ref:`🔗<class_Font_method_get_face_count>`
返回 TrueType / OpenType 集合中的字体数。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_font_name:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_font_name**\ (\ ) |const| :ref:`🔗<class_Font_method_get_font_name>`
返回字体家族名称。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_font_stretch:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_font_stretch**\ (\ ) |const| :ref:`🔗<class_Font_method_get_font_stretch>`
返回与正常宽度相比的字体拉伸量。一个介于 ``50%````200%`` 之间的百分比值。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_font_style:
.. rst-class:: classref-method
|bitfield|\[:ref:`FontStyle<enum_TextServer_FontStyle>`\] **get_font_style**\ (\ ) |const| :ref:`🔗<class_Font_method_get_font_style>`
返回字体样式标志。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_font_style_name:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_font_style_name**\ (\ ) |const| :ref:`🔗<class_Font_method_get_font_style_name>`
返回字体样式名称。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_font_weight:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_font_weight**\ (\ ) |const| :ref:`🔗<class_Font_method_get_font_weight>`
返回该字体的字重(粗度)。一个在 ``100...999`` 范围内的值,正常字体字重为 ``400``\ ,粗体字体字重为 ``700``\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_height:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_height**\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| :ref:`🔗<class_Font_method_get_height>`
返回总的平均字体高度(上高加下深),单位为像素。
\ **注意:**\ 字符串的实际高度取决于上下文,并且可能与该函数返回的值有很大差异。仅将其用作粗略估计(例如作为空行的高度)。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_multiline_string_size:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_multiline_string_size**\ (\ text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| :ref:`🔗<class_Font_method_get_multiline_string_size>`
返回分割成行的字符串的边界框的大小,将字距调整和前进量考虑在内。
另见 :ref:`draw_multiline_string()<class_Font_method_draw_multiline_string>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_opentype_features:
.. rst-class:: classref-method
:ref:`Dictionary<class_Dictionary>` **get_opentype_features**\ (\ ) |const| :ref:`🔗<class_Font_method_get_opentype_features>`
返回一组 OpenType 功能标签。更多信息:\ `OpenType 功能标签 <https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags>`__\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_ot_name_strings:
.. rst-class:: classref-method
:ref:`Dictionary<class_Dictionary>` **get_ot_name_strings**\ (\ ) |const| :ref:`🔗<class_Font_method_get_ot_name_strings>`
返回 OpenType 字体名称字符串的 :ref:`Dictionary<class_Dictionary>`\ (本地化的字体名称、版本、描述、许可信息、示例文本等)。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_rids:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`RID<class_RID>`\] **get_rids**\ (\ ) |const| :ref:`🔗<class_Font_method_get_rids>`
返回有效 **Font** :ref:`RID<class_RID>` 的 :ref:`Array<class_Array>`\ ,可以将其传给 :ref:`TextServer<class_TextServer>` 的方法。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_spacing:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_spacing**\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`\ ) |const| :ref:`🔗<class_Font_method_get_spacing>`
返回间隔类型 ``spacing`` 的间距。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_string_size:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_string_size**\ (\ text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| :ref:`🔗<class_Font_method_get_string_size>`
返回一个单行字符串的边界框的大小,考虑字距调整、提前量和子像素定位。另见 :ref:`get_multiline_string_size()<class_Font_method_get_multiline_string_size>`:ref:`draw_string()<class_Font_method_draw_string>`\ 。
例如,要获取单行 Label 所显示的字符串大小,请使用:
.. tabs::
.. code-tab:: gdscript
var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size"))
.. code-tab:: csharp
Label label = GetNode<Label>("Label");
Vector2 stringSize = label.GetThemeFont("font").GetStringSize(label.Text, HorizontalAlignment.Left, -1, label.GetThemeFontSize("font_size"));
\ **注意:**\ 由于 :ref:`get_string_size()<class_Font_method_get_string_size>` 考虑了字距调整、提前量和子像素定位,因此对字符串的子字符串使用单独的 :ref:`get_string_size()<class_Font_method_get_string_size>` 调用,然后将结果加在一起,将返回与对完整字符串使用单个 :ref:`get_string_size()<class_Font_method_get_string_size>` 调用的返回值不同的结果 。
\ **注意:**\ 字符串的实际高度取决于上下文,并且可能与 :ref:`get_height()<class_Font_method_get_height>` 返回的值有很大不同。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_supported_chars:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_supported_chars**\ (\ ) |const| :ref:`🔗<class_Font_method_get_supported_chars>`
返回一个包含字体中所有可用字符的字符串。
如果给定字符被包含在多个字体数据源中,则它在返回的字符串中只出现一次。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_supported_feature_list:
.. rst-class:: classref-method
:ref:`Dictionary<class_Dictionary>` **get_supported_feature_list**\ (\ ) |const| :ref:`🔗<class_Font_method_get_supported_feature_list>`
返回字体支持的 OpenType 特性列表。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_supported_variation_list:
.. rst-class:: classref-method
:ref:`Dictionary<class_Dictionary>` **get_supported_variation_list**\ (\ ) |const| :ref:`🔗<class_Font_method_get_supported_variation_list>`
返回支持的\ `变体坐标 <https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg>`__\ 列表,坐标以 ``tag: Vector3i(min_value,max_value,default_value)`` 的形式返回。
字体变体能够沿着某个给定的设计轴对字形的特性进行连续的变化,例如字重、宽度、斜度。
要输出可变字体的可用变体轴:
::
var fv = FontVariation.new()
fv.base_font = load("res://RobotoFlex.ttf")
var variation_list = fv.get_supported_variation_list()
for tag in variation_list:
var name = TextServerManager.get_primary_interface().tag_to_name(tag)
var values = variation_list[tag]
print("变体轴:%s (%d)\n\t最小值、最大值、默认值%s" % [name, tag, values])
\ **注意:**\ :ref:`FontVariation<class_FontVariation>` 变体坐标的设置和获取请使用 :ref:`FontVariation.variation_opentype<class_FontVariation_property_variation_opentype>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_underline_position:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_underline_position**\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| :ref:`🔗<class_Font_method_get_underline_position>`
返回基线下方下划线的平均像素偏移。
\ **注意:**\ 字符串的实际下划线位置取决于上下文,并且可能与该函数返回的值有很大不同。仅将其用作粗略估计。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_get_underline_thickness:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_underline_thickness**\ (\ font_size\: :ref:`int<class_int>` = 16\ ) |const| :ref:`🔗<class_Font_method_get_underline_thickness>`
返回下划线的平均粗细。
\ **注意:**\ 字符串的实际下划线粗细取决于上下文,并且可能与该函数返回的值有很大不同。仅将其用作粗略估计。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_has_char:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_char**\ (\ char\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Font_method_has_char>`
如果该字体中包含 Unicode 字符 ``char``\ ,则返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_Font_method_is_language_supported:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_language_supported**\ (\ language\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Font_method_is_language_supported>`
Returns ``true`` if the font supports the given language (as a `ISO 639 <https://en.wikipedia.org/wiki/ISO_639-1>`__ code).
.. rst-class:: classref-item-separator
----
.. _class_Font_method_is_script_supported:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_script_supported**\ (\ script\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Font_method_is_script_supported>`
Returns ``true`` if the font supports the given script (as a `ISO 15924 <https://en.wikipedia.org/wiki/ISO_15924>`__ code).
.. rst-class:: classref-item-separator
----
.. _class_Font_method_set_cache_capacity:
.. rst-class:: classref-method
|void| **set_cache_capacity**\ (\ single_line\: :ref:`int<class_int>`, multi_line\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Font_method_set_cache_capacity>`
``draw_*`` 方法设置 LRU 缓存容量。
.. |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 (无返回值。)`