googlefonts / googlefonts/ufo2ft

add option to change unitsPerEm of compiled font?

Open
#376 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
176
Forks
49
PR merge metrics
No merged PRs in 30d

Description

it turns out one can use ~~fontMath~~ ufo2ft's TransformationsFilter to [change the UPEM of a font](https://gist.github.com/anthrotype/62d0bfe1d38b8f11a199bd3b66574bcc).
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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the linked TransformationsFilter example and then inspect ufo2ft's compile functions to understand where a unitsPerEm option and preProcessor filter would fit. Done means the requested UPEM can be compared with the UFO's current value and the compiled output scaled accordingly, including the unchanged-value case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.