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

[empty_letters] failing with error "TypeError: object of type 'NoneType' has no len()" #4850

Open
arrowtype opened this issue Oct 4, 2024 · 3 comments
Assignees
Milestone

Comments

@arrowtype
Copy link
Contributor

Observed behaviour

I’m running FontBakery from a checks profile, which includes Adobe Fonts checks.

One of the checks is giving me an error, and I’m not sure why, or if it’s only happening on my particular environment. But, it’s happened in two separate projects, in separate venvs, with separate, fresh installations of fontbakery, so it may be a genuine issue. (Or if not, I’d be very grateful to be pointed in the right direction!)

 >> com.adobe.fonts/check/find_empty_letters
    Letters in font have glyphs that are not empty?
    with familyname.otf

    Rationale:                                                                
                                                                                                                                                                                                                                                                                                                                                                  
    Font language, script, and character set tagging approaches typically have an underlying assumption that letters (i.e. characters with Unicode general category 'Ll', 'Lm', 'Lo', 'Lt', or 'Lu', which includes CJK ideographs and Hangul syllables) with entries in the 'cmap' table have glyphs with ink (with a few exceptions, notably the four Hangul    
    "filler" characters: U+115F, U+1160, U+3164, U+FFA0).                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                                  
    This check is intended to identify fonts in which such letters have been mapped to empty glyphs (typically done as a form of subsetting). Letters with empty glyphs should have their entries removed from the 'cmap' table, even if the empty glyphs are left in place (e.g. for CID consistency).                                                           
                                                                                                                                                                                                                                                                                                                                                                  
    The check will yield only a WARN if the blank glyph maps to a character in the range of Korean hangul syllable code-points, which are known to be used by font designers as a workaround to undesired behavior from InDesign's Korean IME (Input Method Editor). More details available at https://github.com/fonttools/fontbakery/issues/2894                
                                                                                                                                                                                                                                                                                                                                                                  
    More info: https://github.com/fonttools/fontbakery/pull/2460

    ERROR Failed with TypeError: object of type 'NoneType' has no len()                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                  
            File "/Users/stephennixon/type-repos/projectname/familyname/venv/lib/python3.11/site-packages/fontbakery/checkrunner.py", line 213, in _run_check                                                                                                                                                                          
              subresults = list(subresults)                                                                                                                                                                                                                                                                                                                       
                           ^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                       
            File "/Users/stephennixon/type-repos/projectname/familyname/venv/lib/python3.11/site-packages/fontbakery/checks/adobefonts.py", line 108, in com_adobe_fonts_check_find_empty_letters                                                                                                                                      
              glyph_is_empty = _quick_and_dirty_glyph_is_empty(ttFont, glyph_name)                                                                                                                                                                                                                                                                                
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                
            File "/Users/stephennixon/type-repos/projectname/familyname/venv/lib/python3.11/site-packages/fontbakery/checks/adobefonts.py", line 56, in _quick_and_dirty_glyph_is_empty                                                                                                                                                
              if len(char_string.bytecode) <= 1:                                                                                                                                                                                                                                                                                                                  
                 ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                  
          ``` [code: failed-check]                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                  

    Result: ERROR

Expected behaviour

I expect the check to run and tell me about empty glyphs.

Resources and steps needed to reproduce

  • Fontbakery version: 0.12.10
  • Python 3.11.3
  • macOS Sonoma (14.3.1 (23D60))

I can’t provide the fonts publicly, but I could share them directly, if it’s necessary to debug this.

Please let me know if any further details would be helpful here.

Thanks!

@felipesanches felipesanches self-assigned this Oct 15, 2024
@felipesanches felipesanches added this to the 0.13.0 milestone Oct 15, 2024
@felipesanches
Copy link
Collaborator

The code that is causing this error is only reachable when checking CFF/OTF fonts.

I've tested it with data/test/rokkitt/Rokkitt-*.otf and it worked fine for both the latest git main branch as well as for the tagged v0.12.10 release.

@arrowtype in order to reproduce this I'll need access to a few sample files.

@felipesanches felipesanches changed the title [com.adobe.fonts/check/find_empty_letters] failing with error "TypeError: object of type 'NoneType' has no len()" [empty_letters] failing with error "TypeError: object of type 'NoneType' has no len()" Oct 21, 2024
@felipesanches felipesanches modified the milestones: 0.13.0, 0.13.1 Oct 21, 2024
@arrowtype
Copy link
Contributor Author

Hi @felipesanches, so sorry for my delay in responding here. I’ve emailed you one of the fonts in question, as it is a non-public font. I’m pretty perplexed on this – thanks for any pointers on it!

@felipesanches
Copy link
Collaborator

thanks, I'll take a look at the files and see if I can figure this out

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

2 participants