THREE.FontLoader() parse() does not return a THREE Font object instance

I use my own system getFile() function to retrieve files from our secure app. I fetched the file helvetiker_regular.typeface.json and then parsed it like so:

let loader = new THREE.FontLoader();
let font = loader.parse( jsonFile);

As you can see in my 3 attachments, the parse method returns a generic object, not an instance of a THREE Font object.

When I use loader.load() method it returns an instance of THREE Font object.

Is this a bug?

Alejandro

screen shot 2018-03-22 at 2 28 11 pm
screen shot 2018-03-22 at 2 28 43 pm
screen shot 2018-03-22 at 2 29 30 pm

Author: Fantashit

1 thought on “THREE.FontLoader() parse() does not return a THREE Font object instance

  1. I guess you have to do this:

    const loader = new THREE.FontLoader();
    const json = JSON.parse( jsonFile ); // you have to parse the data so it becomes a JS object 
    const font = loader.parse( json );

    BTW: Even in you “incorrect” result, the result object is an instance of type THREE.Font. You just have a wrong data property.

Comments are closed.