Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathJax-Fonts repository private #973

Open
jacobp100 opened this issue Jul 17, 2023 · 7 comments
Open

MathJax-Fonts repository private #973

jacobp100 opened this issue Jul 17, 2023 · 7 comments

Comments

@jacobp100
Copy link

I'm not sure if this is intentional, but all the fonts put their repo as mathjax/MathJax-Fonts, which is either hidden, or the wrong repository

@dpvc
Copy link
Member

dpvc commented Jul 19, 2023

The MathJax-Fonts repository will be made public after the v4.0.0 official release. It is not currently in shape to be made available, as the structure is changing, the tools it relies on are not yet public, and it will need to be split up a bit before it is ready for public consumption. The npm packages include all the files needed to use the fonts, and the source code for producing them, but the tools for creating them are not yet available. We are working as fast as we can to get v4.0 and its font tools out, but can only move as fast as we can.

@jacobp100
Copy link
Author

I know for MathJax 3 and below the Computer Modern font had altered glyphs from the original. Is that still the case for MathJax 4 and the newly supported fonts?

@dpvc
Copy link
Member

dpvc commented Jul 19, 2023

I'm not sure I understand the question. The v3 MathJax TeX font was based on Computer Modern and used mftrace to produce OTF versions of the original CM bitmap fonts. These were then moves to their correct unicode positions, and font forge was used to combine multiple glyphs that TeX uses to make a single character into a single glyph in the MathJax TeX fonts. For example, \longrightarrow in TeX is formed by a minus sign followed by \rightarrow (with some kerning to get the ends to overlap a little). In the MathJax TeX font, those two character a pre-combined in the unicode position for the long right arrow. I'm not sure off that is the "altered glyphs" you are talking about. MathJax also mapped some unicode positions for which it didn't have an exact character to some other positions where a similar character existed. That was not always perfect.

The MathJax TeX font is still available in v4 (as mathjax-tex), but the new default font is mathjax-modern, which is based on the Latin Modern TeX fonts, which in turn were an offshoot of the Computer Modern font, so they have the same look, but much greater glyph coverage. These fonts already come in OTF format, so there is no need for the ancient mftrace approach that we did back in 2008 to get the original MathJax TeX fonts. The outlines are better as they are the original designs, not traced bitmaps.

I hope that answers your question.

@jacobp100
Copy link
Author

Am I correct in thinking the MathJax font glyphs were thicker than the Computer Modern glyphs?

@dpvc
Copy link
Member

dpvc commented Jul 19, 2023

Am I correct in thinking the MathJax font glyphs were thicker than the Computer Modern glyphs?

Well, yes and no. When the computer modern fonts were designed, TeX used bitmap fonts, and a different set of bitmaps were produced for each output device that you might use. The creation of those bitmaps were controlled by parameters to the metafont program that created the bitmaps, and those parameters were specific to the output device. The various thicknesses were set based on the needs of the output device and its resolution. For example, the parameters for a 300dpi laser printer with a write-white engine would be different from a 1200dpi laser printer with a write-black engine. There where hundreds of parameter definitions for different printers that were tweaked to work best for each printer's capabilities. You can still see these in an actual TeX distribution in the fonts/source/public/modes/modes.mf file.

What that means is that there is no standard thickness for the font, at least not originally, as each output device had its own version of the fonts. Later, OTF versions were created, but they represented only one of the infinitely many possible version of the Computer Modern fonts. When we created the MathJax TeX fonts, we needed them to work well on relatively low-resolution screens (low compared to printed output), and so very thin pen strokes in metafont might not reproduce well on screen. There was also the issue of different rendering engines for different operating systems, which produced different results for the same fonts: Windows produces thinner-looking results than MacOS does. In order to try to match the surrounding fonts better, MacOS fonts would want to be a bit thicker, whereas Windows fonts would want to be a bit thinner. We compromised by taking a value in between the best results for the Mac and the best results for Windows, which means on windows they looked a bit thicker than one might prefer, and on the Mac a bit thinner than optimal.

The upshot is, we chose metafont parameters that would be a bit heavy for TeX fonts that are intended for print, but that would work well on screen in most sizes and situations. Today's screen are higher resolution, so you could get away with a less heavy font, and the mathjax-modern font is thinner than the original mathjax-tex font. Whether that is "thicker than the Computer Modern fonts" is not clear, because there was no standard thickness — it all depended on the output device in use.

@hurshore
Copy link

hurshore commented Feb 5, 2024

@dpvc Is it possible to increase the thickness of the mathjax-modern font?

@dpvc
Copy link
Member

dpvc commented Feb 6, 2024

@hurshore, for CommonHTML output, the mathjax-modern fonts use the Latin Modern glyphs from their OTF fonts, and those have specific paths that produce the fonts at one thickness. There are not parameters like metafont uses to control the thickness, and so that can't be changed.

For SVG output, which has converted the font outlines to SVG paths that are stroked and filled by the SVG renderer, it is possible to change the stroke width in order to get a thicker outline (and so a bolder look), though this is a hack that can interfere with the quality of the font if you make it too thick.

MathJax v4 allows you to alter that thickness by setting the blacker value in the svg block of your MathJax configuration. This is set to a number that represents the thickness of the outline use for the fonts, in units of 1/1000 of an em. The default is 3, but you could use a value like 15 to make it thicker without disrupting the font too much.

You could also specify the old mathjax-tex font, which is at its original thickness, though the glyph coverage is not as great as for mathjax-modern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants