You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't see anything in the documentation about loading a font via data-url, so my guess is that this isn't supported, but I would like to confirm that.
If that is true, is there a suggestion for how I could convert text to a path when I only have the data-url of a font?
If data-urls can be used, could the Readme include an example for how to use it?
The text was updated successfully, but these errors were encountered:
They can be used, at least for a browser environment. I use it like this (based on README snippet):
// First argument is URL on web browsers, but it is file path on Node.js.TextToSVG.load('data:application/font-ttf;base64,SGVsbG8sIFdvcmxkIQ==',function(err,textToSVG){constsvg=textToSVG.getSVG('hello');console.log(svg);});
According to what I read around, only TTF works. Also, if you're on Node, you can use this, but you need to do some hacking:
Locate your project's node_modules folder;
Locate the opentype.js folder;
Open opentype.js/src/opentype.js;
Locate this part of the code: function load(url, callback);
Change const loadFn to always be loadFromUrl;
Save;
Have a terminal in the opentype.js folder and run npm i then npm run build;
If you had used npm start, stop it and run it again.
I don't see anything in the documentation about loading a font via data-url, so my guess is that this isn't supported, but I would like to confirm that.
If that is true, is there a suggestion for how I could convert text to a path when I only have the data-url of a font?
If data-urls can be used, could the Readme include an example for how to use it?
The text was updated successfully, but these errors were encountered: