TextGeometry - Verge3D User Manual - Soft8Soft
Description: Learn how to use TextGeometry in your interactive 3D apps made with Verge3D

BufferGeometry → ExtrudeGeometry →

# TextGeometry

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 settings for the geometry's ancestor class ExtrudeGeometry. See the Font and TTFLoader pages for additional details.

## Code Example

`v3d.loadModule('opentype.js', () => { const loader = new v3d.TTFLoader(); loader.load('my_font.woff', function(fontInfo) { const geometry = new v3d.TextGeometry('Hello Verge3D!', { font: new v3d.Font(fontInfo), size: 1, height: 0.1, curveSegments: 12, bevelEnabled: true, bevelThickness: 0.1, bevelSize: 0.1, bevelOffset: 0, bevelSegments: 5 }); const material = v3d.MaterialUtils.createDiffuseMaterial('MyMaterial', new v3d.Color('red'), 1); const mesh = new v3d.Mesh(geometry, material); app.scene.add(mesh); }); });`

## Constructor

### TextGeometry(text : String, parameters : Object)

- text — the text that needs to be shown.
- parameters — object that can contains the following parameters:

- font — an instance of Font.
- size — size of the text. Default is `100`.
- height — thickness to extrude text. Default is `50`.
- curveSegments — number of points on the curves. Default is `12`.
- bevelEnabled — turn on bevel. Default is `false`.
- bevelThickness — how deep into text bevel goes. Default is `10`.
- bevelSize — how far from text outline is bevel. Default is `8`.
- bevelOffset — how far from text outline bevel starts. Default is `0`.
- bevelSegments — number of bevel segments. Default is `3`.

Procedural geometry is fun. However, in real life applications this feature is rarely needed. It would be more efficient do design text in the preferred modelling suite and export/load to Verge3D via glTF.

## Properties

See the base ExtrudeGeometry class for inherited properties.

### # .parameters : Object

An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.

## Methods

See the base ExtrudeGeometry class for inherited methods.

## See Also

Check out the Text Rendering section in the manual for more info on creating text objects in Verge3D.

## Source

For more info on how to obtain the source code of this module see this page.