Format font metrix data to have one row for each glyph

This will make reviewing modifications easier, since the affected glyphs
will be more readily visible in the diff.
The formatting tool was applied to the existing data, instead of
regenerating the data, so the semantic content should be unmodified.
This commit is contained in:
Martin von Gagern 2015-07-09 15:47:18 +02:00
parent 1603162267
commit 86115b8fce
3 changed files with 1368 additions and 2 deletions

View File

@ -83,7 +83,7 @@ PERL=perl
PYTHON=$(shell python2 --version >/dev/null 2>&1 && echo python2 || echo python)
metrics:
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py > ../src/fontMetricsData.json
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py > ../src/fontMetricsData.json
clean:
rm -rf build/*

16
metrics/format_json.py Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
import sys
import json
data = json.load(sys.stdin)
sep = "{\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");

File diff suppressed because one or more lines are too long