photopea / Typr.js

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

"newline" character support for Typr Path #27

Closed vinaydotblog closed 5 years ago

vinaydotblog commented 5 years ago

Is there any way to add support for "newline" characters. So that glyphs after "↵" (newline) gets Typr path as if it's in a new line. Can you point me to the function which can be modified to support this.

Basically I'm trying to get a SVG path of given text string with newline support.

photopea commented 5 years ago

Hi, and do you want to align your text to the left, to the center, or to the right? And what should be the line height? Do you see where I am going? :)

I recommend you to split your string by newlines: str.split("\n"), compute the path for each part, move parts vertically, and merge them together.