-
-
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
Add a build step to generate extended metrics that additionally contain glyph widths #366
Conversation
Imo #251 doesn't need widths since it can measure them on the fly. But there are applications where having a width would be great. One thing that comes to my mind would be big horizontal constructs, like underbraces. Horizontal boxes with various amounts of stretchable glue distributed over them would be another. Automatic wrapping of equations comes to mind as well, even though TeX doesn't do that. And of course there is always output to other formats with no interactive font measurement facilities, like SVG. What has me somewhat worried is the fact that different typesetting engines might make different choices with respect to kerning and so on, and over longer stretches of glyphs, these might amount to considerable errors. So mixing automatic and manual horizontal positioning is perhaps a bad idea. And doing it all manually would mean not only having all the widths, but all the kerning pairs as well, wouldn't it? |
I was thinking it might improve the performance if you don't have to measure the width; sounds like that isn't a concern. With respect to differences in kerning pairs, I was thinking of absolutely positioning everything. Not sure if that's a good idea or not. |
italic: metrics[2], | ||
skew: metrics[3], | ||
width: metrics[4] | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just always return width, with the caveat that without the extended metrics it will be undefined
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
This LGTM! Remember to squash before pushing though :) |
4a6c088
to
ab1cbe4
Compare
…in glyph widths Summary: The ability to use pre-determined character widths will benefit alternative layout engines such as gagern's canvas layout engine. I would also like to experiment would using CSS transforms to absolutely position each glyph. This diff adds a new make rule, make extended_metrics, which generates metrics that also containing glyph widths. Test Plan: - run `make extended_metrics` - verify that fontMetricsData.js contains entries with 5 numbers instead of 4 Reviewers: emily alpert
ab1cbe4
to
1573e1e
Compare
Add a build step to generate extended metrics that additionally contain glyph widths
The ability to use pre-determined character widths will benefit alternative layout engines such as gagern's canvas layout engine. I would also like to experiment would using CSS transforms to absolutely position each glyph. This diff adds a new make rule, make extended_metrics, which generates metrics that also containing glyph widths.