question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: font.generateShapes is not a function

See original GitHub issue

Uncaught TypeError: font.generateShapes is not a function when trying to create a text geometry Following the code leads to const shapes = font.generateShapes( text, parameters.size );

This is my code:

import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'
import font from 'three/examples/fonts/helvetiker_regular.typeface.json'

const textGeometry = new TextGeometry('This is a 3d font', {
    font: font,
})

Notes:

  • The initial code included all other parameters but I removed them to limit the error
  • I am using parcel as my development server
  • I have also used font loader and a different issue popped up saying Uncaught (in promise) SyntaxError: Unexpected token e in JSON at position 0, I commented the origin of the error only to bounce back to this one

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jjwallcommented, Dec 2, 2022

Getting this same error after updating from 0.127.0 to 0.146.0. Is it possible there was an API refactor removing the Font module altogether?

Edit: Found it

image

Migration guide info can be found here:

https://github.com/mrdoob/three.js/wiki/Migration-Guide#132--133

0reactions
genzzocommented, Mar 8, 2022

Kinda weird considering I am using the provided three.js font, and that I used the provided tool on the website for creating JSON fonts. But I guess that makes sense as it didn’t contain the attributes for generating shapes when I logged it in the console.

Thank you either way, I’ll see what I can do about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

three.js fontloader cannot read generateshapes of undefined
FontLoader.load() is an asynchronous function call. This is why there is an onLoad call back function. The library is calling font.generateShapes() before ...
Read more >
Unable to use fontLoader or textGeometry - three.js forum
Uncaught TypeError : font.generateShapes is not a function at new TextGeometry (TextGeometry.js:34:24) at Object.6yeCB.three (index.js:8:22) ...
Read more >
three.Font.generateShapes JavaScript and Node.js ... - Tabnine
This renders text via canvas and projects it as a sprite */ function Text({ children, size = 1, letterSpacing = 0.01, color =...
Read more >
How to Load Fonts in a Three.js Scene - YouTube
In this coding tutorial, we go over how to import fonts into a Three.js scene. We start off by importing the font loader...
Read more >
Addressing a variable with TextPlugin - GSAP - GreenSock
generateShapes (message, 100); const geometry = new THREE. ... inspector throws "gsap.to is not a function" { which was "Uncaught TypeError: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found