fix: put all kinds of system monospace fonts before Courier New #114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are multiple issues about Courier New being awful-looking on Linux:
Courier New is only readable under Windows because ClearType made a special case for it.
Therefore, it should never be one's first choice for monospace font. It should be put at the end of the list.
By the way, though Courier New is a proprietary font, it is available on Linux through Microsoft's Core Fonts for the Web. That's why Linux users might see it.
In this PR I propose we set the monospace font stack to:
This puts all kinds of system monospace fonts before Courier New, with some personal preference.
ui-monospace
is part of the CSS Fonts Module Level 4, and only available in Safari for now. The difference between it andmonospace
is thatui-monospace
aims to match the user's system monospace font, whilemonospace
is a generic monospace font that's defined by the browser. So it's better to put it first. It currently defaults to "SF Mono" on macOS.SFMono-Regular
is a hack before Apple made "SF Mono" available everywhere (It was only bundled with Xcode and Terminal on first launch).I intentionally left out a few system monospace fonts:
As a reference:
GitHub's default:
Tailwind 3.4.13:
StackExchange's design refresh in 2021:
https://meta.stackexchange.com/questions/364048/we-are-switching-to-system-fonts-on-may-10-2021