-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Broken vertical font alignment on Fedora #1209
Comments
Primer CSS currently uses this font-stack: css/src/support/variables/typography.scss Line 35 in 40d508d
Based on this comment it looks like Firefox on Fedora 33 does the following:
Hmm.. we might could also swap the order of Another option could be to not try to pick the right font for Linux and just let the OS/browser decide by removing both $body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !default; @nikwen How would |
@simurai I'd replace Helvetica with "Helvetica Neue", and try to be a little more specific with the available OS options before fallbacking to Arial/Liberation Sans. Reading a little bit through some of the options Linux users utilize got me to this list: $body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Inter", "Noto Sans", Cantarell, Roboto, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !default; |
Yeah, we could give that a try. Although I think the problem of this issue is that if @arzg suggested in #1219 to already add So the most "hands-off" font-stack that only tries to use "system" fonts might be: $body-font:
system-ui, // use default OS font
ui-sans-serif, // use default sans-serif OS font
sans-serif; // use fallback sans-serif font But for now I guess we'd still have to add a fallback of $body-font: -apple-system, Segoe UI, system-ui, ui-sans-serif, sans-serif; Anyways, might be worth doing:
|
Why prioritise |
AFAIK, Primer tries to stay as close to the default system font as possible. So I would say yes.
Yeah, if |
@simurai, @vdepizzol and @arzg, thank you so much for looking into this issue. ❤️ Sorry for being late. I'm trying to answer all questions now. From @simurai:
To test this, I set the following CSS on the
Note that I removed the In general, it looks a lot better already, but text is still not 100% centered. Have a look at buttons or the "Staff" badge, for example. The text is still 1 or 2 pixels away from being centered. Here's a screenshot: From @vdepizzol:
To test this, I set the following CSS on the
Note that I removed the Here's what that looks like: It's using the The Highlights section is broken and buttons and badges are sadly still a bit off. From @simurai:
Another suggestion, another screenshot. :) To test this, I set the following CSS on the
Here's the screenshot: It's using |
@nikwen Thanks for all the testing. 🙇 Hmm.. based this test, I would say
that uses /cc @vdepizzol any thoughts? |
@simurai Thanks for taking the time to look at this again!
|
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days. |
This is an attempt at fixing #1209. Further reading: - https://infinnie.github.io/blog/2017/systemui.html - https://blog.jim-nielsen.com/2020/system-fonts-on-the-web/
* Improve $body-font stack This is an attempt at fixing #1209. Further reading: - https://infinnie.github.io/blog/2017/systemui.html - https://blog.jim-nielsen.com/2020/system-fonts-on-the-web/ * pause stylelint complaints in documented stack * Create silent-geckos-do.md Co-authored-by: simurai <[email protected]>
Update: This issue still needs fixing. We tried with #1529, but that needed another change #1573 that caused other problems... so both PRs got reverted with #1592. Next stepsAn approach we might can try next is to put these font changes behind a feature flag and then enable it only for certain users that would like to beta test it (Linux, Windows, Japanese, Chinese etc.). Once we find a good font stack that works for most, we can ship it to production to all users. |
This also seems to affect the display of alerts on https://primer.style/css/components/alerts#with-icon : |
Actually it is also misaligned on Windows with latest Firefox. Not sure if those alignment problems are solely related to Fedora |
Same goes for the caret icons in the topbar of https://primer.style/design/ (top is linux, bottom is windows): I am not sure if those are the "same" issue as this one, so please let me know if I should report those somewhere else. |
This mundane bug report has consumed me... been digging into this all afternoon. There's a fixed version of the Nimbus font available here https://github.com/scriptableorg/NimbusSans
Nimbus (presumably the broken version) is in a few of the Fedora packages, as well as the Firefox uses The core problem is that I think this issue ultimately rests with |
I can confirm that github looks massively better with the fixes suggested in https://nolanlawson.com/2020/05/02/customizing-fonts-in-firefox-on-linux/ 👍 |
@simurai Given that FireFox has fixed
Is there any plans to reintroduce |
It has been a year since we tried last time, but so far it's still in the backlog. Personally, I like this suggestion. So we would use The only caveat with that is that users that have no GitHub account and are just browsing without logging in don't have an option to change the font. So we still have to somewhat be sure that |
It is ok in most (modern) cases. I'm looking forward to GitHub reintroducing |
New short term idea from @vdepizzol: Add So the font stack would be: font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; Let us know in case anyone already wants to test above font stack. 🙇 PR -> #2300 |
Update: @nikwen Let us know if that improved the alignment issues you were seeing. 🙇 |
Thank you, @simurai! I switched from Fedora to macOS a while ago, but I'm sure someone else can test your changes. |
Let's close this for now. Further improvements that could be done:
|
Describe the bug
Text is not properly vertically centered when using Firefox on Fedora 33.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The text marked in the screenshot below should be properly vertically centered.
Screenshots
Desktop (please complete the following information):
Additional context
Fedora does not ship the
Helvetica
andArial
fonts used by Primer.Firefox on Fedora uses
Nimbus Sans
as a replacement forHelvetica
:If we remove
Helvetica
from the font declaration, the system usesLiberation Sans
, which looks okay-ish:The text was updated successfully, but these errors were encountered: