Skip to content
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

Merged
merged 1 commit into from
Oct 16, 2015

Conversation

kevinbarabash
Copy link
Member

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.

@kevinbarabash
Copy link
Member Author

@gagern I was wondering what your thoughts were about this pull request with respect to #251.

@gagern
Copy link
Collaborator

gagern commented Oct 12, 2015

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?

@kevinbarabash
Copy link
Member Author

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]
};
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@xymostech
Copy link
Contributor

This LGTM! Remember to squash before pushing though :)

…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
kevinbarabash added a commit that referenced this pull request Oct 16, 2015
Add a build step to generate extended metrics that additionally contain glyph widths
@kevinbarabash kevinbarabash merged commit d87ee4f into master Oct 16, 2015
@kevinbarabash kevinbarabash deleted the add_width_to_font_metrics branch October 16, 2015 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants