mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
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:
2
Makefile
2
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) ./replace_line.py
|
||||
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py > ../src/fontMetricsData.json
|
||||
|
||||
clean:
|
||||
rm -rf build/*
|
||||
|
@@ -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!
|
||||
|
@@ -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)
|
@@ -14,7 +14,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"browserify": "~2.29.1",
|
||||
"browserify": "^10.2.4",
|
||||
"clean-css": "~2.2.15",
|
||||
"express": "~3.3.3",
|
||||
"jasmine-node": "2.0.0-beta4",
|
||||
|
File diff suppressed because one or more lines are too long
1
src/fontMetricsData.json
Normal file
1
src/fontMetricsData.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user