/** * Text = 3D Text * * parameters = { * font: , // font * * size: , // size of the text * height: , // thickness to extrude text * curveSegments: , // number of points on the curves * * bevelEnabled: , // turn on bevel * bevelThickness: , // how deep into text bevel goes * bevelSize: , // how far from text outline (including bevelOffset) is bevel * bevelOffset: // how far from text outline does bevel start * } */ import { BufferGeometry } from '../core/BufferGeometry.js'; import { ExtrudeGeometry } from './ExtrudeGeometry.js'; class TextGeometry extends ExtrudeGeometry { constructor( text, parameters = {} ) { const font = parameters.font; if ( ! ( font && font.isFont ) ) { console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' ); return new BufferGeometry(); } const shapes = font.generateShapes( text, parameters.size ); // translate parameters to ExtrudeGeometry API parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; super( shapes, parameters ); this.type = 'TextGeometry'; } } export { TextGeometry, TextGeometry as TextBufferGeometry };