3

I am having some problems with the TextGeometry in Three.js r74..

How do I implement it correctly?

Here is my Codepen:

codepen.io/cheesyeyes/pen/eJqZxK

Thanks in advance!

2

2 Answers 2

17

Okey, for everyone who is looking for simple answers and not links and links to other overloaded examples:

fonts have to be loaded with the three js FontLoader first:

var loader = new THREE.FontLoader();
loader.load( 'fonts/fontname.js', function ( font ) {

  var textGeometry = new THREE.TextGeometry( "text", {

    font: font,

    size: 50,
    height: 10,
    curveSegments: 12,

    bevelThickness: 1,
    bevelSize: 1,
    bevelEnabled: true

  });

  var textMaterial = new THREE.MeshPhongMaterial( 
    { color: 0xff0000, specular: 0xffffff }
  );

  var mesh = new THREE.Mesh( textGeometry, textMaterial );

  scene.add( mesh );

});   
Sign up to request clarification or add additional context in comments.

6 Comments

THREE.FontLoader is not a constructor
I'm getting the "not a constructor" error too, revision 80.
I dont know what happened in rev 80 but in 81 its defenitely part of the core and must not be loaded separately. so it must be there?
FontLoader is a part of the core since r74
is it possible to add letter spacing in textgeometry
|
2

I will also add that you can convert any existing OTF or TTF font to a JSON or JS font via TypeFace.js, this is necessary for the FontLoader to be able to load it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.