arthurcloche / p5.variableFont

Attempting to bring variable fonts to p5.js
36 stars 0 forks source link

Using textToPoints with the font loading from Google Font #1

Open antlii opened 7 months ago

antlii commented 7 months ago

Thanks for the fantastic addition! I just wondering, is it possible to load the Google Font from the link (not a static) as the font object, to use it with the textToPoints function?

arthurcloche commented 7 months ago

Hey ! So it is currently impossible because you need a font file to load the points using textToPoints. It uses opentype.js under the hood to convert the font file to a SVG path and then splitting it.

There is probably a way to get the font file from the google font query, the CSS always needs the font file to render fonts on screen so i don't actually know a solution for that but this could be possible !

antlii commented 7 months ago

Yeah, that's what I thought, but thanks for confirming it! I don't know if you've seen, but I found an interesting discussion about the issue, and maybe this feature will be implemented in future versions of opentype.js https://github.com/opentypejs/opentype.js/issues/62