Design differences between text font and math font

Hi everyone!

I was asked to add advanced mathematical symbols and size variants to an already existing font. Since I don’t have experience with mathematical typesetting I did some research and noticed that there are differences in the design of typefaces for text and their math companions.

Some differences I noticed are:
  • size and position of basic mathematical symbols like plus, minus etc. (the plus often even goes below the baseline)
  • position (and sometimes even an entirely different design) of delimiters like brackets, braces, parentheses etc.
  • size and position of the summation sign
There are probably more, but these are the ones that I noticed.

Here are some screenshots from the typefaces I studied:



Fira Math and Fira Sans
The math version has slightly larger + and - which are positioned lower. Even the figures themselves are larger (the same as cap-height).The brace seems to be centred to the minus sign.




Libertinus Math and Libertinus
The overall design of +, - and braces are different – much larger and more distinctive.

I understand that the different application of the typeface leads to different design choices. But what specific criteria do I use to determine the size and position of these characters in math fonts? (+, -, √, ∑, etc.)

Also: How do I determine the size increase of the different delimiter variants?

I’d be grateful for your input!


Tagged:

Comments

  • John Hudson
    John Hudson Posts: 3,227
    You could also take a look at STIX Two Math (although the most recent work we did on it has not been released yet).

    In mathematical typesetting, many things are aligned vertically along the midline of the math operators, as you have observed with the brace delimiters. Math operators in mathematical publishing tend also to be large—those in Fira Math look very small to me; those in Libertinus Math are better.

    Delimiter variants will be selected and scaled by the math handler, so you want to provide enough variants so that a scaled delimiter does not end up too heavy or too light relative to adjacent glyphs. So you don’t need specific heights, just a broad range of heights. In STIX Two Math, I went with 12 variants of each delimiter.
  • John Hudson
    John Hudson Posts: 3,227
    It should be noted that the math axis is a property in OpenType and TeX math handling, and in some cases is quite independent of the default vertical alignment of glyphs in the font. This is what allows math operators to sit at different heights in simple, inline math and at a different height within more complex, expansive equations.
  • Thanks to both of you for the detailed responses!

    Yes, I actually looked a lot at STIX Two also. I only didn’t bring it up in the examples, because I was specifically looking for differences between math and text fonts.

    Okay, so I have to define the math axis first which then informs my decisions on the size and position of many other glyphs.

    Delimiter variants will be selected and scaled by the math handler, so you want to provide enough variants …
    And the handler chooses the variant according to the information in the MathVariant and VertGlyphConstruction table, right?

    Making a math font seems to be quite an undertaking. How did you go about developing STIX Two? @John Hudson
    Is it possible to fill in the information into the math table as you go (and test before adding further information to the MATH table)? Or does the table need to be complete in order to have a valid font?
  • It should be noted that the math axis is a property in OpenType and TeX math handling, and in some cases is quite independent of the default vertical alignment of glyphs in the font.

    As I recall, only large operators and variable delimiters are shifted by the math layout engine (TeX calls these extensible symbols), so their vertical position in the font can be arbitrary—the math engine will shift them to be centered around the math axis anyway. For binary operators and relation symbols, the math engine will not tinker with their position—they will appear where you’ve placed them in the font.

    Speaking of delimiters, first it is a good idea to make the default delimiters full-body height (or slightly shorter, with visual compensations of course), including /slash and /backslash (the two most commonly overlooked glyphs). Otherwise, formulae such as (a/b) and (p/q) in quick succession will look jarring.

    The next larger delimiter size is usually full-line height. Using 10pt Computer Modern Math and 10pt MathTime Professional 2 as examples (both designed to be set on 12pt leading), their /delimiters.size1 are 12pt tall. Normally, the next larger size covers 1.5 lines, so /delimiters.size2 are 18pt tall; then /delimiters.size3 are 24pt tall (2 lines); then /delimiters.size4 are 30pt tall (2.5 lines); and so on—growing in 6pt/half-line increment. This is not an absolute rule: Fira Math, for instance, has finer increment.

    Computer Modern Math delimiter sizeMathTime Professional 2 delimiter size
  • John Hudson
    John Hudson Posts: 3,227
    Making a math font seems to be quite an undertaking.
    It is, and also somewhat frustrating because the set of properties to be set and their interactions is not as complete or as intuitive as I think they should be.

    We had experience making the Cambria Math font for Microsoft, which had the benefit of being developed alongside the MS math handler. For that and for STIX Two, we used Microsoft’s math font editor, which is a stand-alone tool that directly writes the MATH table. I understand that FontForge has more integrated math font functionality, but have never tried it.

  • I noticed there are a lot of characters in the STIX-2 font at PUA positions. Is there some sort of agreement anywhere upon how to use the PUA in math fonts – or is this an individual solution? How does it work in practice? Are any of those characters considered candidates for official encoding?
  • John Hudson
    John Hudson Posts: 3,227
    edited April 2023
    The PUA mappings in STIX Two are backwards compatible with the earlier STIX fonts. I think they are basically arbitrary. Some of the glyphs with PUA encodings also have standard Unicode input as sequences of characters, e.g. slashes Greek caps:

    
      lookup ccmp_4 {
      # GSUB lookup 5, type 14 (Ligature)
        sub Alpha uni0338 by uniE2FC.nu;
        sub Beta uni0338 by uniE2FE.nu;
        sub Gamma uni0338 by uniE300.nu;
        sub Delta uni0338 by uniE302.nu;
        sub Epsilon uni0338 by uniE304.nu;
        sub Zeta uni0338 by uniE306.nu;
        sub Eta uni0338 by uniE308.nu;
        sub Theta uni0338 by uniE30A.nu;
        sub Iota uni0338 by uniE30C.nu;
        sub Kappa uni0338 by uniE30E.nu;
        sub Lambda uni0338 by uniE310.nu;
        sub Mu uni0338 by uniE312.nu;
        sub Nu uni0338 by uniE314.nu;
        sub Xi uni0338 by uniE316.nu;
        sub Omicron uni0338 by uniE318.nu;
        sub Pi uni0338 by uniE31A.nu;
        sub Rho uni0338 by uniE31C.nu;
        sub Sigma uni0338 by uniE31E.nu;
        sub Tau uni0338 by uniE320.nu;
        sub Upsilon uni0338 by uniE322.nu;
        sub Phi uni0338 by uniE324.nu;
        sub Chi uni0338 by uniE326.nu;
        sub Psi uni0338 by uniE328.nu;
        sub Omega uni0338 by uniE32A.nu;
        sub uni03DC uni0338 by uniE368.nu;
        sub uni03DE uni0338 by uniE36C.nu;
        sub uni03E0 uni0338 by uniE370.nu;
        sub uni03DA uni0338 by uniE364.nu;
      } ccmp_4;
    
    
    

  • The OpenType MATH table is a descendant of TeX’s math fontdimen’s, which in turn are detailed in Appendix G of The TeXbook (the source text is available online, but it is all text, no illustrations).

    For the visually creative crowd, there is Appendix G illuminated by B. Jackowski, which visually explains what the fontdimen’s are supposed to do.

    A follow-up paper OpenType math illuminated by U. Vieth covers the parameters of the MATH table.

  • Linus Romer
    Linus Romer Posts: 187
    I want to add two documents to Ruixi's very useful suggestions:


  • John Savard
    John Savard Posts: 1,135
    edited April 2023
    Yes, I actually looked a lot at STIX Two also. I only didn’t bring it up in the examples, because I was specifically looking for differences between math and text fonts.

    I know what you meant here.
    STIX Two is a math font, and most other fonts are text fonts, so the differences between math fonts and text fonts could be illustrated by comparing STIX Two to, say, Baskerville or Times Roman.
    Of course, what you meant was that you were examining math fonts and text fonts of the same typeface because that would make the specific differences between a math font and a text font easier to isolate, without other differences between the typefaces that had nothing to do with one of them being used for math also being present to confuse the issue. And even comparing STIX Two to somebody else's version of Times Roman, which it closely resembles, risked introducing extra differences.

    EDIT: Hold it. The Stix2Math.otf font is available alongside four weights of Stix2Text, so that can't be the issue here.

    Incidentally, I had a couple of double-takes on visiting the STIX pages. The first one was a silly error on my part: there was a reference to how some new mathematical symbols were discovered for Unicode 4.0 or thereabouts.
    Mathematical symbols, unlike mathematical theorems, are invented, not discovered! But, of course, just because some mathematician has published an obscure paper with a new symbol does not mean that the Unicode Consortium would necessarily know about it, so they could subsequently discover the existence of that invention.

    The other one was this statement:
    "As is well known, Times Roman was originally intended for printing the London Times."
    Ahem. That should have been:
    As is well known, Times Roman was originally intended for printing the Times of London.
    The New York Times is the New York Times, because that's what it says on the masthead. The newspaper published for the London market simply calls itself The Times on its masthead.
    Of course, if the site had simply said
    As is well known, Times Roman was originally intended for printing the London Times.
    I would have no grounds to quibble merely because the more common and conventional phrasing was avoided.