/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
- <!DOCTYPE html >
- <html lang="de" dir="ltr">
- <head>
- <title>gamejs/font - GameJs API</title>
- <link rel="shortcut icon" href="http://ringojs.org/favicon.ico" type="image/x-icon" />
- <link rel="icon" href="http://ringojs.org/favicon.ico" type="image/x-icon" />
- <link rel="stylesheet" href="../../static/style.css" />
- <link rel="stylesheet" href="../../static/jsdoc.css" />
- <script type="text/javascript" src="../../static/jquery.js"></script>
- <script type="text/javascript" src="../../static/jsdoc.js"></script>
- <script>
- $(document).ready(jsdocSetup);
- </script>
- </head>
- <body>
- <div class="wrap">
- <div class="main">
- <div class="content">
- <h1 class="modulename">Module gamejs/font</h1>
- <div class="fileoverview">
- <p>Methods for creating Font objects which can render text
- to a Surface.</p>
- Example:
- <pre><code>// create a font
- var font = new Font('20px monospace');
- // render text - this returns a surface with the text written on it.
- var helloSurface = font.render('Hello World')</code></pre>
- </div>
- <div class="classoverview">
- <div class="classes">
- <h2>Class <a href="#Font" class="jsdoc-title">Font</a></h2>
- <div>
- <h3>Instance Methods</h3>
- <ul class="propertyoverview">
- <li>
- <a href="#Font.prototype.render" class="jsdoc-title"> render</a>(text, color)
- </li>
- <li>
- <a href="#Font.prototype.size" class="jsdoc-title"> size</a>(text)
- </li>
- </ul>
- </div>
- </div>
- </div>
- <hr/>
- <div class="details">
- <!-- tpl-docitem -->
- <div>
- <div class="docitem" docitem="Font">
- <h3>
- <span class="itemtitle"><a id="Font" href="#Font" class="itemtitle itemname">Font</a></span>
- <span class="itemtitle light">(fontSettings, backgroundColor)</span></h3>
- <div>
- <p>Create a Font to draw on the screen. The Font allows you to
- <code>render()</code> text. Rendering text returns a Surface which
- in turn can be put on screen.</p>
- </div>
- <div>
- <h4>Parameters</h4>
- <table>
- <tr>
- <td>String</td>
- <td class="paramname">fontSettings</td>
- <td>a css font definition, e.g., "20px monospace"</td>
- </tr>
- <tr>
- <td>STring</td>
- <td class="paramname">backgroundColor</td>
- <td>valid #rgb string, "#ff00cc"</td>
- </tr>
- </table>
- </div>
- </div>
- <hr/>
- </div>
- <!-- tpl-docitem -->
- <div>
- <div class="docitem" docitem="Font.prototype.render">
- <h3>
- <span class="itemtitle">Font.prototype.<a id="Font.prototype.render" href="#Font.prototype.render" class="itemtitle itemname">render</a></span>
- <span class="itemtitle light">(text, color)</span></h3>
- <div>
- <p>Returns a Surface with the given text on it.</p>
- </div>
- <div>
- <h4>Parameters</h4>
- <table>
- <tr>
- <td>String</td>
- <td class="paramname">text</td>
- <td>the text to render</td>
- </tr>
- <tr>
- <td>String</td>
- <td class="paramname">color</td>
- <td>a valid #RGB String, "#ffcc00"</td>
- </tr>
- </table>
- </div>
- <div>
- <h4>Returns</h4>
- <table>
- <tr>
- <td>gamejs.Surface</td>
- <td> Surface with the rendered text on it.</td>
- </tr>
- </table>
- </div>
- </div>
- <hr/>
- </div>
- <!-- tpl-docitem -->
- <div>
- <div class="docitem" docitem="Font.prototype.size">
- <h3>
- <span class="itemtitle">Font.prototype.<a id="Font.prototype.size" href="#Font.prototype.size" class="itemtitle itemname">size</a></span>
- <span class="itemtitle light">(text)</span></h3>
- <div>
- <p>Determine the width and height of the given text if rendered
- with this Font.</p>
- </div>
- <div>
- <h4>Parameters</h4>
- <table>
- <tr>
- <td>String</td>
- <td class="paramname">text</td>
- <td>the text to measure</td>
- </tr>
- </table>
- </div>
- <div>
- <h4>Returns</h4>
- <table>
- <tr>
- <td>Array</td>
- <td> the [width, height] of the text if rendered with this Font</td>
- </tr>
- </table>
- </div>
- </div>
- <hr/>
- </div>
- </div>
- </div>
- </div>
- <div class="menu" style="margin-top: 1em; font-size: 13px;">
- GameJs API<br/>
- <a href="../../index.html">Module list</a>
- <a href="../../index_all.html">Full index</a><br/>
- <input id="jsdoc-leftnavsearch" type="search" placeholder="Filter module list" size="14">
- <ul class="jsdoc-leftnav leftnav">
- <li><a href="../../gamejs/index.html"> gamejs </a></li>
- <li><a href="../../gamejs/display/index.html"> gamejs/display </a></li>
- <li><a href="../../gamejs/draw/index.html"> gamejs/draw </a></li>
- <li><a href="../../gamejs/event/index.html"> gamejs/event </a></li>
- <li><a href="../../gamejs/font/index.html"> gamejs/font </a></li>
- <li><a href="../../gamejs/http/index.html"> gamejs/http </a></li>
- <li><a href="../../gamejs/image/index.html"> gamejs/image </a></li>
- <li><a href="../../gamejs/mask/index.html"> gamejs/mask </a></li>
- <li><a href="../../gamejs/mixer/index.html"> gamejs/mixer </a></li>
- <li><a href="../../gamejs/sprite/index.html"> gamejs/sprite </a></li>
- <li><a href="../../gamejs/surfacearray/index.html"> gamejs/surfacearray </a></li>
- <li><a href="../../gamejs/time/index.html"> gamejs/time </a></li>
- <li><a href="../../gamejs/transform/index.html"> gamejs/transform </a></li>
- <li><a href="../../gamejs/pathfinding/astar/index.html"> gamejs/pathfinding/astar </a></li>
- <li><a href="../../gamejs/utils/arrays/index.html"> gamejs/utils/arrays </a></li>
- <li><a href="../../gamejs/utils/binaryheap/index.html"> gamejs/utils/binaryheap </a></li>
- <li><a href="../../gamejs/utils/math/index.html"> gamejs/utils/math </a></li>
- <li><a href="../../gamejs/utils/matrix/index.html"> gamejs/utils/matrix </a></li>
- <li><a href="../../gamejs/utils/objects/index.html"> gamejs/utils/objects </a></li>
- <li><a href="../../gamejs/utils/vectors/index.html"> gamejs/utils/vectors </a></li>
- </ul>
- </div>
- </div>
- </body>
- </html>