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

Make hyperglot.py ext safer #126

Open
wants to merge 0 commits into
base: main
Choose a base branch
from
Open

Conversation

twardoch
Copy link

Fixes

$ pyfontaine --csv NotoSerifTamil-Regular.ttf
Traceback (most recent call last):
  File "/Users/adam/Library/Python/3.9/bin/pyfontaine", line 438, in <module>
    main()
  File "/Users/adam/Library/Python/3.9/bin/pyfontaine", line 242, in main
    sys.stdout.write(Builder.csv_(fonts))
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/builder.py", line 320, in csv_
    for subset in _library.charsets:
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/cmap.py", line 48, in charsets
    for charset_klass in module.Extension.get_charsets():
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/ext/hyperglot.py", line 44, in __getcharsets__
    yield Extension.make_locale(key, locale, 0)
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/ext/hyperglot.py", line 34, in make_locale
    dict(glyphs=Extension.to_charset(orthography),
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/ext/hyperglot.py", line 24, in to_charset
    glyphs.extend(orthography.get("numerals", []))
AttributeError: 'str' object has no attribute 'extend'

and

Traceback (most recent call last):
  File "/Users/adam/Library/Python/3.9/bin/pyfontaine", line 438, in <module>
    main()
  File "/Users/adam/Library/Python/3.9/bin/pyfontaine", line 242, in main
    sys.stdout.write(Builder.csv_(fonts))
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/builder.py", line 320, in csv_
    for subset in _library.charsets:
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/cmap.py", line 48, in charsets
    for charset_klass in module.Extension.get_charsets():
  File "/Users/adam/Library/Python/3.9/lib/python/site-packages/fontaine/ext/hyperglot.py", line 49, in __getcharsets__
    for ix in range(0,len(locale["orthographies"])):
KeyError: 'orthographies'

and related fails.

@davelab6
Copy link
Member

@felipesanches PTAL

@felipesanches
Copy link
Member

yep! That's good ;-)

@felipesanches
Copy link
Member

but I think we need to fix this:

Screenshot from 2021-08-16 13-54-05
https://travis-ci.org/github/googlefonts/pyfontaine/builds/767725570

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.

3 participants