class_systemfont.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SystemFont.xml.
  6. .. _class_SystemFont:
  7. SystemFont
  8. ==========
  9. **Inherits:** :ref:`Font<class_Font>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A font loaded from a system font. Falls back to a default theme font if not implemented on the host OS.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **SystemFont** loads a font from a system font with the first matching name from :ref:`font_names<class_SystemFont_property_font_names>`.
  15. It will attempt to match font style, but it's not guaranteed.
  16. The returned font might be part of a font collection or be a variable font with OpenType "weight", "width" and/or "italic" features set.
  17. You can create :ref:`FontVariation<class_FontVariation>` of the system font for fine control over its features.
  18. \ **Note:** This class is implemented on iOS, Linux, macOS and Windows, on other platforms it will fallback to default theme font.
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`allow_system_fallback<class_SystemFont_property_allow_system_fallback>` | ``true`` |
  26. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  27. | :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` | :ref:`antialiasing<class_SystemFont_property_antialiasing>` | ``1`` |
  28. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`font_italic<class_SystemFont_property_font_italic>` | ``false`` |
  30. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  31. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`font_names<class_SystemFont_property_font_names>` | ``PackedStringArray()`` |
  32. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  33. | :ref:`int<class_int>` | :ref:`font_stretch<class_SystemFont_property_font_stretch>` | ``100`` |
  34. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  35. | :ref:`int<class_int>` | :ref:`font_weight<class_SystemFont_property_font_weight>` | ``400`` |
  36. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`force_autohinter<class_SystemFont_property_force_autohinter>` | ``false`` |
  38. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`generate_mipmaps<class_SystemFont_property_generate_mipmaps>` | ``false`` |
  40. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  41. | :ref:`Hinting<enum_TextServer_Hinting>` | :ref:`hinting<class_SystemFont_property_hinting>` | ``1`` |
  42. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  43. | :ref:`int<class_int>` | :ref:`msdf_pixel_range<class_SystemFont_property_msdf_pixel_range>` | ``16`` |
  44. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  45. | :ref:`int<class_int>` | :ref:`msdf_size<class_SystemFont_property_msdf_size>` | ``48`` |
  46. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`multichannel_signed_distance_field<class_SystemFont_property_multichannel_signed_distance_field>` | ``false`` |
  48. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  49. | :ref:`float<class_float>` | :ref:`oversampling<class_SystemFont_property_oversampling>` | ``0.0`` |
  50. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  51. | :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` | :ref:`subpixel_positioning<class_SystemFont_property_subpixel_positioning>` | ``1`` |
  52. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  53. .. rst-class:: classref-section-separator
  54. ----
  55. .. rst-class:: classref-descriptions-group
  56. Property Descriptions
  57. ---------------------
  58. .. _class_SystemFont_property_allow_system_fallback:
  59. .. rst-class:: classref-property
  60. :ref:`bool<class_bool>` **allow_system_fallback** = ``true``
  61. .. rst-class:: classref-property-setget
  62. - void **set_allow_system_fallback** **(** :ref:`bool<class_bool>` value **)**
  63. - :ref:`bool<class_bool>` **is_allow_system_fallback** **(** **)**
  64. If set to ``true``, system fonts can be automatically used as fallbacks.
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_SystemFont_property_antialiasing:
  68. .. rst-class:: classref-property
  69. :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **antialiasing** = ``1``
  70. .. rst-class:: classref-property-setget
  71. - void **set_antialiasing** **(** :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` value **)**
  72. - :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **get_antialiasing** **(** **)**
  73. Font anti-aliasing mode.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_SystemFont_property_font_italic:
  77. .. rst-class:: classref-property
  78. :ref:`bool<class_bool>` **font_italic** = ``false``
  79. .. rst-class:: classref-property-setget
  80. - void **set_font_italic** **(** :ref:`bool<class_bool>` value **)**
  81. - :ref:`bool<class_bool>` **get_font_italic** **(** **)**
  82. If set to ``true``, italic or oblique font is preferred.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_SystemFont_property_font_names:
  86. .. rst-class:: classref-property
  87. :ref:`PackedStringArray<class_PackedStringArray>` **font_names** = ``PackedStringArray()``
  88. .. rst-class:: classref-property-setget
  89. - void **set_font_names** **(** :ref:`PackedStringArray<class_PackedStringArray>` value **)**
  90. - :ref:`PackedStringArray<class_PackedStringArray>` **get_font_names** **(** **)**
  91. Array of font family names to search, first matching font found is used.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_SystemFont_property_font_stretch:
  95. .. rst-class:: classref-property
  96. :ref:`int<class_int>` **font_stretch** = ``100``
  97. .. rst-class:: classref-property-setget
  98. - void **set_font_stretch** **(** :ref:`int<class_int>` value **)**
  99. - :ref:`int<class_int>` **get_font_stretch** **(** **)**
  100. Preferred font stretch amount, compared to a normal width. A percentage value between ``50%`` and ``200%``.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_SystemFont_property_font_weight:
  104. .. rst-class:: classref-property
  105. :ref:`int<class_int>` **font_weight** = ``400``
  106. .. rst-class:: classref-property-setget
  107. - void **set_font_weight** **(** :ref:`int<class_int>` value **)**
  108. - :ref:`int<class_int>` **get_font_weight** **(** **)**
  109. Preferred weight (boldness) of the font. A value in the ``100...999`` range, normal font weight is ``400``, bold font weight is ``700``.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_SystemFont_property_force_autohinter:
  113. .. rst-class:: classref-property
  114. :ref:`bool<class_bool>` **force_autohinter** = ``false``
  115. .. rst-class:: classref-property-setget
  116. - void **set_force_autohinter** **(** :ref:`bool<class_bool>` value **)**
  117. - :ref:`bool<class_bool>` **is_force_autohinter** **(** **)**
  118. If set to ``true``, auto-hinting is supported and preferred over font built-in hinting.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_SystemFont_property_generate_mipmaps:
  122. .. rst-class:: classref-property
  123. :ref:`bool<class_bool>` **generate_mipmaps** = ``false``
  124. .. rst-class:: classref-property-setget
  125. - void **set_generate_mipmaps** **(** :ref:`bool<class_bool>` value **)**
  126. - :ref:`bool<class_bool>` **get_generate_mipmaps** **(** **)**
  127. If set to ``true``, generate mipmaps for the font textures.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_SystemFont_property_hinting:
  131. .. rst-class:: classref-property
  132. :ref:`Hinting<enum_TextServer_Hinting>` **hinting** = ``1``
  133. .. rst-class:: classref-property-setget
  134. - void **set_hinting** **(** :ref:`Hinting<enum_TextServer_Hinting>` value **)**
  135. - :ref:`Hinting<enum_TextServer_Hinting>` **get_hinting** **(** **)**
  136. Font hinting mode.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_SystemFont_property_msdf_pixel_range:
  140. .. rst-class:: classref-property
  141. :ref:`int<class_int>` **msdf_pixel_range** = ``16``
  142. .. rst-class:: classref-property-setget
  143. - void **set_msdf_pixel_range** **(** :ref:`int<class_int>` value **)**
  144. - :ref:`int<class_int>` **get_msdf_pixel_range** **(** **)**
  145. The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, :ref:`msdf_pixel_range<class_SystemFont_property_msdf_pixel_range>` must be set to at least *twice* the size of the largest font outline. The default :ref:`msdf_pixel_range<class_SystemFont_property_msdf_pixel_range>` value of ``16`` allows outline sizes up to ``8`` to look correct.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_SystemFont_property_msdf_size:
  149. .. rst-class:: classref-property
  150. :ref:`int<class_int>` **msdf_size** = ``48``
  151. .. rst-class:: classref-property-setget
  152. - void **set_msdf_size** **(** :ref:`int<class_int>` value **)**
  153. - :ref:`int<class_int>` **get_msdf_size** **(** **)**
  154. Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_SystemFont_property_multichannel_signed_distance_field:
  158. .. rst-class:: classref-property
  159. :ref:`bool<class_bool>` **multichannel_signed_distance_field** = ``false``
  160. .. rst-class:: classref-property-setget
  161. - void **set_multichannel_signed_distance_field** **(** :ref:`bool<class_bool>` value **)**
  162. - :ref:`bool<class_bool>` **is_multichannel_signed_distance_field** **(** **)**
  163. If set to ``true``, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_SystemFont_property_oversampling:
  167. .. rst-class:: classref-property
  168. :ref:`float<class_float>` **oversampling** = ``0.0``
  169. .. rst-class:: classref-property-setget
  170. - void **set_oversampling** **(** :ref:`float<class_float>` value **)**
  171. - :ref:`float<class_float>` **get_oversampling** **(** **)**
  172. Font oversampling factor, if set to ``0.0`` global oversampling factor is used instead.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_SystemFont_property_subpixel_positioning:
  176. .. rst-class:: classref-property
  177. :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **subpixel_positioning** = ``1``
  178. .. rst-class:: classref-property-setget
  179. - void **set_subpixel_positioning** **(** :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` value **)**
  180. - :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **get_subpixel_positioning** **(** **)**
  181. Font glyph subpixel positioning mode. Subpixel positioning provides shaper text and better kerning for smaller font sizes, at the cost of memory usage and font rasterization speed. Use :ref:`TextServer.SUBPIXEL_POSITIONING_AUTO<class_TextServer_constant_SUBPIXEL_POSITIONING_AUTO>` to automatically enable it based on the font size.
  182. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  183. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  184. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  185. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  186. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  187. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  188. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`