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

Here is the first pull request related to this pull request:

You may leave some comments on the pull request if you have time. I’ve encouraged the student to discuss the detail of the opentype project with you.

2 Likes

I saw the PR, thanks. I will comment it and discuss with the student.

2 Likes

Second pull request:

I merged the pull request just now, let the student move on ASAP!

Here is the third pull request:

And I’ve approved it.

The fourth pull request:

I just approved it with a LGTM comment.

Here are the last two pull requests by the student:

FYI @mgubi

I will approve it within 24 hours and merge it. The student’s code is trustworthy. Apart from the procrastination, the project has been completed very well in my opinion.

After the merge of this two pull requests, and then @mgubi ( as the mentor of this project ) need to give feedbacks of the project in the ospp system (accept it or reject it). The deadline is about 36 hours later.

1 Like