googlefonts / pyfontaine

Python tool to check font files for language/character set support
https://github.com/googlefonts/pyfontaine
GNU General Public License v3.0
104 stars 20 forks source link

--wiki is failing when no glyphs are found in charset #98

Open kontur opened 7 years ago

kontur commented 7 years ago

Installed the library fresh, then updated the data as per the README. Other output formats work fine, but --wiki throws an error. The error message when running $ pyfontaine --wiki myfont.otf:

| [[ Extensis Yup'ik + Cyrillic ]] (15/316)  || style='text-align:right'  | {{bartable|4|%|2||background:green}}
Traceback (most recent call last):
  File "/usr/local/bin/pyfontaine", line 448, in <module>
    main()
  File "/usr/local/bin/pyfontaine", line 254, in main
    Builder.wiki(fonts)
  File "/usr/local/lib/python2.7/site-packages/fontaine/builder.py", line 371, in wiki
    glyphs = subset.glyphs
AttributeError: 'Charset' object has no attribute 'glyphs'

Wrapping the call (and the consequent output which references glyphs) on https://github.com/davelab6/pyfontaine/blob/master/fontaine/builder.py#L371 with if hasattr(subset, 'glyphs'): resolves the issue, but I'm not familiar with the wiki table output, so maybe more is needed (to make up for the missing cells when no glyphs are found?).

Also I couldn't tell if this is a problem with the Yuk'ik data specifically, or my test font, or the library. Just using this for the first time :)