Error opening Uncaught type font while loading TextGeometry font

I try to use the downloaded font typeface.js as provided by the Three.js examples, but I keep getting the following error:

Uncaught TypeError: this.addShapeList is not a function 

I checked the Three.js file, I use the assembly version from the main.js branch to argue the error, and THREE.ExtrudeGeometry scoped this seems to be missing all the prototypes announced earlier.

Changing the code to use THREE.ExtrudeGeometry.addShapeList instead of this.addShapeList failed later on when the THREE.ExtrudeGeometry.prototype.addShape method was THREE.ExtrudeGeometry.prototype.addShape without recognizing the array of vertices in the region.

Of course, I am doing something wrong by creating TextGeometry, but I can not understand what.

This is the code I use to load the font by creating a TextGeometry object and adding it to the scene.

 loader.load('./fonts/gentilis_bold.typeface.js', function(response){ font = response; var text = THREE.TextGeometry('Some Text', { font: font, size: 70 }); scene.add(text); }); 

Here is a fiddle to demonstrate my problem.

+5
source share
1 answer

You forgot about new :

var text = new THREE.TextGeometry('Some Text', {

[ https://jsfiddle.net/kmny9gbc/ ]

+4
source

Source: https://habr.com/ru/post/1247897/


All Articles