| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>TextGeometry - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="BufferGeometry.html">BufferGeometry</a> → <a href="ExtrudeGeometry.html">ExtrudeGeometry</a> → </p>
- <h1 translate="no">TextGeometry</h1>
- <section>
- <header>
- <div class="class-description"><p>A class for generating text as a single geometry. It is constructed by providing a string of text, and a set of
- parameters consisting of a loaded font and extrude settings.</p>
- <p>See the <a href="FontLoader.html">FontLoader</a> page for additional details.</p>
- <p><code>TextGeometry</code> uses <a href="http://gero3.github.io/facetype.js/" target="_blank" rel="noopener">typeface.json</a> generated fonts.
- Some existing fonts can be found located in <code>/examples/fonts</code>.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const loader = new FontLoader();
- const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' );
- const geometry = new TextGeometry( 'Hello three.js!', {
- font: font,
- size: 80,
- depth: 5,
- curveSegments: 12
- } );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">TextGeometry</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { TextGeometry } from 'three/addons/geometries/TextGeometry.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="TextGeometry" translate="no">new <a href="#TextGeometry">TextGeometry</a><span class="signature">( text : <span class="param-type">string</span>, parameters : <span class="param-type"><a href="TextGeometry.html#~Options">TextGeometry~Options</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new text geometry.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>text</strong>
- </td>
- <td class="description last">
- <p>The text that should be transformed into a geometry.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>parameters</strong>
- </td>
- <td class="description last">
- <p>The text settings.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Type Definitions</h2>
- <div class="member">
- <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
- <div class="description">
- <p>Represents the <code>options</code> type of the geometry's constructor.</p>
- </div>
- <table class="props">
- <tbody>
- <tr>
- <td class="name">
- <strong>font</strong>
- <br>
- <span class="param-type"><a href="Font.html">Font</a></span>
- </td>
- <td class="description last">
- <p>The font.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>size</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>The text size.</p>
- <p>Default is <code>100</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depth</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>Depth to extrude the shape.</p>
- <p>Default is <code>50</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>curveSegments</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>Number of points on the curves.</p>
- <p>Default is <code>12</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>steps</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>Number of points used for subdividing segments along the depth of the extruded spline.</p>
- <p>Default is <code>1</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bevelEnabled</strong>
- <br>
- <span class="param-type">boolean</span>
- </td>
- <td class="description last">
- <p>Whether to beveling to the shape or not.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bevelThickness</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>How deep into the original shape the bevel goes.</p>
- <p>Default is <code>10</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bevelSize</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>Distance from the shape outline that the bevel extends.</p>
- <p>Default is <code>8</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bevelOffset</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>Distance from the shape outline that the bevel starts.</p>
- <p>Default is <code>0</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bevelSegments</strong>
- <br>
- <span class="param-type">number</span>
- </td>
- <td class="description last">
- <p>Number of bevel layers.</p>
- <p>Default is <code>3</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>direction</strong>
- <br>
- <span class="param-type">string</span>
- </td>
- <td class="description last">
- <p>Char direction: ltr(left to right), rtl(right to left) & tb(top bottom).</p>
- <p>Default is <code>'ltr'</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>extrudePath</strong>
- <br>
- <span class="param-type"><a href="Curve.html">Curve</a></span>
- </td>
- <td class="description last">
- <p>A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>UVGenerator</strong>
- <br>
- <span class="param-type">Object</span>
- </td>
- <td class="description last">
- <p>An object that provides UV generator functions for custom UV generation.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/TextGeometry.js" translate="no" target="_blank" rel="noopener">examples/jsm/geometries/TextGeometry.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|