-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to add Kerning and Line Height to context.fillText() #1404
Comments
Not that i know of. |
Re: Kerning, see #1014 and feel free to add your thoughts. Re: Line-height: since there is no text wrapping in HTML canvas, I'm not sure this is applicable, is it? |
In #1014 it sounds like we aren't going to add letter-spacing. There's some hacky solutions on SO but technically you'd need something like fontkit instead of Implementing line height isn't difficult but first you have to do line breaking. First you mark which characters can be broken to the next line, then measure the rendered-size (like with When you have your lines determined, use line-height to determine the leading. CSS uses the formula |
I think linebreak should be another library implementation or an application implementation. Canvas does not have lineHeight or lineBreak, and shouldn't be implemented here. |
Yeah, I don't think OP was suggesting that since it was marked as |
I have a plugin for Sketch App which I use to extract the data from sketch file and convert to JPEG using node-canvas with certain modifiable fields.
Templates (Sketch File) use Kerning (Character Spacing) and Line Height because of which modifiable fields don't replicate the accurate style when compared with templates.
Is there a way to add Kerning and Line Height to
context
object so that the template can be accurately mirrored with its derivative JPEG?The text was updated successfully, but these errors were encountered: