diff --git a/Makefile b/Makefile index a8276b34..1d2e3d69 100644 --- a/Makefile +++ b/Makefile @@ -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/* diff --git a/metrics/format_json.py b/metrics/format_json.py index 2e2dfe61..7021a191 100644 --- a/metrics/format_json.py +++ b/metrics/format_json.py @@ -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 " @@ -13,4 +13,4 @@ for font in sorted(data): sys.stdout.write(json.dumps(data[font][glyph], sort_keys=True)) sep = ",\n " sep = "\n},\n" -sys.stdout.write("\n}}\n"); +sys.stdout.write("\n}};\n"); diff --git a/src/fontMetricsData.json b/src/fontMetricsData.js similarity index 99% rename from src/fontMetricsData.json rename to src/fontMetricsData.js index cdbdaaff..e6c9c1a5 100644 --- a/src/fontMetricsData.json +++ b/src/fontMetricsData.js @@ -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}, @@ -1748,4 +1748,4 @@ "2018": {"depth": 0.0, "height": 0.61111, "italic": 0.0, "skew": 0.0}, "2019": {"depth": 0.0, "height": 0.61111, "italic": 0.0, "skew": 0.0}, "8242": {"depth": 0.0, "height": 0.61111, "italic": 0.0, "skew": 0.0} -}} +}};