Skip to content

Ship a math font, and the stylesheet per page #3

Description

@luiswirth

Typst's MathML uses Plane 1 math alphanumerics (f comes out as U+1D453),
and browser fallback for those is unreliable, so a math font has to ship.

typst fonts --ignore-system-fonts shows what the library already embeds:
New Computer Modern, New Computer Modern Math, Libertinus Serif, DejaVu Sans Mono.
NewCM Sans and NewCM Sans Math are not embedded and ship with typstdoc, subsetted.

Which font a page uses is CSS and belongs under [package.metadata.typstdoc].
Compiling the same equation under two different math fonts gives byte-identical MathML,
so the choice cannot travel through the Typst source.

rustdoc's own implementation (rust-lang/rust#156032)
ships a subsetted Noto Sans Math woff2 with mathml.css,
and links both only from pages that contain math.
Do the same, driven by the assets a fragment reports.

Typst emits its own stylesheet for equations.
Diff it against rustdoc's mathml.css rather than writing a third one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions