mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-15 20:09:18 -05:00
Use system-native font stack #5520
Closed
opened 2025-11-02 06:27:38 -06:00 by GiteaMirror
·
11 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16.0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3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#5520
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @silverwind on GitHub (Jun 9, 2020).
Webfonts in general bring the issue that the page can not render completely without the font download finishing, which gives us one of the following issues:
font-display: blockand default behaviour in most browsers)font-display: swap)Both are bad in their own ways and I think we should eliminate all web fonts and just use a sytem-native font stack. This would match us with GitHub and GitLab which both also use native font stacks and do not rely on any web fonts.
GitHub has:
GitLab has:
@mrsdizzie commented on GitHub (Jun 21, 2020):
Could we do this now that 1.12 is released?
@silverwind commented on GitHub (Jun 21, 2020):
Yes, I plan to rework fonts. The only possible remaining font should be the emoji fallback, but it's kind of questionable benefit as it only really supports Chrome on Linux (Other OS do ship emoji fonts and Firefox can't parse the ttf file because a bug on their end last I checked).
@andreymal commented on GitHub (Jul 13, 2020):
This is NOT system-native!
I have Segoe UI installed on my Arch Linux, but my system-native font is actually Ubuntu. This CSS will override system configuration and use Segoe UI instead of real system-native font.
The real system-native font stack will be enabled only if you will use
font-family: sans-serif.Also, issues mentioned here are relevant only at the first visit to website while the webfonts are not yet cached, so this is very minor and it would be best to get the Lato font back.
Also×2, "system-native" fonts often break website designs, so I don’t understand this hype. All websites that switched to "system-native" fonts began to look worse and less consistent for me.
P.S.
font-family: system-uiis not yet working in Firefox, and this still overrides browser-level configuration in Chrome@silverwind commented on GitHub (Jul 13, 2020):
Those font stacks are quite intricate. What is the "native" sans-serif font of Ubuntu? I'm happy to put it before Segeo UI as it's like never present on Windows. Also, you're seeing Segeo UI on GitHub, right?
It's certainly an issue in some browsers (Firefox) that flash a different font on every page load and then replace it with the webfont, even if that webfont is in the cache. Also, system fonts are highly likely to contain many more language glyphs which can not be said from webfonts.
@andreymal commented on GitHub (Jul 13, 2020):
It is a font I selected in settings of my desktop environment or in browser settings (every browser allows to configure fonts). It can be any font.
Yes
It seems this is the only real reason to use "system-native" fonts (okay, probably I got excited with "would be best to get the Lato font back" :).
Although this
font-familyis still not system-native, as I said earlier@silverwind commented on GitHub (Jul 13, 2020):
I'm certainly not against trying to utilize system's
sans-serifbut I guess there must be a reason why most recommendations have it last.@zeripath commented on GitHub (Jul 13, 2020):
@andreymal I have the same problem - I also have Segoe UI installed due to having to deal with dozers but Gitea is not unique in this Github also forces Segoe UI above
sans-serif.I've also noticed that DeJa Vu Mono has a number of emoji glyphs which are non-colored and can prevent colored emoji from appearing, e.g.
☺ and ✍. There are other issues with DeJa Vu Sans's Emoji but I think we may have solved them already@silverwind commented on GitHub (Jul 14, 2020):
I guess we could certainly tweak the font stack to prefer Ubuntu's default font over Segeo UI.
@CL-Jeremy commented on GitHub (Jul 25, 2020):
Apart from that, I believe the semantics behind
system-uiis really to ignore browser settings. I use Manjaro quite often (alongside macOS 10.10/10.15) and have tuned the OS to use a custom font stack withfontconfig, which the browser happily matches withsystem-ui. Both Chromium and Firefox pick up those fonts properly (though for some reason, Firefox chooses to use Yu Gothic UI by whatever criteria it presumes unless I removesystem-uifrom the stack, which makes it use my in-browser settings to matchsans-serif).And the quirks don’t end there. On macOS, all browsers, with the sole exception of Safari, matches
sans-serifto one of the two traditional Chinese system fonts (PingFang HK/TC, for Hong Kong and Taiwan respectively) which I defined initially during the introduction of CJK:lang-specific font stacks. I’m not gonna bomb this thread with screenshots, but my Chromium chooses Taiwan and my Firefox favors Hong Kong (my OS is in German, so I believe it depends on the language preference stack configured in the OS, which originated from macOS but has spread to various OSes lately). This was not a problem up to 1.11.x, wheresans-serifwas still in the last place of the font stack.I really take #11045 as a good chance to have these little problems solved altogether. I agree the definition “system-native” is debatable, but please bear in mind that most OSes do not give users much freedom to fiddle with the UI (since they’ve spent remarkable amount of time and budget to factory tweak them) and moreover, most users aren’t gonna prefer customization over usability for a tool like this. I myself am still using Lato though (and thus much appreciate the idea to use CSS variables, which I first noticed in Nextcloud, also switched to a native font stack not long ago).
Edit: sorry, wrong issue reference!
@silverwind commented on GitHub (Jul 25, 2020):
I wonder if it'd be possible to remove all the explicit fonts and user either
system-uiorsans-serif. They both seem to essentially do the same thing to me but I guesssystem-uiuses more "modern" font choices than the traditionalsans-serif. Certainly worth experimenting once all browsers support it (waiting on Firefox).@CL-Jeremy commented on GitHub (Jul 25, 2020):
Well, even if, say, Firefox manages to fix this bug in a few months, it’ll still take much longer for users to upgrade (actually, I myself am using a legacy XUL-based Firefox fork on some legacy systems, which is of course much more modern than IE 11, for which the support hasn’t officially been dropped yet).
Again, the semantics are different.
system-uidoes not really presume display of “content”, but rather “near native web interface elements”. By contrast,sans-serif, in the long history of WWW, has always presumed itself being used for some kind of “content”, starting with plain text blocks in an non-stylized static document, where IMHO the browser’s settings have been, and still should be used for. Its usage as a last resort in most occasions relies on the fact that either the user or the OS is providing this fail-safe solution so as to at least make the valuable content of the web page comprehensible (thus the ability to display the theoretically maximum number of characters the OS is, by default, capable of displaying).What this means is, whenever
sans-serifis used, the fallback stack is completely controlled by the OS itself (that is, if the browser doesn’t “misbehave” as per my example of Chromium and Firefox making different choices for the exact same fallback stack). Examples for this in the Chinese context is the use of highly uncommon characters, such as certain Hong Kong-specific dialectical supplements, supplementary character variants and technical neologisms (such as newly discovered elements), which could result in visual discrepancy even in the same typeface. As long assans-serifis used (in this case it doesn’t matter if it’ssans-serif,seriformonospace, the OS could only choose SimSun, which is a serif font), it would shadow whatever font that comes later in the stack, even emojis.And even with
system-ui, there are corner cases where explicit choices are much more favorable. The other example I have given above showsYu Gothic UI, the Windows 8.1 replacement ofMeiryo UIfor native UI elements in Japanese. This is by far the most utilitarian Modern typeface one may encounter, as it basically copied all the narrowed-down kanas fromMeiryo UIin order to keep the original UI designs pixel-perfect. If by any chance the browser picks up this font in any occation, it should be regarded as a mistake (in thesystem-uiexample above, a bug). In the current font stack I have specifically chosenYu Gothicfor its visual friendliness at higher resolutions (in contrast to Meiryo, which was mainly designed to be used at lower resolutions, accompanied by ClearType). This particular font could (and IMHO should) also be leveraged on older OSes if Office is installed or a specific optional supplementary update from Microsoft is applied.So much on this topic, and sorry for the long passages. I just hope to be able to help a bit by expressing my concerns on the complexity of this task.