Summary:
Update the MathJaxFonts `Dockerfile` to enable the use of
`ttfautohint` which hints our fonts better. Also, fix the location that
batik is downloaded from, update some formatting in the `Dockerfile`,
and update the fonts and metrics.
Test Plan:
- Compare a rendered `= - A z 4 \Longrightarrow \Sigma \Biggl(` in
Chrome on Windows at font sizes 10px to 20px before and after this
change.
- See that characters look about the same, or better.
- See that the screenshot tests didn't change in firefox (maybe firefox
runs the same autohinting algorithm that we do?), and don't visually
change in chrome
Reviewers: kevinb, alpert
Reviewed By: kevinb, alpert
Differential Revision: https://phabricator.khanacademy.org/D18977
Escaping TeX in JSON as query strings is a pain: you have to double all the
\\, you have to escape the & and the #, you can't easily include line breaks
for readability, and so on. YAML solves most of these problems for most of
the situations. Now each test case can be structured, while simple test
cases only consist of a line of verbatim TeX code, with no escaping.
The most troublesome items remaining are lines starting in { since in YAML
these would denote inline mapping types. We use block notation for these.
This avoids one of the few requirements we have left: you no longer have to
start a KaTeX development server, the script will do it for you, using a
random port number.
To reproduce the old behaviour, explicitely state --katex-port=7936.
Since the Selenium images are available for download, and downloading them
is usually faster than building them from scratch, this makes taking
screenshots easier. Furthermore, since the Selenium image is not specific
to KaTeX, it could as well be used for other purposes, thus saving space
since a single image can be used in multiple projects.
This change also deals with the non-determinism in the Lap screenshot:
We detect the one known (and accepted) alternate rendering and change the
output file name to Lap_alt in this case. So either Lap or Lap_alt gets
saved to, and if the image is different from both, then one of these files
will show a modification. On the other hand, if it is equal to either of
these, then the matching one will get overwritten, showing no change.
The dependencies of fonttools are much lighter than fontforge, and since all
we need are some metrics, fonttools is very much up to that task.
This addresses issue #288.
We had some duplicate mappings in mappings to start with. Now we have some
code to complain loudly about these, and all currently existing duplicates
have been dealt with.
We also had a problem where in some Python dict, existing stuff was using
strings as keys while new data would use numeric indices, thus not
overwriting the previous value. Now we always use strings as keys.
Along the road, the italic dotless i and j symbols were changed
so that they now are taken from cmmi10 instead of cmti10.
This will make reviewing modifications easier, since the affected glyphs
will be more readily visible in the diff.
The formatting tool was applied to the existing data, instead of
regenerating the data, so the semantic content should be unmodified.
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.
We now try whether there is an executable called python2, and if so,
use that in preference to python when executing the metric computation.
Furthermore, we allow the user to specify the path of the python binary
using the PYTHON variable of make, i.e. “make PYTHON=/foo/python2 metrics”.
This adds \lgroup, \rgroup, \lmoustache and \rmoustache,
provides \lVert and \rVert with the correct type for each,
and makes \lvert, \rvert, \lVert and \rVert available
through \left...\right.
A fraction is surrounded by a box of width \nulldelimiterspace on either side.
That size is 1.2pt and does not scale with the style or font size.
Furthermore, a \frac creates a brace-enclosed group which results in a
\mathord, not a \mathinner.
The same test cases we use for our screenshots from Firefox are now also
being rendered by pdflatex, so the resulting images can be used as reference
for how things are supposed to look (if we concentrate on compatibility with
LaTeX). To make comparisons even easier, the differences between LaTeX and
Firefox snapshots are rendered in a visual way, using different colors.
Discussed in pull request #268.
added "Pull Requests" section with some guidelines, plus some addition code style guidelines.
fix grammar and be more specific about splitting large pull request
Update CONTRIBUTING.md
Summary: Ensure that `make dist` is idempotent, and make sure comments
don't get printed out.
Test plan:
- `make dist`
- `make dist` again
- See that there's no `katex` directory in `dist/`
- See that no comments are printed out during `make dist`
Auditors: alpert
Summary: Bower's bower.json spec says to not include font/image files,
and only to include one file per filetype.
Test plan:
- `make dist`, commit the result
- Run `bower install /path/to/KaTeX#master` from /tmp
- See that this succeeds, and `bower list --paths` has katex.min.js and
katex.min.css for the KaTeX entry
Auditors: alpert, kevinb
Test plan:
- Run `bower install katex` from /tmp
- Verify that there are no errors when running the command
- Verify that `bower_components/katex/dist/` contains all the build files
- Verify that the version is 0.4.2
Auditors: emily
- Add "main" field to bower.json to prevent errors during installation.
- Bump version to 0.4.1 in bower.json and package.json
https://github.com/Khan/KaTeX/issues/181
Test plan:
- Run `bower install katex` from /tmp
- Verify that there are no errors when running the command
and that `bower_components/katex/dist/` contains all the build files
Auditors: emily
Summary: Add a bower.json so KaTeX can be included using bower.
Test plan:
- Run `bower install /path/to/KaTeX#this-commit` from /tmp
- See that `bower_components/KaTeX` contains only the full `dist/`
directory
Auditors: alpert
Summary: Adds a `dist` rule to the Makefile which builds the `dist/`
directory with all of the built files in it.
Test plan:
- `make dist`
Auditors: alpert
Using a loop to determine the number of symbols we need is intuitive but
hardly efficient. A Math.ceil in this situation is much better.
After that ceil or the loop that it replaced, the total height should be
equal to the minimal height plus an integral number times the height of the
repeat symbol. That integer equals (half) number of loop iterations in the
original code, and the repeatCount variable in my new code. So later on,
the quotient (repeatHeight / repeatHeightTotal) should be an integer, at
least up to numeric errors. Applying ceil instead of round to that is
asking for these numeric errors to seriously break stuff. Just reusing the
repeatCount is much simpler, shorter and more elegant.
Having distinct topSymbolCount and bottomSymbolCount seems pointless, since
the only reason why these could ever be different is due to the fact that
bottomRepeatHeight was computed using topHeightTotal, which looks like a
bug. The old loop and new ceil assume a symmetric repeatCount.