fix crash: Cagliostro: on "check_font_version_fields"
(issue
@@ -1445,13 +1445,20 @@ def check_font_version_fields(fb, font):
expected[1])
for name in font['name'].names:
if name.nameID == NAMEID_VERSION_STRING:
- print ("NAME: '{}'".format(name))
name_version = name.string.decode(name.getEncoding())
- print ("name_version: {}".format(name_version))
- # change Version 1.007 -> 1.007
+
+ try:
+ # change "Version 1.007" to "1.007"
+ # (stripping out the "Version " prefix, if any)
version_stripped = r'(?<=[V|v]ersion )?([0-9]{1,4}\.[0-9]{1,5})'
version_without_comments = re.search(version_stripped,
name_version).group(0)
+ except:
+ failed = True
+ fb.error(("Unable to parse font version info"
+ " from this name table entry: '{}'").format(name))
+ continue
+
comments = re.split(r'(?<=[0-9]{1})[;\s]', name_version)[-1]
if version_without_comments != expected_str:
# maybe the version strings differ only
