/docs/api/gamejs/font/index.html

https://github.com/tnajdek/gamejs · HTML · 199 lines · 174 code · 22 blank · 3 comment · 0 complexity · 51fb7f002bfd1f4f644a55f9a41e093f MD5 · raw file

  1. <!DOCTYPE html >
  2. <html lang="de" dir="ltr">
  3. <head>
  4. <title>gamejs/font - GameJs API</title>
  5. <link rel="shortcut icon" href="http://ringojs.org/favicon.ico" type="image/x-icon" />
  6. <link rel="icon" href="http://ringojs.org/favicon.ico" type="image/x-icon" />
  7. <link rel="stylesheet" href="../../static/style.css" />
  8. <link rel="stylesheet" href="../../static/jsdoc.css" />
  9. <script type="text/javascript" src="../../static/jquery.js"></script>
  10. <script type="text/javascript" src="../../static/jsdoc.js"></script>
  11. <script>
  12. $(document).ready(jsdocSetup);
  13. </script>
  14. </head>
  15. <body>
  16. <div class="wrap">
  17. <div class="main">
  18. <div class="content">
  19. <h1 class="modulename">Module gamejs/font</h1>
  20. <div class="fileoverview">
  21. <p>Methods for creating Font objects which can render text
  22. to a Surface.</p>
  23. Example:
  24. <pre><code>// create a font
  25. var font = new Font('20px monospace');
  26. // render text - this returns a surface with the text written on it.
  27. var helloSurface = font.render('Hello World')</code></pre>
  28. </div>
  29. <div class="classoverview">
  30. <div class="classes">
  31. <h2>Class <a href="#Font" class="jsdoc-title">Font</a></h2>
  32. <div>
  33. <h3>Instance Methods</h3>
  34. <ul class="propertyoverview">
  35. <li>
  36. <a href="#Font.prototype.render" class="jsdoc-title"> render</a>(text, color)
  37. </li>
  38. <li>
  39. <a href="#Font.prototype.size" class="jsdoc-title"> size</a>(text)
  40. </li>
  41. </ul>
  42. </div>
  43. </div>
  44. </div>
  45. <hr/>
  46. <div class="details">
  47. <!-- tpl-docitem -->
  48. <div>
  49. <div class="docitem" docitem="Font">
  50. <h3>
  51. <span class="itemtitle"><a id="Font" href="#Font" class="itemtitle itemname">Font</a></span>
  52. <span class="itemtitle light">(fontSettings, backgroundColor)</span></h3>
  53. <div>
  54. <p>Create a Font to draw on the screen. The Font allows you to
  55. <code>render()</code> text. Rendering text returns a Surface which
  56. in turn can be put on screen.</p>
  57. </div>
  58. <div>
  59. <h4>Parameters</h4>
  60. <table>
  61. <tr>
  62. <td>String</td>
  63. <td class="paramname">fontSettings</td>
  64. <td>a css font definition, e.g., "20px monospace"</td>
  65. </tr>
  66. <tr>
  67. <td>STring</td>
  68. <td class="paramname">backgroundColor</td>
  69. <td>valid #rgb string, "#ff00cc"</td>
  70. </tr>
  71. </table>
  72. </div>
  73. </div>
  74. <hr/>
  75. </div>
  76. <!-- tpl-docitem -->
  77. <div>
  78. <div class="docitem" docitem="Font.prototype.render">
  79. <h3>
  80. <span class="itemtitle">Font.prototype.<a id="Font.prototype.render" href="#Font.prototype.render" class="itemtitle itemname">render</a></span>
  81. <span class="itemtitle light">(text, color)</span></h3>
  82. <div>
  83. <p>Returns a Surface with the given text on it.</p>
  84. </div>
  85. <div>
  86. <h4>Parameters</h4>
  87. <table>
  88. <tr>
  89. <td>String</td>
  90. <td class="paramname">text</td>
  91. <td>the text to render</td>
  92. </tr>
  93. <tr>
  94. <td>String</td>
  95. <td class="paramname">color</td>
  96. <td>a valid #RGB String, "#ffcc00"</td>
  97. </tr>
  98. </table>
  99. </div>
  100. <div>
  101. <h4>Returns</h4>
  102. <table>
  103. <tr>
  104. <td>gamejs.Surface</td>
  105. <td> Surface with the rendered text on it.</td>
  106. </tr>
  107. </table>
  108. </div>
  109. </div>
  110. <hr/>
  111. </div>
  112. <!-- tpl-docitem -->
  113. <div>
  114. <div class="docitem" docitem="Font.prototype.size">
  115. <h3>
  116. <span class="itemtitle">Font.prototype.<a id="Font.prototype.size" href="#Font.prototype.size" class="itemtitle itemname">size</a></span>
  117. <span class="itemtitle light">(text)</span></h3>
  118. <div>
  119. <p>Determine the width and height of the given text if rendered
  120. with this Font.</p>
  121. </div>
  122. <div>
  123. <h4>Parameters</h4>
  124. <table>
  125. <tr>
  126. <td>String</td>
  127. <td class="paramname">text</td>
  128. <td>the text to measure</td>
  129. </tr>
  130. </table>
  131. </div>
  132. <div>
  133. <h4>Returns</h4>
  134. <table>
  135. <tr>
  136. <td>Array</td>
  137. <td> the [width, height] of the text if rendered with this Font</td>
  138. </tr>
  139. </table>
  140. </div>
  141. </div>
  142. <hr/>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. <div class="menu" style="margin-top: 1em; font-size: 13px;">
  148. GameJs API<br/>
  149. <a href="../../index.html">Module list</a>
  150. <a href="../../index_all.html">Full index</a><br/>
  151. <input id="jsdoc-leftnavsearch" type="search" placeholder="Filter module list" size="14">
  152. <ul class="jsdoc-leftnav leftnav">
  153. <li><a href="../../gamejs/index.html"> gamejs </a></li>
  154. <li><a href="../../gamejs/display/index.html"> gamejs/display </a></li>
  155. <li><a href="../../gamejs/draw/index.html"> gamejs/draw </a></li>
  156. <li><a href="../../gamejs/event/index.html"> gamejs/event </a></li>
  157. <li><a href="../../gamejs/font/index.html"> gamejs/font </a></li>
  158. <li><a href="../../gamejs/http/index.html"> gamejs/http </a></li>
  159. <li><a href="../../gamejs/image/index.html"> gamejs/image </a></li>
  160. <li><a href="../../gamejs/mask/index.html"> gamejs/mask </a></li>
  161. <li><a href="../../gamejs/mixer/index.html"> gamejs/mixer </a></li>
  162. <li><a href="../../gamejs/sprite/index.html"> gamejs/sprite </a></li>
  163. <li><a href="../../gamejs/surfacearray/index.html"> gamejs/surfacearray </a></li>
  164. <li><a href="../../gamejs/time/index.html"> gamejs/time </a></li>
  165. <li><a href="../../gamejs/transform/index.html"> gamejs/transform </a></li>
  166. <li><a href="../../gamejs/pathfinding/astar/index.html"> gamejs/pathfinding/astar </a></li>
  167. <li><a href="../../gamejs/utils/arrays/index.html"> gamejs/utils/arrays </a></li>
  168. <li><a href="../../gamejs/utils/binaryheap/index.html"> gamejs/utils/binaryheap </a></li>
  169. <li><a href="../../gamejs/utils/math/index.html"> gamejs/utils/math </a></li>
  170. <li><a href="../../gamejs/utils/matrix/index.html"> gamejs/utils/matrix </a></li>
  171. <li><a href="../../gamejs/utils/objects/index.html"> gamejs/utils/objects </a></li>
  172. <li><a href="../../gamejs/utils/vectors/index.html"> gamejs/utils/vectors </a></li>
  173. </ul>
  174. </div>
  175. </div>
  176. </body>
  177. </html>