Use an array of values instead of object literals to save space in fontMetricsData.js

Test Plan: make test

Reviewers: emily
This commit is contained in:
Kevin Barabash
2015-09-29 22:16:03 -07:00
parent fdbdb28617
commit 6a10237017
3 changed files with 1742 additions and 1728 deletions

View File

@@ -6,11 +6,17 @@ import json
data = json.load(sys.stdin)
sep = "module.exports = {\n"
for font in sorted(data):
sys.stdout.write(sep + json.dumps(font))
sep = ": {\n "
for glyph in sorted(data[font], key=int):
sys.stdout.write(sep + json.dumps(glyph) + ": ")
sys.stdout.write(json.dumps(data[font][glyph], sort_keys=True))
sep = ",\n "
sep = "\n},\n"
sys.stdout.write("\n}};\n");
sys.stdout.write(sep + json.dumps(font))
sep = ": {\n "
for glyph in sorted(data[font], key=int):
sys.stdout.write(sep + json.dumps(glyph) + ": ")
values = [data[font][glyph][key] for key in
['depth', 'height', 'italic', 'skew']]
values = [value if value != 0.0 else 0 for value in values]
sys.stdout.write(json.dumps(values))
sep = ",\n "
sep = "\n},\n"
sys.stdout.write("\n}};\n")