Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add option to change unitsPerEm of compiled font? #376

Open
anthrotype opened this issue May 14, 2020 · 4 comments
Open

add option to change unitsPerEm of compiled font? #376

anthrotype opened this issue May 14, 2020 · 4 comments

Comments

@anthrotype
Copy link
Member

anthrotype commented May 14, 2020

it turns out one can use fontMath ufo2ft's TransformationsFilter to change the UPEM of a font.
This could be useful if one wishes to increase (or even decrease) the resolution of the font design units.
E.g. merging one font with another with different unitsPerEm, or designing with a given unitsPerEm but then scale everything up to reduce rounding errors when generating intermediate instances.

I was thinking maybe such thing could become a ufo2ft preProcessor filter. And the compile functions could have an unitsPerEm=None option that, when set, would trigger this filter.

It would compare the requested unitsPerEm with the UFO's current unitsPerEm and scale the output font accordingly to fit the desired UPEM.

Is this too niche or would this be something desirable to have?

@madig
Copy link
Collaborator

madig commented May 15, 2020

@davelab6 didn't you think about increasing upMs for VFs generally for smoother interpolation?

@khaledhosny
Copy link
Collaborator

Such an option will need also to scale GPOS data that are stored in the feature file.

@anthrotype
Copy link
Member Author

you're right. We also need to scale all the numbers expressed in font design units that occur in GPOS value records or anchor statements and others.
Basically search for keyword <metric> in http://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html

@anthrotype
Copy link
Member Author

anthrotype commented May 21, 2020

By the way, fontMath seems to be doing more than just scaling: it's filtering points that it deems unnecessary, converting lines into curves, etc. which means scaled masters are not guaranteed to keep interpolation compatibility. So I changed that scale_ufo.py script of mine to use ufo2ft's TransformationsFilter to scale the glyphs, and multiply the fontinfo and kerning directly without the aid of fontMath.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants