Uncaught TypeError: font.generateShapes is not a function
See original GitHub issueUncaught 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:
- Created 2 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
Migration guide info can be found here:
https://github.com/mrdoob/three.js/wiki/Migration-Guide#132--133
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.