[statisticsPen] Report font glyph-average weight/width
This commit is contained in:
parent
159cc0c04e
commit
8707a1da58
@ -77,6 +77,8 @@ def _test(glyphset, upem, glyphs):
|
||||
|
||||
print("upem", upem)
|
||||
|
||||
wght_sum = 0
|
||||
wdth_sum = 0
|
||||
for glyph_name in glyphs:
|
||||
print()
|
||||
print("glyph:", glyph_name)
|
||||
@ -103,6 +105,13 @@ def _test(glyphset, upem, glyphs):
|
||||
]:
|
||||
print("%s: %g" % (item, getattr(pen, item)))
|
||||
|
||||
wght_sum += abs(pen.area)
|
||||
wdth_sum += glyph.width
|
||||
|
||||
print()
|
||||
print("weight: %g" % (wght_sum * upem / wdth_sum))
|
||||
print("width: %g" % (wdth_sum / upem / len(glyphs)))
|
||||
|
||||
|
||||
def main(args):
|
||||
if not args:
|
||||
|
Loading…
x
Reference in New Issue
Block a user