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

FontMake AssertionError: 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F #140

Closed
5 of 6 tasks
thundernixon opened this issue Aug 12, 2019 · 9 comments

Comments

@thundernixon
Copy link
Collaborator

thundernixon commented Aug 12, 2019

In trying to build a Recursive Sans variable font, I'm running into the following issues:

AssertionError: (('dotaccentcomb', ('cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb')), 'str', '[0]', 'list', '.glyphs', 'Coverage', '[0]', 'list', '.Coverage', 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F_')

I got past this first issue after I:

  • found that the dotaccentcomb accent was dotaccentcmb (missing an o) in some fonts, and named them all the same
  • found that dotaccentcomb and cedillacomb didn't have unicodes in all fonts, and gave them the correct unicodes
  • made sure that fonts were sorted in the same way (not sure if this had an effect)
AssertionError: (('dotbelowcomb', ('cedillacomb', 'dotbelowcomb', 'cedillacomb', 'dotbelowcomb', 'cedillacomb', 'dotbelowcomb', 'cedillacomb', 'dotbelowcomb', 'cedillacomb', 'dotbelowcomb', 'cedillacomb', 'dotbelowcomb')), 'str', '[1]', 'list', '.glyphs', 'Coverage', '[0]', 'list', '.Coverage', 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F_')

I have now:

  • found that the dotbelowcomb was missing unicodes in the slanted fonts, so I added them
  • the dotbelowcomb naming seemed consistent
  • search through glyphs for accents related to dotbelow and cedilla, to see whether there is some mismatch
@thundernixon
Copy link
Collaborator Author

thundernixon commented Aug 12, 2019

Got a new error!

AssertionError: (('commaaccentcomb', ('cedillacomb', 'commaaccentcomb', 'cedillacomb', 'commaaccentcomb', 'cedillacomb', 'commaaccentcomb', 'cedillacomb', 'commaaccentcomb', 'cedillacomb', 'commaaccentcomb', 'cedillacomb', 'commaaccentcomb')), 'str', '[2]', 'list', '.glyphs', 'Coverage', '[0]', 'list', '.Coverage', 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F_')

Cleaning these out of the main fonts, though they are only warnings:

duplicate anchor 'top' in glyph 'Y'
duplicate anchor 'top' in glyph 'z'
duplicate anchor 'top' in glyph 'Y'
duplicate anchor 'top' in glyph 'z.italic'

@thundernixon
Copy link
Collaborator Author

thundernixon commented Aug 12, 2019

New-ish error:

AssertionError: ((1, [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]), 'int', '.Format', 'Coverage', '[0]', 'list', '.Coverage', 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F_')

In a similar GPOS error, this style of list means that there are different amounts of GPOS features in a font. So, this probably means that some fonts have more GDEF features than others.

A Mark Glyph Sets table is used to define sets of mark glyphs that can be used in lookup tables within the GSUB or GPOS table to control how mark glyphs within a glyph sequence are treated by lookups. For more information on the use of mark glyph sets, see the description of lookup flags in the “Lookup Table” section of the chapter, OpenType Layout Common Table Formats.

https://docs.microsoft.com/en-us/typography/opentype/spec/gdef

...so, maybe I need to re-check whether all glyphs have the same components?

It doesn't seem like there are any glyphs with some components vs others with outlined contours.

It seems that the error list is pointing to upright vs italic fonts (or possibly linear vs casual, but that seems less likely because that wouldn't be alphabetically sorted). What is different between these?

Time for the nuclear option:

  • remove (almost) all glyphs that have more than one component.
  • just decompose all glyphs. (nope)
    • and remove all anchors 😭this finally made it work. WHYY. Maybe the duplicate anchors really did mess with things?

@thundernixon
Copy link
Collaborator Author

thundernixon commented Aug 19, 2019

I am now trying to build the overall mono+sans variable font.

I was able to pass a similar first error by adding unicodes to a lot of blank fields in the Sans.

AssertionError: (('dotaccentcomb', ('dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'cedillacomb', 'dotaccentcomb', 'dotaccentcomb', 'dotaccentcomb')), 'str', '[0]', 'list', '.glyphs', 'Coverage', '[0]', 'list', '.Coverage', 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F_')

Now, however, I am running into a new error.

AssertionError: ('MarkBasePos', '[0]', 'Lookup', '[0]', 'list', '.Lookup', 'LookupList', '.LookupList', 'GPOS', '.table', 'table_G_P_O_S_')

This may be due to the /L having a slash anchor in only Mono Casual B. Removing that in the VarFontPrep version to see whether that makes a difference.

Not quite. But actually, the fuller context may be helpful:

File "/Users/stephennixon/type-repos/fonttools/Lib/fontTools/varLib/merger.py", line 544, in _MarkBasePosFormat1_merge
    [getattr(l, Mark+'Array').MarkRecord for l in lst])
  File "/Users/stephennixon/type-repos/fonttools/Lib/fontTools/varLib/merger.py", line 168, in _merge_GlyphOrders
    assert all(sorted(vs, key=sortKey) == vs for vs in lst)
AssertionError: ('MarkBasePos', '[0]', 'Lookup', '[0]', 'list', '.Lookup', 'LookupList', '.LookupList', 'GPOS', '.table', 'table_G_P_O_S_')

...things are failing in _merge_GlyphOrders. I should sort fonts the same.

🎉🎉🎉🎉 fuuuuuck yes, I got it to build! 🎉🎉🎉🎉

@weiweihuanghuang
Copy link

weiweihuanghuang commented Nov 30, 2019

Hey I'm having what looks like the same issue as yours from #140 (comment)
Do I have to remove all anchors?... won't that break the mkmk feature... ?

AssertionError: ((3, [3, 3, 3, 3, 1, 1, 1, 1]), 'list', '.Coverage', 'MarkGlyphSetsDef', '.MarkGlyphSetsDef', 'GDEF', '.table', 'table_G_D_E_F_')

This error only appears when I have sparse masters in my designspace...

@arrowtype
Copy link
Owner

Hey!

Are you working in a UFO / RoboFont-based project?

If so, try to check consistency of anchors and unicodes with the scripts in here:

https://github.com/arrowtype/recursive/tree/master/src/00-recursive-scripts-for-robofont/checking-similarity-between-fonts

Also, try the Designsapce Editor extension. It will tell you things that you may need to clean up to make things compatible.

@arrowtype
Copy link
Owner

Oh, and also sort all UFOs the same.

@weiweihuanghuang
Copy link

weiweihuanghuang commented Nov 30, 2019

Designspace Editor doesn't show any problems (only that there's missing kerning). I'm fairly certain all the anchors are consistent... but I'll try the scripts too.

How does glyph sorting consistency work... when you have sparse masters?

Made an issue googlefonts/fontmake#607

@arrowtype
Copy link
Owner

arrowtype commented Feb 27, 2022

Not sure whether this is a related issue, but it might be...

Another font build is now failing on this:

INFO:fontTools.varLib:Merging OpenType Layout tables
fontmake: Error: In 'sources/wght_BNCE_IRGL--prepped/shantell_sans-wght_BNCE_IRGL.designspace': Generating fonts from Designspace failed: 

Couldn't merge the fonts, because a list of objects had inconsistent lengths.
This happened while performing the following operation:
GDEF.table.MarkGlyphSetsDef.Coverage

The problem is likely to be in Shantell Sans Irregular Light Regular:
Expected to see .Coverage==2, instead saw 1

My guess is that it may again be missing or inconsistent Unicodes.

UPDATE:

I did need to add a bunch of missing Unicodes, but that didn’t solve the build issue.

@arrowtype
Copy link
Owner

arrowtype commented Feb 27, 2022

Ahhh, it seems to maybe be a case of mismatched anchors between sources. Will try this and update.

That was it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants