mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
342 lines
17 KiB
ReStructuredText
342 lines
17 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. DO NOT EDIT THIS FILE!!!
|
||
.. Generated automatically from Godot engine sources.
|
||
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
||
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SystemFont.xml.
|
||
|
||
.. _class_SystemFont:
|
||
|
||
SystemFont
|
||
==========
|
||
|
||
**继承:** :ref:`Font<class_Font>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
从系统字体加载的字体。如果未在宿主操作系统上实现,则回退到默认主题字体。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
描述
|
||
----
|
||
|
||
**SystemFont** 会从系统字体中加载一个字体,该字体是名称能与 :ref:`font_names<class_SystemFont_property_font_names>` 匹配的第一个字体。
|
||
|
||
会尝试匹配字体样式,但是并不保证。
|
||
|
||
返回的字体可能属于某个字体合集,也可能是设置了 OpenType“字重”“宽度”和/或“斜体”特性的可变字体。
|
||
|
||
你可以创建系统字体的 :ref:`FontVariation<class_FontVariation>`\ ,以便对其特征进行精细控制。
|
||
|
||
\ **注意:**\ 这个类在 iOS、Linux、macOS、Windows 上实现,在其他平台上会回退到默认主题字体。
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
属性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`allow_system_fallback<class_SystemFont_property_allow_system_fallback>` | ``true`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` | :ref:`antialiasing<class_SystemFont_property_antialiasing>` | ``1`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`disable_embedded_bitmaps<class_SystemFont_property_disable_embedded_bitmaps>` | ``true`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`font_italic<class_SystemFont_property_font_italic>` | ``false`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`font_names<class_SystemFont_property_font_names>` | ``PackedStringArray()`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`int<class_int>` | :ref:`font_stretch<class_SystemFont_property_font_stretch>` | ``100`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`int<class_int>` | :ref:`font_weight<class_SystemFont_property_font_weight>` | ``400`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`force_autohinter<class_SystemFont_property_force_autohinter>` | ``false`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`generate_mipmaps<class_SystemFont_property_generate_mipmaps>` | ``false`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`Hinting<enum_TextServer_Hinting>` | :ref:`hinting<class_SystemFont_property_hinting>` | ``1`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`int<class_int>` | :ref:`msdf_pixel_range<class_SystemFont_property_msdf_pixel_range>` | ``16`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`int<class_int>` | :ref:`msdf_size<class_SystemFont_property_msdf_size>` | ``48`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`multichannel_signed_distance_field<class_SystemFont_property_multichannel_signed_distance_field>` | ``false`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`float<class_float>` | :ref:`oversampling<class_SystemFont_property_oversampling>` | ``0.0`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
| :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` | :ref:`subpixel_positioning<class_SystemFont_property_subpixel_positioning>` | ``1`` |
|
||
+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
属性说明
|
||
--------
|
||
|
||
.. _class_SystemFont_property_allow_system_fallback:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **allow_system_fallback** = ``true`` :ref:`🔗<class_SystemFont_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_SystemFont_property_antialiasing:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **antialiasing** = ``1`` :ref:`🔗<class_SystemFont_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_SystemFont_property_disable_embedded_bitmaps:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **disable_embedded_bitmaps** = ``true`` :ref:`🔗<class_SystemFont_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_SystemFont_property_font_italic:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **font_italic** = ``false`` :ref:`🔗<class_SystemFont_property_font_italic>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_font_italic**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_font_italic**\ (\ )
|
||
|
||
如果设置为 ``true``\ ,则优先使用斜体(italic)或伪斜体(oblique)。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SystemFont_property_font_names:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`PackedStringArray<class_PackedStringArray>` **font_names** = ``PackedStringArray()`` :ref:`🔗<class_SystemFont_property_font_names>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_font_names**\ (\ value\: :ref:`PackedStringArray<class_PackedStringArray>`\ )
|
||
- :ref:`PackedStringArray<class_PackedStringArray>` **get_font_names**\ (\ )
|
||
|
||
要搜索的字体家族名称数组,会使用第一个与之匹配的字体。
|
||
|
||
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedStringArray<class_PackedStringArray>` for more details.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SystemFont_property_font_stretch:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **font_stretch** = ``100`` :ref:`🔗<class_SystemFont_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_SystemFont_property_font_weight:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **font_weight** = ``400`` :ref:`🔗<class_SystemFont_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_SystemFont_property_force_autohinter:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **force_autohinter** = ``false`` :ref:`🔗<class_SystemFont_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``\ ,则支持自动微调,优先于字体内置微调。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SystemFont_property_generate_mipmaps:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **generate_mipmaps** = ``false`` :ref:`🔗<class_SystemFont_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_SystemFont_property_hinting:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Hinting<enum_TextServer_Hinting>` **hinting** = ``1`` :ref:`🔗<class_SystemFont_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_SystemFont_property_msdf_pixel_range:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **msdf_pixel_range** = ``16`` :ref:`🔗<class_SystemFont_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_SystemFont_property_msdf_pixel_range>` 必须至少设置为最大字体轮廓大小的\ *两倍*\ 。\ :ref:`msdf_pixel_range<class_SystemFont_property_msdf_pixel_range>` 的默认值为 ``16``\ ,允许大小最大到 ``8`` 的轮廓看起来正确。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SystemFont_property_msdf_size:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **msdf_size** = ``48`` :ref:`🔗<class_SystemFont_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_SystemFont_property_multichannel_signed_distance_field:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **multichannel_signed_distance_field** = ``false`` :ref:`🔗<class_SystemFont_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``\ ,则所有大小的字形都将使用从动态字体矢量数据生成的单个多通道带符号距离场渲染。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SystemFont_property_oversampling:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **oversampling** = ``0.0`` :ref:`🔗<class_SystemFont_property_oversampling>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_oversampling**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_oversampling**\ (\ )
|
||
|
||
字体过采样系数,如果设置为 ``0.0`` 则使用全局过采样系数。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SystemFont_property_subpixel_positioning:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **subpixel_positioning** = ``1`` :ref:`🔗<class_SystemFont_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>` 可以根据字体大小自动启用。
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
||
.. |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 (无返回值。)`
|