Generate fontMetricsData as JavaScript

This commit is contained in:
Blai Pratdesaba 2015-08-05 19:52:42 +01:00
parent b2d2df9bef
commit 8cd71830c2
3 changed files with 3 additions and 3 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 | $(PYTHON) ./format_json.py > ../src/fontMetricsData.json
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py > ../src/fontMetricsData.js
clean:
rm -rf build/*

View File

@ -4,7 +4,7 @@ import sys
import json
data = json.load(sys.stdin)
sep = "{\n"
sep = "module.exports = {\n"
for font in sorted(data):
sys.stdout.write(sep + json.dumps(font))
sep = ": {\n "

View File

@ -1,4 +1,4 @@
{
module.exports = {
"AMS-Regular": {
"65": {"depth": 0.0, "height": 0.68889, "italic": 0.0, "skew": 0.0},
"66": {"depth": 0.0, "height": 0.68889, "italic": 0.0, "skew": 0.0},