| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <!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/">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">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">TextGeometry~Options</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"><code>text</code></td>
- <td class="description last"><p>The text that should be transformed into a geometry.</p></td>
- </tr>
- <tr>
- <td class="name"><code>parameters</code></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>
- <h5 class="subsection-title">Properties:</h5>
- <table class="props">
- <thead>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Attributes</th>
- <th>Default</th>
- <th class="last">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="name"><code>font</code></td>
- <td class="type">
- <span class="param-type"><a href="Font.html">Font</a></span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- </td>
- <td class="description last"><p>The font.</p></td>
- </tr>
- <tr>
- <td class="name"><code>size</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 100
- </td>
- <td class="description last"><p>The text size.</p></td>
- </tr>
- <tr>
- <td class="name"><code>depth</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 50
- </td>
- <td class="description last"><p>Depth to extrude the shape.</p></td>
- </tr>
- <tr>
- <td class="name"><code>curveSegments</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 12
- </td>
- <td class="description last"><p>Number of points on the curves.</p></td>
- </tr>
- <tr>
- <td class="name"><code>steps</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 1
- </td>
- <td class="description last"><p>Number of points used for subdividing segments along the depth of the extruded spline.</p></td>
- </tr>
- <tr>
- <td class="name"><code>bevelEnabled</code></td>
- <td class="type">
- <span class="param-type">boolean</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- false
- </td>
- <td class="description last"><p>Whether to beveling to the shape or not.</p></td>
- </tr>
- <tr>
- <td class="name"><code>bevelThickness</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 10
- </td>
- <td class="description last"><p>How deep into the original shape the bevel goes.</p></td>
- </tr>
- <tr>
- <td class="name"><code>bevelSize</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 8
- </td>
- <td class="description last"><p>Distance from the shape outline that the bevel extends.</p></td>
- </tr>
- <tr>
- <td class="name"><code>bevelOffset</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 0
- </td>
- <td class="description last"><p>Distance from the shape outline that the bevel starts.</p></td>
- </tr>
- <tr>
- <td class="name"><code>bevelSegments</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 3
- </td>
- <td class="description last"><p>Number of bevel layers.</p></td>
- </tr>
- <tr>
- <td class="name"><code>direction</code></td>
- <td class="type">
- <span class="param-type">string</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 'ltr'
- </td>
- <td class="description last"><p>Char direction: ltr(left to right), rtl(right to left) & tb(top bottom).</p></td>
- </tr>
- <tr>
- <td class="name"><code>extrudePath</code></td>
- <td class="type">
- <span class="param-type"><a href="Curve.html">Curve</a></span>
- </td>
- <td class="attributes">
- <optional><br>
- <nullable><br>
- </td>
- <td class="default">
- null
- </td>
- <td class="description last"><p>A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.</p></td>
- </tr>
- <tr>
- <td class="name"><code>UVGenerator</code></td>
- <td class="type">
- <span class="param-type">Object</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- </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" target="_blank" rel="noopener" translate="no">examples/jsm/geometries/TextGeometry.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|