Font.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Font" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. Internationalized font and text drawing support.
  5. </brief_description>
  6. <description>
  7. Font contains a unicode compatible character set, as well as the ability to draw it with variable width, ascent, descent and kerning. For creating fonts from TTF files (or other font formats), see the editor support for fonts. TODO check wikipedia for graph of ascent/baseline/descent/height/etc.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="draw" qualifiers="const">
  15. <return type="void">
  16. </return>
  17. <argument index="0" name="canvas_item" type="RID">
  18. </argument>
  19. <argument index="1" name="position" type="Vector2">
  20. </argument>
  21. <argument index="2" name="string" type="String">
  22. </argument>
  23. <argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
  24. </argument>
  25. <argument index="4" name="clip_w" type="int" default="-1">
  26. </argument>
  27. <description>
  28. Draw "string" into a canvas item using the font at a given position, with "modulate" color, and optionally clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
  29. </description>
  30. </method>
  31. <method name="draw_char" qualifiers="const">
  32. <return type="float">
  33. </return>
  34. <argument index="0" name="canvas_item" type="RID">
  35. </argument>
  36. <argument index="1" name="position" type="Vector2">
  37. </argument>
  38. <argument index="2" name="char" type="int">
  39. </argument>
  40. <argument index="3" name="next" type="int" default="-1">
  41. </argument>
  42. <argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
  43. </argument>
  44. <description>
  45. Draw character "char" into a canvas item using the font at a given position, with "modulate" color, and optionally kerning if "next" is passed. clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character.
  46. </description>
  47. </method>
  48. <method name="get_ascent" qualifiers="const">
  49. <return type="float">
  50. </return>
  51. <description>
  52. Return the font ascent (number of pixels above the baseline).
  53. </description>
  54. </method>
  55. <method name="get_descent" qualifiers="const">
  56. <return type="float">
  57. </return>
  58. <description>
  59. Return the font descent (number of pixels below the baseline).
  60. </description>
  61. </method>
  62. <method name="get_height" qualifiers="const">
  63. <return type="float">
  64. </return>
  65. <description>
  66. Return the total font height (ascent plus descent) in pixels.
  67. </description>
  68. </method>
  69. <method name="get_string_size" qualifiers="const">
  70. <return type="Vector2">
  71. </return>
  72. <argument index="0" name="string" type="String">
  73. </argument>
  74. <description>
  75. Return the size of a string, taking kerning and advance into account.
  76. </description>
  77. </method>
  78. <method name="is_distance_field_hint" qualifiers="const">
  79. <return type="bool">
  80. </return>
  81. <description>
  82. </description>
  83. </method>
  84. <method name="update_changes">
  85. <return type="void">
  86. </return>
  87. <description>
  88. After editing a font (changing size, ascent, char rects, etc.). Call this function to propagate changes to controls that might use it.
  89. </description>
  90. </method>
  91. </methods>
  92. <constants>
  93. </constants>
  94. </class>