EventDispatcherBufferGeometryExtrudeGeometry

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 extrude settings.

See the FontLoader page for additional details.

TextGeometry uses typeface.json generated fonts. Some existing fonts can be found located in /examples/fonts.

Code Example

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
} );

Import

TextGeometry is an addon, and must be imported explicitly, see Installation#Addons.

import { TextGeometry } from 'three/addons/geometries/TextGeometry.js';

Constructor

new TextGeometry( text : string, parameters : TextGeometry~Options )

Constructs a new text geometry.

text

The text that should be transformed into a geometry.

parameters

The text settings.

Type Definitions

.Options

Represents the options type of the geometry's constructor.

Properties:
Name Type Attributes Default Description
font Font <optional>

The font.

size number <optional>
100

The text size.

depth number <optional>
50

Depth to extrude the shape.

curveSegments number <optional>
12

Number of points on the curves.

steps number <optional>
1

Number of points used for subdividing segments along the depth of the extruded spline.

bevelEnabled boolean <optional>
false

Whether to beveling to the shape or not.

bevelThickness number <optional>
10

How deep into the original shape the bevel goes.

bevelSize number <optional>
8

Distance from the shape outline that the bevel extends.

bevelOffset number <optional>
0

Distance from the shape outline that the bevel starts.

bevelSegments number <optional>
3

Number of bevel layers.

direction string <optional>
'ltr'

Char direction: ltr(left to right), rtl(right to left) & tb(top bottom).

extrudePath Curve <optional>
<nullable>
null

A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.

UVGenerator Object <optional>

An object that provides UV generator functions for custom UV generation.

Source

examples/jsm/geometries/TextGeometry.js