scribble-math/metrics
Emily Eisenberg 0dca731da6 Add accents
Summary:
Add support for math-mode accents. This involves a couple changes.
First, in order to correctly position the accents, we must know the kern between
every character and the "skewchar" in that font. To do this, we improve our tfm
parser to run the mini-kern-language and calculate kerns. We then export these
into fontMetrics.js.

Then, we add normal support for accents. In particular, we do some special
handling for supsubs around accents. This involves building the supsub
separately without the accent, and then replacing its base with the built
accent.

Finally, the character in the fonts for the \vec command is a combining unicode
character, so it is shifted to the left, but none of the other characters do
this. We add some special handling for \vec to account for this.

Fixes #7

Test Plan:
 - Make sure tests pass
 - Make sure no huxley screenshots changed, and the new one looks good

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13157
2014-09-13 21:30:35 -07:00
..
extract_tfms.py Add accents 2014-09-13 21:30:35 -07:00
extract_ttfs.py Add accents 2014-09-13 21:30:35 -07:00
mapping.pl Update metrics using TeX metrics instead of TTF metrics 2014-09-03 20:12:00 -07:00
parse_tfm.py Add accents 2014-09-13 21:30:35 -07:00
README.md Add the ability to extract metrics from ttfs 2014-09-12 14:59:28 -07:00
replace_line.py Update metrics using TeX metrics instead of TTF metrics 2014-09-03 20:12:00 -07:00

How to generate new metrics


There are several requirements for generating the metrics used by KaTeX.

  • You need to have an installation of TeX which supports kpathsea. You can check this by running tex --version, and seeing if it has a line that looks like

    kpathsea version 6.2.0

  • You need the JSON module for perl. You can install this either from CPAN or with your package manager.

  • You need the python fontforge module. This is probably either installed with fontforge or can be installed from your package manager.

Once you have these things, run

make metrics

which should generate new metrics and place them into fontMetrics.js. You're done!