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

Issue building Varta VF #648

Closed
m4rc1e opened this issue Apr 15, 2020 · 4 comments
Closed

Issue building Varta VF #648

m4rc1e opened this issue Apr 15, 2020 · 4 comments

Comments

@m4rc1e
Copy link
Contributor

m4rc1e commented Apr 15, 2020

Just tried to build Varta.glyphs.zip and got the following traceback:

INFO:ufo2ft:Building OpenType tables for Varta-Light
fontmake: Error: In 'Varta.glyphs' -> 'master_ufo/Varta.designspace': Generating fonts from Designspace failed: 'NoneType' object has no attribute 'getAlternateGlyphs'

The VF will generate if I delete the 'aalt' OT feature in the .glyphs file.

cc @vv-monsalve

@vv-monsalve
Copy link

It was the original error. I already disabled the aalt feature under your suggestion and it worked to generate the font files but, the new Issue now is that by doing so Devanagari OT stopped from working.

Observed behaviour

We disabled the aalt feature and were able to generate the fonts with Fontmake but, now Matras of Devanagari don't work anymore.
The Devanagari OT of the font was reviewed by Rob and Kimya from Mota Italic so no errors or conflicts were expected on this.
Replicating the performed changes done after Mota's file to catch where could be the issue and generating the fonts again, we've found that when the fonts are created directly from Glyphs app (even with the aalt feature disabled) the Devanagari still works, while on fonts generated from Fontmake it does not.

Expected behaviour

For Devanagari to work correctly on both static and variable fonts generated from Fontmake.

Resources and exact process needed to replicate

Here are images of comparisons between Glyphs and Fontmake fonts.
New source and font files after replicating the changes are on QA-VartaST2

@anthrotype
Copy link
Member

@m4rc1e please use --verbose DEBUG fontmake option to show the full traceback of the error. This helps tracing the line where the exception occurs. This may be a bug in fonttools feaLib, or a typo or something in the features.fea that feaLib doesn't handle properly.

@anthrotype
Copy link
Member

the AttributeError is raised from this line in fontTools.feaLib.builder
https://github.com/fonttools/fonttools/blob/014991d71069488c14074c55c4d14194099d1443/Lib/fontTools/feaLib/builder.py#L1314

Adding a check if lookup is not None works around this

diff --git a/Lib/fontTools/feaLib/builder.py b/Lib/fontTools/feaLib/builder.py
index 6e654374..51d57c79 100644
--- a/Lib/fontTools/feaLib/builder.py
+++ b/Lib/fontTools/feaLib/builder.py
@@ -1311,9 +1311,10 @@ class ChainContextSubstBuilder(LookupBuilder):
             if lookups == self.SUBTABLE_BREAK_:
                 continue
             for lookup in lookups:
-                alts = lookup.getAlternateGlyphs()
-                for glyph, replacements in alts.items():
-                    result.setdefault(glyph, set()).update(replacements)
+                if lookup is not None:
+                    alts = lookup.getAlternateGlyphs()
+                    for glyph, replacements in alts.items():
+                        result.setdefault(glyph, set()).update(replacements)
         return result

     def find_chainable_single_subst(self, glyphs):

however I am not sure if it's the correct fix and want to futher investigate why some values in that lookups list end up being None.

A bit further above this, there is a similar check for None-ness:
https://github.com/fonttools/fonttools/blob/014991d71069488c14074c55c4d14194099d1443/Lib/fontTools/feaLib/builder.py#L1300-L1301

@anthrotype
Copy link
Member

I just released fonttools v4.8.1 with the fix https://github.com/fonttools/fonttools/releases/tag/4.8.1

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

No branches or pull requests

3 participants