|
|
# STIX and Asana fonts
|
|
|
|
|
|
### Overview
|
|
|
|
|
|
For general description of our font support see
|
|
|
[A MathJax Q&A -- fonts](https://github.com/mathjax/MathJax/wiki/Drafts).
|
|
|
Currently, we support MathJax fonts (local and Web versions) as well as STIX
|
|
|
fonts (local versions). This document suggests a way to support STIX Web fonts
|
|
|
and Asana fonts. The proposed method
|
|
|
could also be applied in the future to support
|
|
|
other free mathematical fonts as Web fonts (e.g Neo Euler or LM-Math).
|
|
|
The basic issues to support new fonts are the following:
|
|
|
|
|
|
* The font files are large. In order to make them available to MathJax in
|
|
|
a reasonable amount of time, we need to split them into smaller font files.
|
|
|
This is automatically done in [MathJax-dev/fonts/OTF](https://github.com/fred-wang/MathJax-dev/tree/master/fonts/OTF).
|
|
|
This is a potential difficulty for STIX and Asana fonts since the
|
|
|
local fonts and Web fonts will be different.
|
|
|
This also means that browsers may not be able to use the modified
|
|
|
fonts (see below).
|
|
|
|
|
|
* In order to detect when the font files are downloaded, we need to add
|
|
|
three glyphs to the fonts.
|
|
|
This is also automatically done in [MathJax-dev/fonts/OTF](https://github.com/fred-wang/MathJax-dev/tree/master/fonts/OTF).
|
|
|
The code points we use are U+EFFE, U+EFFD, U+EFFF and these
|
|
|
are free in the Asana and STIX font files.
|
|
|
|
|
|
* Glyph info are not exposed to Javascript. Hence this must be extracted
|
|
|
and integrated into Javascript files so that they can be handled by MathJax.
|
|
|
This is automatically done in [MathJax-dev/fonts/AFM](https://github.com/fred-wang/MathJax-dev/tree/master/fonts/AFM) and [MathJax-dev/fonts/SVG](https://github.com/fred-wang/MathJax-dev/tree/master/fonts/SVG) for the HTML+CSS and SVG
|
|
|
output respectively.
|
|
|
|
|
|
* Contructions of stretchy operators
|
|
|
are described in the Open Type Math table, which is
|
|
|
not exposed to Javascript. Currently, we write tables "by hand"
|
|
|
in the [fontdata.js files](https://github.com/mathjax/MathJax/blob/master/unpacked/jax/output/HTML-CSS/fonts/). We already support STIX fonts and tables for
|
|
|
Asana are available in Gecko source code. Moreover the fonts have an OpenType
|
|
|
Math table that FontForge can read. So the new tables could be obtained
|
|
|
more or less automatically.
|
|
|
|
|
|
* Only Unicode code points are accessible from Javascript.
|
|
|
This is the case for STIX 1.1 "General" (the legacy version)
|
|
|
and Asana fonts, so we can in theory
|
|
|
support local and Web versions. For other mathematical fonts like
|
|
|
STIX 1.1 "Word" (the new version with less files and OpenType Math table),
|
|
|
Cambria Math, Neo Euler, LM-Math, Lucida fonts ; we could only support
|
|
|
modified versions with some glyphs moved to Unicode code points.
|
|
|
|
|
|
* In certain cases (old browsers, security restriction...), Web fonts are not
|
|
|
available so MathJax has to use images fonts instead. For the
|
|
|
MathJax TeX fonts, the images are created in
|
|
|
[MathJax-dev/fonts/IMG](https://github.com/fred-wang/MathJax-dev/tree/master/fonts/IMG). Currently, this is mostly a fallback used in very rare cases and
|
|
|
has several drawbacks (very large files, style not applied, bad quality).
|
|
|
Hence, it makes sense to ignore image fonts for Asana or STIX and just
|
|
|
keep the MathJax TeX versions.
|
|
|
|
|
|
* Because of some of the previous points, the fonts must be available under a
|
|
|
flexible license. This is the case for STIX and Asana fonts and we got
|
|
|
an agreement with the STIX consortium to modify the fonts and still keep
|
|
|
the font name. This is an issue for proprietary fonts mentioned
|
|
|
above, like Cambria Math or Lucida.
|
|
|
|
|
|
### Strategy for Splitting Fonts
|
|
|
|
|
|
The STIX and Asana fonts are available in the following format:
|
|
|
|
|
|
* Asana Math: one file with all the glyphs. Contains an OpenType Math table.
|
|
|
* STIX 1.1 "Word": one file for each style (Regular, Italic, Bold, BoldItalic)
|
|
|
and one file with an OpenType Math Table (and so glyphs used for stretchy
|
|
|
operators).
|
|
|
* STIX 1.1 "General": the old sets with STIXGeneral, various files for
|
|
|
integral symbols, a STIXNonUnicode file for some non unicode glyphs and
|
|
|
various files for size variants. Some of these files have variants for each
|
|
|
style (Regular, Italic, Bold, BoldItalic).
|
|
|
|
|
|
As a comparison, MathJax fonts is essentially split into main files with
|
|
|
most of the glyphs, other files for different variants of letters
|
|
|
(fraktur, monotype...) and other files for stretchy operators. Hence it makes
|
|
|
sense to use the same categories for Asana and STIX fonts. Some points to
|
|
|
take into account:
|
|
|
|
|
|
* Do we want to generate our Web fonts from the STIX "General" or the
|
|
|
STIX "Word" version? The main advantage
|
|
|
of the former is that it is already supported by MathJax and we could
|
|
|
think that it would not be too difficult to adapt the code to a Web fonts
|
|
|
version, as we did for STIX beta and 1.0. However, the
|
|
|
set of fonts will not be the same and it could be cleaner to
|
|
|
use a separate directory for the font data.
|
|
|
Also, it will be more convenient to
|
|
|
create subcategories from the 5 STIX "Word" files than to work from the
|
|
|
messy STIX "General" set of files. Finally we could imagine that in the
|
|
|
future, STIX "General" could become obsolete or deprecated and so it's
|
|
|
not a bad idea to directly base our Web fonts on STIX "Word".
|
|
|
|
|
|
* Do we want to allow the Native MathML output to use the new Web fonts?
|
|
|
This is really just a problem for stretchy operators that use non-unicode
|
|
|
constructions. Currently, only Gecko supports STIX/Asana
|
|
|
via private tables
|
|
|
and this strongly depends on the font name. This is problematic if we
|
|
|
change the set of fonts, as Gecko will just not be able to recognize them.
|
|
|
In [the short term](https://github.com/fred-wang/MathJax/tree/issue301),
|
|
|
browsers could just use
|
|
|
the MathJax fonts since the local and Web versions are the same.
|
|
|
We could also put some copies of the (non-modified) STIX and Asana fonts
|
|
|
in a separate directory that will be used by the Native MathML output only.
|
|
|
Note that download time is not a problem for the Native MathML support and
|
|
|
we can probably just focus on the most recent woff format.
|
|
|
In the long term, they are likely to support the Open Type tables and we
|
|
|
could maybe copy this table into our Web fonts. That's another reason why
|
|
|
it is best to work with STIX "Word".
|
|
|
|
|
|
* STIX and Asana have much more characters than our MathJax TeX fonts. Of
|
|
|
course that's one of the reason why we want to support them (besides
|
|
|
providing alternative styles). So we need more categories than those
|
|
|
given in MathJax. The most obvious option is classification by font style
|
|
|
(bold, italic, bold-italic) and to follow existing Unicode
|
|
|
subcategories (for example those given in
|
|
|
[chapter 7 of the MathML 3 recommendation](http://www.w3.org/Math/TR/chapter7.html#chars.entities)). Finally, we can provide a file with all the remaining
|
|
|
characters, that are less often used in mathematics.
|
|
|
In the future, we could consider a "mixed mode" where MathJax TeX fonts
|
|
|
are used by default with other STIX/Asana Web fonts covering the missing
|
|
|
characters.
|
|
|
|
|
|
### Proposal
|
|
|
|
|
|
The file hierarchy could look like this:
|
|
|
|
|
|
* fonts/
|
|
|
* TeX/: the current directory, with eot, otf, svg, img and woff fonts.
|
|
|
* STIX/, Asana/: Same, with our modified versions and without the png images.
|
|
|
* woff/: a directory with the original versions of STIX and Asana files
|
|
|
(converted into woff) to be used by the Native MathML output.
|
|
|
|
|
|
* unpacked/
|
|
|
* output/HTML-CSS/fonts/
|
|
|
* TeX, STIX: current directories for MathJax fonts and local STIX fonts.
|
|
|
* Asana: font data for local Asana fonts.
|
|
|
* STIXWeb, AsanaWeb: font data for our (modified) STIX and Asana Web
|
|
|
fonts.
|
|
|
* output/SVG/fonts/
|
|
|
* Idem mutatis mutandis.
|
|
|
|
|
|
The STIX and Asana fonts will be split into the following
|
|
|
categories. Other subdivisions will be used for Regular, Bold, Italic
|
|
|
Bold-italic. We will preserve the Unicode code points, except for
|
|
|
STIXMath-Regular where the glyphs must be moved to one of the PUA.
|
|
|
|
|
|
* Main or Math?
|
|
|
* Size1
|
|
|
* Size2
|
|
|
* Size3
|
|
|
* Size4
|
|
|
* Caligraphic (regular, bold, italic, bold-italic)
|
|
|
* double-struck
|
|
|
* script
|
|
|
* fraktur
|
|
|
* sans-serif
|
|
|
* monospace
|
|
|
* isoamsa Added Math Symbols: Arrow Relations
|
|
|
* isoamsb Added Math Symbols: Binary Operators
|
|
|
* isoamsc Added Math Symbols: Delimiters
|
|
|
* isoamsn Added Math Symbols: Negated Relations
|
|
|
* isoamso Added Math Symbols: Ordinary
|
|
|
* isoamsr Added Math Symbols: Relations
|
|
|
* ...
|
|
|
* Other |