Save auto-generated font metrics data to separate JSON file

This separates auto-generated code from manually created code.
We need a more recent version of browserify to directly require JSON.
Note that the data was copied, not recreated, so it has not been changed.
This addresses issue #301.
This commit is contained in:
Martin von Gagern
2015-07-09 15:01:22 +02:00
parent 1f8610cebe
commit 1603162267
6 changed files with 6 additions and 22 deletions

View File

@@ -17,5 +17,5 @@ Once you have these things, run
make metrics
which should generate new metrics and place them into `fontMetrics.js`. You're
done!
which should generate new metrics and place them into `fontMetricsData.json`.
You're done!

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env python2
import sys
with open("../src/fontMetrics.js", "r") as metrics:
old_lines = file.readlines(metrics)
replace = sys.stdin.read()
with open("../src/fontMetrics.js", "w") as output:
for line in old_lines:
if line.startswith("var metricMap"):
output.write("var metricMap = ")
output.write(replace)
output.write(";\n")
else:
output.write(line)