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

fix interaction with skipExportGlyphs and post-build subsetting feature #591

Merged
merged 2 commits into from
Oct 10, 2019

Conversation

anthrotype
Copy link
Member

@anthrotype anthrotype commented Oct 9, 2019

when an instance has "Keep Glyphs" custom parameter, fontmake runs the fonttools subsetter on the OTF just built and prunes all glyphs not present in that list. Since the postscript glyph names in OTF may have been renamed using final production uni-names, fontmake needs to match the original glyph names in UFO and the ones in the OTF by their glyph index.

Now that glyphsLib/ufo2ft support the public.skipExportGlyphs option, and fontmake enables this feature by default (unless --no-write-skipexportglyphs option is passed), this means that the built OTF may contain less glyphs than the original UFO (glyphs in public.skipExportGlyphs are not exported) and so we hit as AssertionError as the two glyphOrder have different lengths.

This fixes the problem by only considering the actually exported glyphs when extracting the glyphOrder from the UFO in the process of subsetting the OTF.

A test is added to make sure we get the same final subsetted glyphOrder, whether --no-write-skipexportglyphs option is used or not.

@anthrotype anthrotype requested a review from madig October 9, 2019 16:17
…yphs' custom param

When UFO has both 'public.skipExportGlyphs' and the 'Keep Glyphs' custom parameter, then the final
glyph order in the built OTF will not include glyphs from skipExportGlyphs.
If we don't prune them when getting the UFO glyphOrder we may hit the assertion later on that
checks that the length of UFO and OTF glyphOrders is the same.
…tglyphs

I marked glyph B in tests/data/TestSubset.glyphs as 'export = 0;'.
The 'Test Subset Regular' instance has a 'Keep Glyphs' custom paramter with: space, A, B and C.
The test asserts that, whether --no-write-skipexportglyphs option is used, the resulting
subsetted glyphOrder does _not_ contain the glyph 'B' (and we don't hit AssertionError
while doing so when skipExportGlyphs list is non-empty)
@anthrotype anthrotype merged commit 59c1dbb into googlefonts:master Oct 10, 2019
@anthrotype anthrotype deleted the skip-export-glyphs-subset branch October 10, 2019 14:19
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.

2 participants