1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-23 11:43:47 +03:00

misc/show-changes.py: handle removed glyphs

This commit is contained in:
Rasmus Andersson 2018-01-13 13:52:47 -08:00
parent e2a8d2a702
commit c026473d55

View File

@ -47,14 +47,18 @@ def main():
ufoPrefix = 'src/Inter-UI-'
changes = OrderedDict()
deleted = []
for line in out.split('\n'):
changeType, name = line.split('\t')
if name.startswith(ufoPrefix) and name.endswith('.glif'):
weight = name[len(ufoPrefix):name.find('.ufo/')]
filename = os.path.join(rootdir, name)
doc = xmlParseFile(filename)
# print(changeType, weight, name)
try:
doc = xmlParseFile(filename)
except:
deleted.append('%s/%s' % (weight, os.path.basename(name)))
continue
g = doc.documentElement
gname = g.attributes['name'].value
@ -62,8 +66,6 @@ def main():
'U+' + u.attributes['hex'].value
for u in g.getElementsByTagName('unicode')
])
# print('gname', gname)
# print('unicodes:', unicodes)
c = changes.get(gname)
if c is None:
@ -76,8 +78,6 @@ def main():
c['unicodes'] = c['unicodes'].union(unicodes)
c['weights'].append((weight, changeType))
# break
longestName = 0
names = sorted(changes.keys())
@ -106,4 +106,10 @@ def main():
weightss = ' & '.join(weights)
print('%s%s %s' % (name.ljust(longestName), unicodess, weightss))
if len(deleted):
print('\nDeleted files')
for filename in deleted:
print('- %s' % filename)
main()