Project (Draft): OpenType math font support

Project Info

  • Name: OpenType math font support
  • Mentor: @mgubi
  • Difficulty: Advanced

Project Description

At the moment TeXmacs (and Mogan) is able to use only very few math fonts (like Stix, TeX Gyre) and this support is hardwired in the C++ files and does not take into account all the informations available in the font files.

These fonts file contain the position in the font of extensible brackets or extensible glyphs like arrows, square roots, etc…, and the metrics to correctly position index and subscripts.

The goal of this project is to add support for OpenType MATH table & related font features (https://learn.microsoft.com/en-us/typography/opentype/spec/math ) and to investigate the possibility to remove the old TeX fonts and only use modern OpenType font containers (at least for the default fonts).

TeXmacs still depends very much on old font formats while there are now available many free fonts in OpenType format which make it easier to support professional math typesetting. In particular there are Latin Modern fonts which can replace our old TeX fonts, and possibly improve speed since there will be less font searching. It is crucial to preserve the high quality of the mathematical typesetting in this transition.

Project Notes

Some time ago @mgubi started to implement some OpenType font support for TeXmacs, here: https://github.com/mgubi/texmacs/tree/wip-unicode-math

One side goal could be to get rid of all TeX fonts and distribute only the OpenType variants. This is for example what ConTeXt does.:

https://wiki.contextgarden.net/ConTeXt_distribution’s_Fonts

For a discussion see here: https://github.com/XmacsLabs/mogan/issues/523

And also here: Proposal: OpenType math font support

Project Output Requirements

  • Implement a complete support of OpenType math font information in TeXmacs. TeXmacs should be able to load any OpenType mathematical font and produce accurate mathematical output comparable to the one already present for the TeX Gire, Computer Modern and Stix fonts.

    • Study and document the font selection mechanism in TeXmacs, in particular how math glyphs are selected from the various fonts. Write some debugging tools which allow developers to check the workings of which glyphs are selected, which metrics used, etc…
    • Complete and debug the initial implementation of the MATH table parser here: wip-unicode-math

Project Technical Requirements

  • Familiarity with the TeXmacs codebase and in particular with the font selection and handling mechanisms, both in the C++ and Scheme parts.
  • Familiarity with the OpenType font format

Project repository