mathjax / MathJax-dev

Build and release tools for the MathJax project
www.mathjax.org
33 stars 26 forks source link

Create a unified Math font #23

Open mathijshenquet opened 7 years ago

mathijshenquet commented 7 years ago

I would like to propose the creation of a single unified font file containing all the glyphs used for ordinary mathematical typesetting.

With ordinary mathematical typesetting I mean typesetting in math mode of a plain LaTeX installation with the AMS packages. By default the punctuation and special characters like ,, %, ! etc in this mode are taken from the roman font, I will call this font the base font.

Currently MathJax creates the following font files containing the glyphs used for ordinary math typesetting (ignoring Size* fonts for the moment):

  1. Main-Regular - The roman font used as base font. This supplies the punctuation and special character glyphs, like the commas in $a, b, c$.

  2. AMS - Contains many special symbol glyphs, like $\geqq$. With, as far as I can see, no overlap with glyphs from Main-Regular.

  3. Math-Regular, Math-Italic, Math-BoldItalic, Caligraphic-Bold, Caligraphic-Regular, Fraktur-Bold, Fraktur-Regular, SansSerif-Bold, SansSerif-Italic, SansSerif-Regular, Typewriter

    These contain the differently styled alphabetical a-z, A-Z glyphs, some of these additionally contain numeral 0-9 glyphs, and some contain greek character glyphs.

Some of the fonts from part 3 (like SansSerif-*, Fraktur-* and Typewriter) contain glyphs used for other purposes, such as typesetting text, not used in ordinary math typesetting. For example some contain glyphs for punctuation and special characters already supplied by Main-Regular.

Unicode provides codepoints for all glyphs mentioned in parts 1, 2 and 3 so in principle only a single Math font is necessary to do ordinary math typesetting. This could be done in the following way:

I think the creation of such a unified font file, even if not directly used for the MathJax project, is a good idea for the following reasons:

  1. It provides a more faithful encoding of the mathematical content. Usage of a Bold font should be styling change, but using bold in mathematical writing signifies different semantics as codified in the unicode Mathematical Alphanumeric Symbols.
  2. The glyphs not used for ordinary math typesetting (as described above) don't need to be transmitted. Admittedly this is a tradeoff since user might need those later for other purposes. Also a user not interested in using SansSerif in math mode won't be able to opt out of it anymore.
  3. It creates a high quality mathematical font for the world to use.

Greetings Mathijs

PS. I would gladly work on this myself

pkra commented 7 years ago

Thanks for filing an issue. This is a complicated topic, I'm afraid. Let me try to summarize a recent discussion among the team members.

There are two main reasons why this is not of interest to us at MathJax.

The first reason is that there are already several fonts for the purpose you describe, e.g., STIX and LatinModern (the latter is based on Computer Modern, like our "MathJax fonts"). So we don't think there's a no need to add another one.

The second reason is that combining all the glyphs into one font is not appropriate for a web font. Such a font will get downloaded often and download time / bandwidth are increased unnecessarily when most of the glyphs will not be used. We intentionally separated the MathJax fonts into groups in order to reduce download times and provide a fast and reliable experience. This is a pretty standard approach, cf. how Google Fonts or Typekit offer on-the-fly font subsetting and warn you when you specify too many fonts.

In other words, there are already fonts and MathJax wouldn't benefit.

In addition there are several minor reasons we would not go this route.

At the time the MathJax fonts were developed, browser&OS support for Plane1 of Unicode (where the math alphanumerics are located) was unreliable and glyphs would sometimes not be displayed. Thus using them was not an option.

The math alphabets also cause issues for assistive technology and they make our accessible rendering more difficult.

Finally, we are not a font development project, and do not have the resources to produce and maintain fonts that are not intended for the MathJax project. The fonts are simply traces of TeX bitmapped versions of the CM font, and so are not a high-quality font; making them high-quality would take a lot of hand editing and that is not our mission.

On a personal note, we actually consider the use of the Unicode math alphabets a bad practice on the web. While they may be useful for print layout, they carry no real semantic information (cf above) and they also do not match layout traditions on the web -- on the web, authors frequently expect CSS to affect to math content, e.g., in underlined links or in styled headings.

Of course none of this should stop you if you want to build a font based on the MathJax fonts! They are SIL licensed and you are more than welcome to use them accordingly. We're also happy to answer questions about our fonts; we are actually revamping our font tool chain as part of MathJax v3.