From 37508ff34a3a61a3c9b6947986dbb0f9a0ee4a5a Mon Sep 17 00:00:00 2001 From: Rasmus Andersson Date: Fri, 8 Sep 2023 15:54:24 -0700 Subject: [PATCH] fix version property in misc/tools/fontinfo.py --- misc/tools/fontinfo.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/misc/tools/fontinfo.py b/misc/tools/fontinfo.py index 9dcfcfe1a..cb76b7ea8 100755 --- a/misc/tools/fontinfo.py +++ b/misc/tools/fontinfo.py @@ -275,13 +275,17 @@ def genFontInfo(fontpath, outputType, withGlyphs=True): # print('table', tableName) nameDict = {} + version = None if 'name' in tt: nameDict = {} for rec in tt['name'].names: k = '#%d' % rec.nameID + value = rec.toUnicode() if rec.nameID in _NAME_IDS: + if _NAME_IDS[rec.nameID] == 'version': + version = value k += ' ' + _NAME_IDS[rec.nameID] - nameDict[k] = rec.toUnicode() + nameDict[k] = value if 'fontId' in nameDict: info['id'] = nameDict['fontId'] @@ -292,8 +296,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True): if 'subfamilyName' in nameDict: info['name'] += '-' + nameDict['subfamilyName'].replace(' ', '') - if 'version' in nameDict: - version = nameDict['version'] + if version: v = re.split(r'[\s;]+', version) if v and len(v) > 0: version = v[0]