Skip to content

Css: Update font stack - #8632

Merged
faho merged 4 commits into
fish-shell:masterfrom
faho:fonts
Jan 13, 2022
Merged

faho merged 4 commits into
fish-shell:masterfrom
faho:fonts

Conversation

@faho

@faho faho commented Jan 12, 2022 •

Copy link
Copy Markdown
Member

Description

Unfortunately, the "monospace" and "sans-serif" font families are basically broken. The browser defaults have ossified, e.g. Firefox and Edge on Windows still default to Arial. (this situation, for the record, is horrible)

So, instead we try to use the "system-ui" font. Unfortunately there's a few caveats here:

  1. Windows picks a different font depending on locale, and if the locale isn't latin-based it might not be good for latin text. So we prefer "Segoe UI", the latin windows font.
  2. For monospace fonts there is "ui-monospace", but that's only supported in Safari, so we still need to give fonts that systems may use by default.

Screenshots

(in Firefox on Linux)

Before

Screenshot 2022-01-12 at 17-38-03 Fish for bash users — fish-shell 3 3 1-885-gb1ec8af5e documentation

After

Screenshot 2022-01-12 at 19-57-24 Fish for bash users — fish-shell 3 3 1-885-gb1ec8af5e documentation

Note also how there's a colored background behind the inline-code blocks. This is also in light mode, and allows distinguishing the two even if the fonts are similar (like here).

@zanchey If you are comfortable with this I would like it for 3.4.

I do not believe this should ever make anything worse. Technically it's possible you'd get e.g. Segoe on linux, but Segoe is an okay font, and very very likely nicer than what "sans-serif" would pick for you.

faho added 3 commits January 12, 2022 17:19
This was for <code> tags, which we don't have here. The rest is
already all monospace and Source Code Pro has bugs on macOS.
Unfortunately the normal font families like "sans-serif" and
"monospace" are basically broken because the browser defaults are
decades old.

TODO: Inline code is barely distinguishable.
This allows it to be distinguished not just based on the font.

Not adding a border because that's a bit much.
@faho faho added enhancement docs An issue/PR that touches or should touch the docs labels Jan 12, 2022

@zanchey zanchey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.

@faho

faho commented Jan 13, 2022

Copy link
Copy Markdown
Member Author

Okay, Windows now picks Segoe UI and Consolas, it used to pick Arial/Courier New in Firefox and Arial/Consolas in Edge.

On Arch I'm not sure what it picks for the proportional font, possibly Nimbus Sans (that's what fc-match tells me for my default). I have no idea how to figure out what "system-ui" resolves to.

On KDE it'll now pick Hack for monospace (and possibly Noto Sans typically for proportional? it's unclear), on macOS San Francisco, on Ubuntu Ubuntu and on Gnome Cantrell and probably Noto Sans Mono (because we can't list Source Code Pro).

At worst it'll pick an unfamiliar but acceptable font or fall back on sans-serif/monospace. This is better than picking Arial and some bad monospace font in most cases.

The downside is that this is no longer user-configurable. That's an unfortunately necessary trade-off because the defaults are horrible.

@faho

faho commented Jan 13, 2022

Copy link
Copy Markdown
Member Author

I would appreciate testing on macOS given that I've eschewed listing "BlinkMacSystemFont" and "-apple-system" under the belief that all browsers there now support system-ui.

@zanchey zanchey added this to the fish 3.4.0 milestone Jan 13, 2022
@zanchey

zanchey commented Jan 13, 2022

Copy link
Copy Markdown
Member

macOS 12.1:

Chrome
Screen Shot 2022-01-13 at 21 22 09

Firefox
Screen Shot 2022-01-13 at 21 22 33

Safari
Screen Shot 2022-01-13 at 21 22 43

@faho

faho commented Jan 13, 2022

Copy link
Copy Markdown
Member Author

Okay, I just tried picking Cascadia Code (the Windows Terminal default font), and our comment/output styles are italic, so it's awkward. They've improved the italic version so it's not unreadable to non-americans anymore, but it's still very different from normal. So I won't be adding it here.

Other than that, this seems to give okay results everywhere, so I'm merging!

@faho
faho merged commit 9220b96 into fish-shell:master Jan 13, 2022
faho added a commit to fish-shell/fish-site that referenced this pull request Jan 13, 2022
@faho
faho deleted the fonts branch January 17, 2022 07:34
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

docs An issue/PR that touches or should touch the docs enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants