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

Handle .ttf fonts with missing ulCodePageRange1 entries #906

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions kiva/fonttools/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,14 @@ def get_ttf_prop_dict(font):
if bit in _ot_unicode_range_bits:
languages.add(_ot_unicode_range_bits[bit])
# Check the codepage range bits
cp_bits = table.ulCodePageRange1
for lang, mask in _ot_code_page_masks.items():
if cp_bits & mask:
languages.add(lang)
try:
cp_bits = table.ulCodePageRange1
for lang, mask in _ot_code_page_masks.items():
if cp_bits & mask:
languages.add(lang)
except AttributeError:
# some fonts don't have ulCodePageRange1
pass
# Lock the set so that it's hashable
propdict["languages"] = frozenset(languages)
except KeyError:
Expand Down