class_systemfont.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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 precise 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:`disable_embedded_bitmaps<class_SystemFont_property_disable_embedded_bitmaps>` | ``true`` |
  30. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`font_italic<class_SystemFont_property_font_italic>` | ``false`` |
  32. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  33. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`font_names<class_SystemFont_property_font_names>` | ``PackedStringArray()`` |
  34. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  35. | :ref:`int<class_int>` | :ref:`font_stretch<class_SystemFont_property_font_stretch>` | ``100`` |
  36. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  37. | :ref:`int<class_int>` | :ref:`font_weight<class_SystemFont_property_font_weight>` | ``400`` |
  38. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`force_autohinter<class_SystemFont_property_force_autohinter>` | ``false`` |
  40. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`generate_mipmaps<class_SystemFont_property_generate_mipmaps>` | ``false`` |
  42. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  43. | :ref:`Hinting<enum_TextServer_Hinting>` | :ref:`hinting<class_SystemFont_property_hinting>` | ``1`` |
  44. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`keep_rounding_remainders<class_SystemFont_property_keep_rounding_remainders>` | ``true`` |
  46. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`modulate_color_glyphs<class_SystemFont_property_modulate_color_glyphs>` | ``false`` |
  48. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  49. | :ref:`int<class_int>` | :ref:`msdf_pixel_range<class_SystemFont_property_msdf_pixel_range>` | ``16`` |
  50. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  51. | :ref:`int<class_int>` | :ref:`msdf_size<class_SystemFont_property_msdf_size>` | ``48`` |
  52. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`multichannel_signed_distance_field<class_SystemFont_property_multichannel_signed_distance_field>` | ``false`` |
  54. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  55. | :ref:`float<class_float>` | :ref:`oversampling<class_SystemFont_property_oversampling>` | ``0.0`` |
  56. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  57. | :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` | :ref:`subpixel_positioning<class_SystemFont_property_subpixel_positioning>` | ``1`` |
  58. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------+
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Property Descriptions
  63. ---------------------
  64. .. _class_SystemFont_property_allow_system_fallback:
  65. .. rst-class:: classref-property
  66. :ref:`bool<class_bool>` **allow_system_fallback** = ``true`` :ref:`🔗<class_SystemFont_property_allow_system_fallback>`
  67. .. rst-class:: classref-property-setget
  68. - |void| **set_allow_system_fallback**\ (\ value\: :ref:`bool<class_bool>`\ )
  69. - :ref:`bool<class_bool>` **is_allow_system_fallback**\ (\ )
  70. If set to ``true``, system fonts can be automatically used as fallbacks.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_SystemFont_property_antialiasing:
  74. .. rst-class:: classref-property
  75. :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **antialiasing** = ``1`` :ref:`🔗<class_SystemFont_property_antialiasing>`
  76. .. rst-class:: classref-property-setget
  77. - |void| **set_antialiasing**\ (\ value\: :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>`\ )
  78. - :ref:`FontAntialiasing<enum_TextServer_FontAntialiasing>` **get_antialiasing**\ (\ )
  79. Font anti-aliasing mode.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_SystemFont_property_disable_embedded_bitmaps:
  83. .. rst-class:: classref-property
  84. :ref:`bool<class_bool>` **disable_embedded_bitmaps** = ``true`` :ref:`🔗<class_SystemFont_property_disable_embedded_bitmaps>`
  85. .. rst-class:: classref-property-setget
  86. - |void| **set_disable_embedded_bitmaps**\ (\ value\: :ref:`bool<class_bool>`\ )
  87. - :ref:`bool<class_bool>` **get_disable_embedded_bitmaps**\ (\ )
  88. If set to ``true``, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_SystemFont_property_font_italic:
  92. .. rst-class:: classref-property
  93. :ref:`bool<class_bool>` **font_italic** = ``false`` :ref:`🔗<class_SystemFont_property_font_italic>`
  94. .. rst-class:: classref-property-setget
  95. - |void| **set_font_italic**\ (\ value\: :ref:`bool<class_bool>`\ )
  96. - :ref:`bool<class_bool>` **get_font_italic**\ (\ )
  97. If set to ``true``, italic or oblique font is preferred.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_SystemFont_property_font_names:
  101. .. rst-class:: classref-property
  102. :ref:`PackedStringArray<class_PackedStringArray>` **font_names** = ``PackedStringArray()`` :ref:`🔗<class_SystemFont_property_font_names>`
  103. .. rst-class:: classref-property-setget
  104. - |void| **set_font_names**\ (\ value\: :ref:`PackedStringArray<class_PackedStringArray>`\ )
  105. - :ref:`PackedStringArray<class_PackedStringArray>` **get_font_names**\ (\ )
  106. Array of font family names to search, first matching font found is used.
  107. **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.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_SystemFont_property_font_stretch:
  111. .. rst-class:: classref-property
  112. :ref:`int<class_int>` **font_stretch** = ``100`` :ref:`🔗<class_SystemFont_property_font_stretch>`
  113. .. rst-class:: classref-property-setget
  114. - |void| **set_font_stretch**\ (\ value\: :ref:`int<class_int>`\ )
  115. - :ref:`int<class_int>` **get_font_stretch**\ (\ )
  116. Preferred font stretch amount, compared to a normal width. A percentage value between ``50%`` and ``200%``.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_SystemFont_property_font_weight:
  120. .. rst-class:: classref-property
  121. :ref:`int<class_int>` **font_weight** = ``400`` :ref:`🔗<class_SystemFont_property_font_weight>`
  122. .. rst-class:: classref-property-setget
  123. - |void| **set_font_weight**\ (\ value\: :ref:`int<class_int>`\ )
  124. - :ref:`int<class_int>` **get_font_weight**\ (\ )
  125. Preferred weight (boldness) of the font. A value in the ``100...999`` range, normal font weight is ``400``, bold font weight is ``700``.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_SystemFont_property_force_autohinter:
  129. .. rst-class:: classref-property
  130. :ref:`bool<class_bool>` **force_autohinter** = ``false`` :ref:`🔗<class_SystemFont_property_force_autohinter>`
  131. .. rst-class:: classref-property-setget
  132. - |void| **set_force_autohinter**\ (\ value\: :ref:`bool<class_bool>`\ )
  133. - :ref:`bool<class_bool>` **is_force_autohinter**\ (\ )
  134. If set to ``true``, auto-hinting is supported and preferred over font built-in hinting.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_SystemFont_property_generate_mipmaps:
  138. .. rst-class:: classref-property
  139. :ref:`bool<class_bool>` **generate_mipmaps** = ``false`` :ref:`🔗<class_SystemFont_property_generate_mipmaps>`
  140. .. rst-class:: classref-property-setget
  141. - |void| **set_generate_mipmaps**\ (\ value\: :ref:`bool<class_bool>`\ )
  142. - :ref:`bool<class_bool>` **get_generate_mipmaps**\ (\ )
  143. If set to ``true``, generate mipmaps for the font textures.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_SystemFont_property_hinting:
  147. .. rst-class:: classref-property
  148. :ref:`Hinting<enum_TextServer_Hinting>` **hinting** = ``1`` :ref:`🔗<class_SystemFont_property_hinting>`
  149. .. rst-class:: classref-property-setget
  150. - |void| **set_hinting**\ (\ value\: :ref:`Hinting<enum_TextServer_Hinting>`\ )
  151. - :ref:`Hinting<enum_TextServer_Hinting>` **get_hinting**\ (\ )
  152. Font hinting mode.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_SystemFont_property_keep_rounding_remainders:
  156. .. rst-class:: classref-property
  157. :ref:`bool<class_bool>` **keep_rounding_remainders** = ``true`` :ref:`🔗<class_SystemFont_property_keep_rounding_remainders>`
  158. .. rst-class:: classref-property-setget
  159. - |void| **set_keep_rounding_remainders**\ (\ value\: :ref:`bool<class_bool>`\ )
  160. - :ref:`bool<class_bool>` **get_keep_rounding_remainders**\ (\ )
  161. If set to ``true``, when aligning glyphs to the pixel boundaries rounding remainders are accumulated to ensure more uniform glyph distribution. This setting has no effect if subpixel positioning is enabled.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_SystemFont_property_modulate_color_glyphs:
  165. .. rst-class:: classref-property
  166. :ref:`bool<class_bool>` **modulate_color_glyphs** = ``false`` :ref:`🔗<class_SystemFont_property_modulate_color_glyphs>`
  167. .. rst-class:: classref-property-setget
  168. - |void| **set_modulate_color_glyphs**\ (\ value\: :ref:`bool<class_bool>`\ )
  169. - :ref:`bool<class_bool>` **is_modulate_color_glyphs**\ (\ )
  170. If set to ``true``, color modulation is applied when drawing colored glyphs, otherwise it's applied to the monochrome glyphs only.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_SystemFont_property_msdf_pixel_range:
  174. .. rst-class:: classref-property
  175. :ref:`int<class_int>` **msdf_pixel_range** = ``16`` :ref:`🔗<class_SystemFont_property_msdf_pixel_range>`
  176. .. rst-class:: classref-property-setget
  177. - |void| **set_msdf_pixel_range**\ (\ value\: :ref:`int<class_int>`\ )
  178. - :ref:`int<class_int>` **get_msdf_pixel_range**\ (\ )
  179. 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.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_SystemFont_property_msdf_size:
  183. .. rst-class:: classref-property
  184. :ref:`int<class_int>` **msdf_size** = ``48`` :ref:`🔗<class_SystemFont_property_msdf_size>`
  185. .. rst-class:: classref-property-setget
  186. - |void| **set_msdf_size**\ (\ value\: :ref:`int<class_int>`\ )
  187. - :ref:`int<class_int>` **get_msdf_size**\ (\ )
  188. 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.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_SystemFont_property_multichannel_signed_distance_field:
  192. .. rst-class:: classref-property
  193. :ref:`bool<class_bool>` **multichannel_signed_distance_field** = ``false`` :ref:`🔗<class_SystemFont_property_multichannel_signed_distance_field>`
  194. .. rst-class:: classref-property-setget
  195. - |void| **set_multichannel_signed_distance_field**\ (\ value\: :ref:`bool<class_bool>`\ )
  196. - :ref:`bool<class_bool>` **is_multichannel_signed_distance_field**\ (\ )
  197. If set to ``true``, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_SystemFont_property_oversampling:
  201. .. rst-class:: classref-property
  202. :ref:`float<class_float>` **oversampling** = ``0.0`` :ref:`🔗<class_SystemFont_property_oversampling>`
  203. .. rst-class:: classref-property-setget
  204. - |void| **set_oversampling**\ (\ value\: :ref:`float<class_float>`\ )
  205. - :ref:`float<class_float>` **get_oversampling**\ (\ )
  206. If set to a positive value, overrides the oversampling factor of the viewport this font is used in. See :ref:`Viewport.oversampling<class_Viewport_property_oversampling>`. This value doesn't override the ``oversampling`` parameter of ``draw_*`` methods.
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _class_SystemFont_property_subpixel_positioning:
  210. .. rst-class:: classref-property
  211. :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **subpixel_positioning** = ``1`` :ref:`🔗<class_SystemFont_property_subpixel_positioning>`
  212. .. rst-class:: classref-property-setget
  213. - |void| **set_subpixel_positioning**\ (\ value\: :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>`\ )
  214. - :ref:`SubpixelPositioning<enum_TextServer_SubpixelPositioning>` **get_subpixel_positioning**\ (\ )
  215. 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.
  216. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  217. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  218. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  219. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  220. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  221. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  222. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  223. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  224. .. |void| replace:: :abbr:`void (No return value.)`