-
Notifications
You must be signed in to change notification settings - Fork 457
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
exception against Behdad's 'tofu' font #497
Comments
Reproduced. Looking into it. |
Yeah, that's because in that tofu.ttx file, the cmap table has I'll make sure it checks that the instance does have the attribute before accessing it. |
@behdad I'd just skip it in this case. WDYT? diff --git a/Lib/fontTools/ttLib/tables/O_S_2f_2.py b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
index e6bc4bc..821dabc 100644
--- a/Lib/fontTools/ttLib/tables/O_S_2f_2.py
+++ b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
@@ -194,6 +194,11 @@ class table_O_S_2f_2(DefaultTable.DefaultTable):
setattr(self, name, safeEval(attrs["value"]))
def updateFirstAndLastCharIndex(self, ttFont):
+ if not hasattr(ttFont['cmap'], 'tables'):
+ # skip if the cmap table class is DefaultTable -- e.g. because of decompile
+ # errors, or because it's written as hex data in the TTX file (with 'raw=1')
+ # https://github.com/behdad/fonttools/issues/497
+ return
codes = set()
for table in ttFont['cmap'].tables:
if table.isUnicode(): |
Alternatively, I could check |
@jbreiden you should now be able to compile the tofu.ttx file. |
successfully ran ttx on tofu.ttx, thank you very much |
The text was updated successfully, but these errors were encountered: