photopea / Typr.js

Typr.js - process fonts in Javascript
MIT License
914 stars 73 forks source link

Generated fonts are of different sizes #22

Closed vinaydotblog closed 5 years ago

vinaydotblog commented 5 years ago

I ran all my font collection through Typr.js to generate path of given font and text. Generated path are of different different sizes. As show in the screenshot below.

image 1 On left i have plain text and on right side an SVG element with tag in it.

Can suggest any way to bring consistency to the generated path ? So that all spits out similar sizes paths. Thanks in advance. :)

photopea commented 5 years ago

Hey! How exactly did you generate the vector paths?

When you call Typr.U.glyphsToPath(), it returns the path with integer coordinates, you have to scale them down. Did you take the font.head.unitsPerEm property into account?

vinaydotblog commented 5 years ago

Thanks for the quick reply. I did not consider unitsPerEm, it got fixed after considering it.