matrix-org / matrix-spec

The Matrix protocol specification
Apache License 2.0
197 stars 97 forks source link

Use dedicated fonts for better support of mathematical symbols #1919

Closed Johennes closed 3 months ago

Johennes commented 3 months ago

Fixes: #1125

This injects various fonts before Arial (which has limited support for mathematical symbols):

This is how it looks on macOS Sonoma:

Screenshot 2024-08-19 at 13 31 27

Alternatives

The only other alternative I considered was using the n-ary union and intersection symbols ⋃ and ⋂. Those wouldn't require any font changes but are way bigger which might look even worse:

Screenshot 2024-08-07 at 15 23 39

Pull Request Checklist

Preview: https://pr1919--matrix-spec-previews.netlify.app

anoadragon453 commented 3 months ago

This is what I see on the netlify preview of this PR on my browser FYI (Firefox stable, NixOS Linux):

image

richvdh commented 3 months ago

Yeah, this doesn't help for me here on Linux, and I don't have Noto either.

How about "DejaVu Sans" (which is what my browser falls back to for the ∪, and looks fine, as long as we don't use Arial for ∩). Don't know how widely supported that is though.

richvdh commented 3 months ago

Oh wait, I do have Noto Sans. But Firefox is refusing to render the ∪ and ∩ glyphs in it and still falling back to a mix of Arial and DejaVu Sans.

Johennes commented 3 months ago

Oh wait, I do have Noto Sans. But Firefox is refusing to render the ∪ and ∩ glyphs in it and still falling back to a mix of Arial and DejaVu Sans.

That might possibly be due to anti-fingerprinting settings in Firefox. 🤔

anoadragon453 commented 3 months ago

Oh wait, I do have Noto Sans. But Firefox is refusing to render the ∪ and ∩ glyphs in it and still falling back to a mix of Arial and DejaVu Sans.

Do you have "Noto Sans Math"?

Johennes commented 3 months ago

I've updated the PR to use different fonts to cover more platforms. See the issue description for more info. I've tested this on macOS Sonoma and Fedora 40 where things look good.

anoadragon453 commented 3 months ago

Looks marginally improved from NixOS (font weights on each symbol now match). My browser has ended up using DejaVu Sans.

Before:

image

After:

Screenshot from 2024-08-19 13-02-38