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

use units_per_em to scale CFF font matrix #32

Merged
merged 1 commit into from Jan 16, 2023

Conversation

danielronnkvist
Copy link
Contributor

@danielronnkvist danielronnkvist commented Dec 16, 2022

Encountered a couple of fonts that were using CFF to generate paths, but their settings was a bit unusual by having the em size set to 2000. That resulted in swash rendering the fonts in half their real size. By scaling the font_matrix using the font's units_per_em instead they where rendered correctly.

I'm a bit uncertain if I should pass the metrics along the functions to where it's needed or if it's better to read the units_per_em by parsing the data once again. Any recommendations?

Closes #27

@danielronnkvist
Copy link
Contributor Author

@dfrg could you review this when you have time?

@dfrg
Copy link
Owner

dfrg commented Jan 14, 2023

Yes, sorry for the delay. At a glance, I do think the CFF table should just read upem again rather than feeding the full metrics struct through. If you make that change, I’ll go ahead and merge.

create CFF glyphs based on units_per_em

parse font head for upem in cff from_font

Defaults to 1000 if head is None.
@danielronnkvist
Copy link
Contributor Author

@dfrg I've made an update now where the CFF table reads upem again and removed the passing of metrics.

@dfrg
Copy link
Owner

dfrg commented Jan 16, 2023

This looks great. Thank you for the fix!

@dfrg dfrg merged commit af0c735 into dfrg:master Jan 16, 2023
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.

Some fonts are rasterised very small
2 participants