googlefonts / googlefonts/fontmake
Only load the sources relevant for a set of locations
- Dominant language
- Python
- Stars
- 888
- Forks
- 97
- Avg merge
- 4d 52m
- Merged PRs (30d)
- 1
Description
Currently, the entire Designspace is loaded for preparing an Instantiator. If you have a set of locations you know beforehand, it is hopefully faster to just load the sources that participate in their interpolation according to the variation model (plus the default source for some stuff).
The idea is that you could pass a set of locations to the constructor and it will then figure out with the variation model which sources it has to load. If you don't pass in a set, it will just load everything.
Not sure yet how this would work for glyphs that go off the rails and e.g. don't have data in the sources you select from the Designspace surrounding some location, but from e.g. the extreme ends you didn't select. Maybe you'd have to trawl through the glyphs and figure out which source is participating in the interpolation on a case by case basis? E.g. by peeking at the glyphs each UFO contains (`ufo.keys()`). Similarly for the other data. So maybe you still have to lazy load all UFOs, but not all glyphs in all UFOs 🤔
Contributor guide
Research direction
Start at the Instantiator constructor and its Designspace/source-loading path; inspect how the variation model identifies participating sources for supplied locations. Compare behavior with and without locations, including default-source handling and glyph availability through ufo.keys(). Done means relevant sources and data load correctly without changing interpolation results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100