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

Feature request: variable fonts (-> fewer files, smaller byte size, customisable) #3880

Open
pacien opened this issue Oct 21, 2023 · 1 comment

Comments

@pacien
Copy link

pacien commented Oct 21, 2023

Is your feature request related to a problem? Please describe.

Currently, KaTeX relies on many font files for each variant (about
{AMS, Caligraphic, Fraktur, Main, Math, SansSerif, Script, Typewriter, Size1, .., Size4}
× {upright, italic} × {regular, bold}).

This amounts to about 350KB of font files for a each format.
This is quite a heavy to load,
as well as causing many requests,
causing multiple repaints and flickering on page load.
(This even if the math is pre-rendered).

Furthermore, customising the font weight or amount of slant for example
requires rebuilding the whole font set.

Describe the solution you'd like:

Using a variable font would resolve both issues
by having a single font file
defining the variants and being customisable through CSS.

At the time of writing, this is fairly well supported (96% browser coverage):
https://caniuse.com/variable-fonts

See also:
https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts

@edemaine
Copy link
Member

edemaine commented Oct 22, 2023

I don't think combining the existing fonts into one font will make them smaller. But plausibly there are some variable fonts that support e.g. roman and bold math from a common source, which could halve the size. But I don't know whether any such variable fonts exist yet, with all of LaTeX's mathematical symbols... Do you know one?

@edemaine edemaine added the fonts label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants