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) PYTHON=$(shell python2 --version >/dev/null 2>&1 && echo python2 || echo python)
metrics: 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: clean:
rm -rf build/* rm -rf build/*

View File

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

View File

@ -1,4 +1,4 @@
{ module.exports = {
"AMS-Regular": { "AMS-Regular": {
"65": {"depth": 0.0, "height": 0.68889, "italic": 0.0, "skew": 0.0}, "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}, "66": {"depth": 0.0, "height": 0.68889, "italic": 0.0, "skew": 0.0},