googlefonts / googlefonts/glyphsLib
'com.github.googlei18n.ufo2ft.filters' are not converted back to Glyphs filters custom parameters
- Dominant language
- Python
- Stars
- 202
- Forks
- 57
- Avg merge
- 17m
- Merged PRs (30d)
- 1
Description
I think I knew this but had forgotten. I just stumbled on Rubik.glyphs where the GSMaster have userData containing raw "'com.github.googlei18n.ufo2ft.filters" keys:
https://github.com/googlefonts/rubik/blob/e337a5f69a9bea30e58d05bd40184d79cc099628/sources/Rubik.glyphs#L1746-L1754
since userData is passed through unchanged into the UFO lib, fontmake (ufo2ft) happily applies the filters whereas fontc doesn't know that it may have to look at the userData for ufo2ft-specific lib keys, only looks at the Glyphs native customParameters, so it will not e.g. flatten the composite glyphs when building Rubik.glyphs
I see that the `FilterParamHandler` class only has `to_ufo` but doesn't have a corresponding `to_glyphs` which would convert those lib elements into equivalent Glyphs filter custom parameter definitions:
https://github.com/googlefonts/glyphsLib/blob/52c982399ba20dc96a2c2195df6fc6cea1f9a906/Lib/glyphsLib/builder/custom_params.py#L941-L949
We also have a `write_glyphs_filter` function in https://github.com/googlefonts/glyphsLib/blob/52c982399ba20dc96a2c2195df6fc6cea1f9a906/Lib/glyphsLib/builder/filters.py#L78
which doesn't seem to be used anywhere.
I wonder if @belluzj or @madig remember why it was done this way and the ufo->glyphs path was never implemented for filters?
Contributor guide
Research direction
Start in Lib/glyphsLib/builder/custom_params.py at FilterParamHandler and compare its to_ufo handling with the write_glyphs_filter function in Lib/glyphsLib/builder/filters.py. Trace how UFO lib entries become Glyphs custom parameters, then verify that the cited com.github.googlei18n.ufo2ft.filters data from Rubik.glyphs is converted so fontc applies the same filters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100