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 write scripts that extract glyphs 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" will 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.

File Hierarchy

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.

STIX

The STIX fonts will be split into the following files (4+4+2+2+1+4+1+1+5+8*4 = 56 fonts). 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 via 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. This may also contain the "Replacement character" (U+FFFD).

  • 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 STIX_Greek-* 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

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

  • Fonts for strechy operators

    These fonts will contain all the glyphs that are necessary to draw stretchy operators. Glyphs are taken from STIXMath-Regular and moved to valid Unicode code points (e.g. a PUA).

    • STIX_Size1-Regular: size variants 1.
    • STIX_Size2-Regular: size variants 2.
    • STIX_Size3-Regular: size variants 3.
    • STIX_Size4-Regular: size variants 4.
    • STIX_Size5-Regular: size variants 5 and glyphs for vertical and horizontal constructions.
  • Other Unicode blocks from STIX:

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

      These fonts will contain latin glyphs: Glyphs from The Latin-1 Supplement (00080-000FF), Latin Extended-A (00100-0017F), Latin Extended-B (00180-0024F) and Latin Extended Additional (01E00-01EFF) blocks.

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

      These fonts will contain glyphs for non-latin alphabets: Greek and Coptic (00370-003FF), Cyrillic (00400-004FF), Hiragana (03040-0309F), Letterlike Symbols (02100-0214F)

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

      These fonts will contain specific diacritical or punctuation marks: Spacing Modifier Letters (002B0-002FF), Combining Diacritical Marks (00300-0036F), Combining Diacritical Marks for Symbols (020D0-020FF), General Punctuation (02000-0206F), CJK Symbols and Punctuation (03000-0303F)

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

      These fonts will contain various mathematical arrows: Arrows (02190-021FF), Supplemental Arrows-A (027F0-027FF), Supplemental Arrows-B (02900-0297F)

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

      These fonts will contain various mathematical operators: Mathematical Operators (02200-022FF), Supplemental Mathematical Operators (02A00-02AFF)

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

      These fonts will contain various mathematical symbols: Miscellaneous Technical (02300-023FF), Miscellaneous Mathematical Symbols-A (027C0-027EF), Miscellaneous Mathematical Symbols-B (02980-029FF)

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

      These fonts will contain various shapes and non-mathematical symbols: Geometric Shapes (025A0-025FF), Miscellaneous Symbols (02600-026FF), Miscellaneous Symbols and Arrows (02B00-02BFF), Block Elements (02580-0259F), Box Drawing (02500-0257F) Control Pictures (02400-0243F)

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

      These fonts will contain all the glyphs that have not been included in one of the category above: Superscripts and Subscripts (02070-0209F), Enclosed Alphanumerics (02460-024FF), Currency Symbols (020A0-020CF), Phonetic Extensions (01D00-01D7F), Phonetic Extensions Supplement (01D80-01DBF), Dingbats (02700-027BF), Number Forms (02150-0218F)

Asana Math

We will use a classification similar to the one described above for STIX fonts and adapt "Other Unicode blocks" according the the characters supported. Except for the "Mathematical Alphanumeric Symbols", we only provide a *-Regular version since Asana Math is only one file. More details will be provided when we try to support this font family...

Clone this wiki locally