mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 03:38:39 +00:00
Summary: Instead of using the metrics from our generated TTF files, use the fonts that TeX ships with. Pull the mapping out of the MathJax-dev repo from makeFF to get the correct mapping of metrics to font characters, and use our own tfm reader to extract metrics out of the tfm files into a useable format. Add a README and Makefile rule to make this process easier in the future. Also remove the silly 0.05em we put on supsubs because our italic correction works now. Test Plan: - Run huxley tests, see that changes are because of font metric changes. - See that the extension piece of `\bigl |` now extends above the top, as it is supposed to. Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D12867
44 lines
999 B
Makefile
44 lines
999 B
Makefile
UNAME=$(shell uname)
|
|
|
|
.PHONY: build setup copy serve clean metrics
|
|
build: setup build/katex.js build/katex.less.css
|
|
ifeq ($(UNAME),Darwin)
|
|
build: pdiff
|
|
endif
|
|
|
|
setup:
|
|
npm install
|
|
ifeq ($(UNAME),Darwin)
|
|
which webkit2png || brew install webkit2png
|
|
which gm || brew install graphicsmagick
|
|
endif
|
|
|
|
compress: build/katex.min.js
|
|
@printf "Minified, gzipped size: "
|
|
@gzip -c $^ | wc -c
|
|
|
|
build/katex.js: katex.js $(wildcard *.js)
|
|
./node_modules/.bin/browserify $< --standalone katex > $@
|
|
|
|
build/katex.min.js: build/katex.js
|
|
uglifyjs --mangle < $< > $@
|
|
|
|
build/katex.less.css: static/katex.less
|
|
./node_modules/.bin/lessc $< > $@
|
|
|
|
serve:
|
|
node server.js
|
|
|
|
pdiff:
|
|
@printf "Creating new pdiff image...\n"
|
|
@webkit2png http://localhost:7936/test/pdiff.html -F --transparent -D build -o pdiff
|
|
@mv build/pdiff-full.png build/pdiff.png
|
|
@printf "Comparing to reference pdiff image...\n"
|
|
@node test/pdiff.js
|
|
|
|
metrics:
|
|
cd metrics && ./mapping.pl | ./extract_tfms.py | ./replace_line.py
|
|
|
|
clean:
|
|
rm -rf build/*
|