Skip to content

STIX and Asana

Frédéric Wang edited this page Mar 18, 2013 · 3 revisions

STIX and Asana fonts

Overview

For general description of our font support see A MathJax Q&A -- fonts. 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. 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. 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 and MathJax-dev/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. 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 an OpenType Math table), Cambria Math, Neo Euler, LM-Math, Lucida fonts ; we could only support modified versions with some glyphs moved to actual 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. 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 set 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, 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. For Native MathML support, note that we we can probably just focus on the most recent woff format and that download time is not a problem. In the long term, browsers are likely to support the Open Type tables and we could maybe copy these tables 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 MathJax/Unicode subcategories. 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 fonts will be split into the following files. In most cases, we will preserve the Unicode code points. We will follow the subdivision of MathJax fonts, but ignore the distinction between Main/Math and Caligraphic/Script. The remaining glyphs will be classified using their Unicode Blocks.

  • STIX_Main-Regular, STIX_Main-Italic, STIX_Main-Bold, STIX_Main-BoldItalic.

    These fonts will contain the glyphs from Basic Latin Unicode block (U+0000 to U+007F) as well as the characters from the MathJax-Main fonts.

  • Various fonts for the Mathematical Alphanumeric Symbols.

    These fonts will cover all the glyphs from MathJax's Caligraphic, Fraktur, Sans-serif, and Greek fonts. We can probably do a remapping to ASCII positions (as we do for the MathJax fonts) to avoid bugs with some browsers not able to access non-BMP characters. Note that latin characters and digits for normal, bold, italic and bold-italic mathvariants are already contained in the STIX-Main-* fonts, so we only need to add new files for greek letters. The other files will contain the latin/greek letters and digits for the corresponding mathvariant category.

    • STIX_Greek-Regular, STIX_Greek-Bold, STIX_Greek-Italic, STIX_Greek-BoldItalic
    • STIX_Script-Regular, STIX-Script-Bold
    • STIX_Fraktur-Regular, STIX-Fraktur-Bold
    • STIX_DoubleStruck-Regular
    • STIX_SansSerif-Regular, STIX_SansSerif-Bold, STIX_SansSerif-Italic, STIX_SansSerif-BoldItalic
    • STIX_Monospace-Regular
  • STIX_AMS-Regular, STIX_AMS-Bold, STIX_AMS-Italic, STIX_AMS-BoldItalic

    These fonts will cover all the characters from MathJax-AMS, that are needed to support the AMS extension.

  • Fonts for strechy operators

    STIXMath-Regular glyphs must be moved to one of the PUA.

    • Size1
    • Size2
    • Size3
    • Size4
  • Other Unicode blocks from STIX:

    • STIX_Latin-Regular, STIX_Latin-Bold, STIX_Latin-Italic, STIX_Latin-BoldItalic.

      Glyphs from The Latin-1 Supplement (00080-000FF) Latin Extended-A (00100-0017F) and Latin Extended-B (00180-0024F) Latin Extended Additional (01E00-01EFF) blocks.

    • STIX_Language-Regular, STIX_Language-Bold, STIX_Language-Italic, STIX_Language-BoldItalic.

      Greek and Coptic (00370-003FF), Cyrillic (00400-004FF), Hiragana (03040-0309F)

  • STIX-Other-Regular, STIX-Other-Bold, STIX-Other-Italic, STIX-Other-BoldItalic.

    This will contain all the glyphs that have not been included in one of the category above.

TODO: Spacing Modifier Letters; 002B0-002FF Combining Diacritical Marks; 00300-0036F Phonetic Extensions; 01D00-01D7F Phonetic Extensions Supplement; 01D80-01DBF General Punctuation; 02000-0206F Superscripts and Subscripts; 02070-0209F Currency Symbols; 020A0-020CF Combining Diacritical Marks for Symbols; 020D0-020FF Letterlike Symbols; 02100-0214F Number Forms; 02150-0218F Arrows; 02190-021FF Mathematical Operators; 02200-022FF Miscellaneous Technical; 02300-023FF Control Pictures; 02400-0243F Enclosed Alphanumerics; 02460-024FF Box Drawing; 02500-0257F Block Elements; 02580-0259F Geometric Shapes; 025A0-025FF Miscellaneous Symbols; 02600-026FF Dingbats; 02700-027BF Miscellaneous Mathematical Symbols-A; 027C0-027EF Supplemental Arrows-A; 027F0-027FF Supplemental Arrows-B; 02900-0297F Miscellaneous Mathematical Symbols-B; 02980-029FF Supplemental Mathematical Operators; 02A00-02AFF Miscellaneous Symbols and Arrows; 02B00-02BFF CJK Symbols and Punctuation; 03000-0303F Specials; 0FFF0-0FFFF Mathematical Alphanumeric Symbols; 1D400-1D7FF

Clone this wiki locally