Skip to content

Bugfix: MathJax fonts - #574

Open
Daria-E wants to merge 3 commits into
schuyler:mainfrom
Daria-E:claude/mathjax-tex-fonts-28a634d6-010f-49a9-9bbe-fd6b2f279bf5
Open

Bugfix: MathJax fonts#574
Daria-E wants to merge 3 commits into
schuyler:mainfrom
Daria-E:claude/mathjax-tex-fonts-28a634d6-010f-49a9-9bbe-fd6b2f279bf5

Conversation

@Daria-E

@Daria-E Daria-E commented Aug 15, 2026

Copy link
Copy Markdown

The HTML-CSS output jax prefers fonts installed on the machine over MathJax's own, and its default availableFonts list names STIX. macOS ships STIX 1.x as system-reserved faces that WebKit resolves by name, so the preview selects them and typesets digits and operators in STIXGeneral-Regular, a Times-metric face indistinguishable from body text while identifiers still read as math italic. Browsers that do not enumerate those faces, such as Firefox, load MathJax's TeX fonts and render the same document correctly.

An empty availableFonts list declines local fonts. preferredFont is nulled alongside it because MathJax tests the preferred font even when it is absent from availableFonts, so the list alone still takes the local path on a machine carrying MathJax's own TeX fonts.

MathJax resolves its configuration, jax and fonts against the script element's own src, so script-src and font-src both derive their source expression from that URL rather than repeating the origin. Without the font-src entry the faces are blocked, and the output jax stalls for its web-font timeout before falling back to bitmap image fonts.

The HTML-CSS output jax prefers fonts installed on the machine over
MathJax's own, and its default availableFonts list names STIX. macOS
ships STIX 1.x as system-reserved faces that WebKit resolves by name, so
the preview selects them and typesets digits and operators in
STIXGeneral-Regular, a Times-metric face indistinguishable from body
text while identifiers still read as math italic. Browsers that do not
enumerate those faces, such as Firefox, load MathJax's TeX fonts and
render the same document correctly.

An empty availableFonts list declines local fonts. preferredFont is
nulled alongside it because MathJax tests the preferred font even when
it is absent from availableFonts, so the list alone still takes the
local path on a machine carrying MathJax's own TeX fonts.

MathJax resolves its configuration, jax and fonts against the script
element's own src, so script-src and font-src both derive their source
expression from that URL rather than repeating the origin. Without the
font-src entry the faces are blocked, and the output jax stalls for its
web-font timeout before falling back to bitmap image fonts.
@Daria-E Daria-E changed the title Typeset preview math in MathJax's TeX faces Bugfix: MathJax fonts Aug 16, 2026
The HTML-CSS output jax renders in vector web fonts, but with the fonts
fetched from the CDN at render time the preview falls back to bitmap image
fonts — pixelated on zoom — whenever that fetch times out. The 22 TeX woff
faces now ship in Resources/MathJax/fonts/HTML-CSS/TeX/woff/, and the
preview's resource-load delegate serves any bundled MathJax resource from
file: (the loader was already served this way; the fonts join it). Fonts
load synchronously, so the web-font timeout that triggers the image
fallback never fires. Resources that are not bundled — config, jax.js,
fontdata.js — still load from the CDN.

kMPMathJaxCDN gains external linkage so the delegate can scope the redirect
to the loader's origin.

MPMathJaxLocalFontsTests pins the redirect (woff to the bundle without a
query, un-bundled resources passing through, the loader keeping its config
query) and the presence of the full TeX woff set.
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

Successfully merging this pull request may close these issues.

1 participant