mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Summary: Upon switching over from ttf metrics to TeX metrics, we lost metrics for a couple of the characters that are dynamically generated by TeX. Thus TeX doesn't have metrics for them, but our fonts do have the characters because the MathJax scripts also dynamically build them. This adds the ability to extract metrics from the generated font files so that we can use the generated characters correctly. A better solution would be to dynamically generate the characters ourselves, but that is much harder, and will be left to a future time. Test Plan: - Make sure typing "\neq \cong \text{ }" produces no warnings in the console. - Make sure huxley screenshots look the same Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D13107
38 lines
1.0 KiB
Makefile
38 lines
1.0 KiB
Makefile
.PHONY: build setup copy serve clean metrics test
|
|
build: setup build/katex.min.js build/katex.min.css compress
|
|
|
|
setup:
|
|
npm install
|
|
|
|
build/katex.js: katex.js $(wildcard *.js)
|
|
./node_modules/.bin/browserify $< --standalone katex > $@
|
|
|
|
build/katex.min.js: build/katex.js
|
|
./node_modules/.bin/uglifyjs --mangle < $< > $@
|
|
|
|
build/katex.less.css: static/katex.less
|
|
./node_modules/.bin/lessc $< > $@
|
|
|
|
build/katex.min.css: build/katex.less.css
|
|
./node_modules/.bin/cleancss -o $@ $<
|
|
|
|
compress: build/katex.min.js build/katex.min.css
|
|
@$(eval JSSIZE!=gzip -c build/katex.min.js | wc -c)
|
|
@$(eval CSSSIZE!=gzip -c build/katex.min.css | wc -c)
|
|
@$(eval TOTAL!=echo ${JSSIZE}+${CSSSIZE} | bc)
|
|
@printf "Minified, gzipped js: %6d\n" "${JSSIZE}"
|
|
@printf "Minified, gzipped css: %6d\n" "${CSSSIZE}"
|
|
@printf "Total: %6d\n" "${TOTAL}"
|
|
|
|
serve:
|
|
node server.js
|
|
|
|
test:
|
|
./node_modules/.bin/jasmine-node test/katex-spec.js
|
|
|
|
metrics:
|
|
cd metrics && ./mapping.pl | ./extract_tfms.py | ./extract_ttfs.py | ./replace_line.py
|
|
|
|
clean:
|
|
rm -rf build/*
|