photopea / Typr.js

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

letter-spacing #11

Closed ghost closed 7 years ago

ghost commented 7 years ago

Is there a way to add letter-spacing when I'm using Typr.U.stringToPath(font, str) like the letter-spacing in opentype.js?

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing

photopea commented 7 years ago

stringToPath is implemented here: https://github.com/photopea/Typr.js/blob/gh-pages/src/Typr.U.js#L187 . I would suggest adding a new line x+=5; under the line 204.

There are many ways of how users may want to render the text. That is why I haven't added many parameters of text rendering, but expected, that everybody would implement their own rendering functions (it should be realy easy), Typr.U is more like a guide of how to write such functions. Note, that stringToPath uses only standard, documented functions and nothing else.