BitmapFont.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="BitmapFont" inherits="Font" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. Renders text using [code]*.fnt[/code] fonts.
  5. </brief_description>
  6. <description>
  7. Renders text using [code]*.fnt[/code] fonts containing texture atlases. Supports distance fields. For using vector font files like TTF directly, see [DynamicFont].
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="add_char">
  15. <return type="void">
  16. </return>
  17. <argument index="0" name="character" type="int">
  18. </argument>
  19. <argument index="1" name="texture" type="int">
  20. </argument>
  21. <argument index="2" name="rect" type="Rect2">
  22. </argument>
  23. <argument index="3" name="align" type="Vector2" default="Vector2( 0, 0 )">
  24. </argument>
  25. <argument index="4" name="advance" type="float" default="-1">
  26. </argument>
  27. <description>
  28. Adds a character to the font, where [code]character[/code] is the unicode value, [code]texture[/code] is the texture index, [code]rect[/code] is the region in the texture (in pixels!), [code]align[/code] is the (optional) alignment for the character and [code]advance[/code] is the (optional) advance.
  29. </description>
  30. </method>
  31. <method name="add_kerning_pair">
  32. <return type="void">
  33. </return>
  34. <argument index="0" name="char_a" type="int">
  35. </argument>
  36. <argument index="1" name="char_b" type="int">
  37. </argument>
  38. <argument index="2" name="kerning" type="int">
  39. </argument>
  40. <description>
  41. Adds a kerning pair to the [code]BitmapFont[/code] as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character.
  42. </description>
  43. </method>
  44. <method name="add_texture">
  45. <return type="void">
  46. </return>
  47. <argument index="0" name="texture" type="Texture">
  48. </argument>
  49. <description>
  50. Adds a texture to the [code]BitmapFont[/code].
  51. </description>
  52. </method>
  53. <method name="clear">
  54. <return type="void">
  55. </return>
  56. <description>
  57. Clears all the font data and settings.
  58. </description>
  59. </method>
  60. <method name="create_from_fnt">
  61. <return type="int" enum="Error">
  62. </return>
  63. <argument index="0" name="path" type="String">
  64. </argument>
  65. <description>
  66. Creates a BitmapFont from the [code]*.fnt[/code] file at [code]path[/code].
  67. </description>
  68. </method>
  69. <method name="get_char_size" qualifiers="const">
  70. <return type="Vector2">
  71. </return>
  72. <argument index="0" name="char" type="int">
  73. </argument>
  74. <argument index="1" name="next" type="int" default="0">
  75. </argument>
  76. <description>
  77. Returns the size of a character, optionally taking kerning into account if the next character is provided.
  78. </description>
  79. </method>
  80. <method name="get_fallback" qualifiers="const">
  81. <return type="BitmapFont">
  82. </return>
  83. <description>
  84. Returns the fallback BitmapFont.
  85. </description>
  86. </method>
  87. <method name="get_kerning_pair" qualifiers="const">
  88. <return type="int">
  89. </return>
  90. <argument index="0" name="char_a" type="int">
  91. </argument>
  92. <argument index="1" name="char_b" type="int">
  93. </argument>
  94. <description>
  95. Returns a kerning pair as a difference.
  96. </description>
  97. </method>
  98. <method name="get_texture" qualifiers="const">
  99. <return type="Texture">
  100. </return>
  101. <argument index="0" name="idx" type="int">
  102. </argument>
  103. <description>
  104. Returns the font atlas texture at index [code]idx[/code].
  105. </description>
  106. </method>
  107. <method name="get_texture_count" qualifiers="const">
  108. <return type="int">
  109. </return>
  110. <description>
  111. Returns the number of textures in the BitmapFont atlas.
  112. </description>
  113. </method>
  114. <method name="set_ascent">
  115. <return type="void">
  116. </return>
  117. <argument index="0" name="px" type="float">
  118. </argument>
  119. <description>
  120. Sets the font ascent (number of pixels above the baseline).
  121. </description>
  122. </method>
  123. <method name="set_distance_field_hint">
  124. <return type="void">
  125. </return>
  126. <argument index="0" name="enable" type="bool">
  127. </argument>
  128. <description>
  129. If [code]true[/code] distance field hint is enabled.
  130. </description>
  131. </method>
  132. <method name="set_fallback">
  133. <return type="void">
  134. </return>
  135. <argument index="0" name="fallback" type="BitmapFont">
  136. </argument>
  137. <description>
  138. Sets the fallback BitmapFont.
  139. </description>
  140. </method>
  141. <method name="set_height">
  142. <return type="void">
  143. </return>
  144. <argument index="0" name="px" type="float">
  145. </argument>
  146. <description>
  147. Sets the total font height (ascent plus descent) in pixels.
  148. </description>
  149. </method>
  150. </methods>
  151. <members>
  152. <member name="ascent" type="float" setter="set_ascent" getter="get_ascent">
  153. Ascent (number of pixels above the baseline).
  154. </member>
  155. <member name="chars" type="PoolIntArray" setter="_set_chars" getter="_get_chars">
  156. The characters in the BitmapFont.
  157. </member>
  158. <member name="distance_field" type="bool" setter="set_distance_field_hint" getter="is_distance_field_hint">
  159. If [code]true[/code] distance field hint is enabled.
  160. </member>
  161. <member name="fallback" type="BitmapFont" setter="set_fallback" getter="get_fallback">
  162. The fallback font.
  163. </member>
  164. <member name="height" type="float" setter="set_height" getter="get_height">
  165. Total font height (ascent plus descent) in pixels.
  166. </member>
  167. <member name="kernings" type="PoolIntArray" setter="_set_kernings" getter="_get_kernings">
  168. The font's kernings as [PoolIntArray].
  169. </member>
  170. <member name="textures" type="Array" setter="_set_textures" getter="_get_textures">
  171. The font's [Texture]s.
  172. </member>
  173. </members>
  174. <constants>
  175. </constants>
  176. </class>