Closed litherum closed 2 years ago
What would be the authoring use case for this? When would you use system-ui-serif
instead of serif
?
The whole purpose of the generic font keywords is that the results are suited to the system & the user choices. If a new version of Safari wants to update which fonts the generic keywords map to by default, go right ahead. But I don't see a reason to keep serif
and monospace
as user-customizable fonts, but then offer authors a way to ignore the user preferences & get the system defaults instead.
The fact that these fonts don't have an exposed family name is an implementation detail on MacOS/iOS. If there are technical reasons for that, but you still want them available to web content, I think it's appropriate to continue to use prefixed keywords for them.
(I personally don't understand branding logic behind the "don't let people use them in documents, but do let websites use them" argument, but 🤷♀ …lawyers. )
I don't know if Windows has any analogues with Segoe UI.
Segoe is a super-family on Windows 10, but it doesn't have monospaced or serif version: it has handwriting versions. Segoe Print is the modern alternative to Comic Sans.
While we're on the topic: Segoe UI looks absolutely horrible when rendered without ClearType hinting (at least, I think that's why it sometimes looks awful). I really hate that we're encouraging developers to use system-ui
in order to get San Francisco on Apple devices, instead of thinking carefully about their font stack in a cross-browser way.
How are New York, SF Mono and SF Rounded used in Appleʼs UIs? Are they the only fonts used in the UIs? Are they the only ones hidden for corporate identity purposes? Are the latter two fonts proper parts of the SF / San Francisco (super) family?
CSS generic font keywords were never well designed (especially i18n-wise), but (at least without further information) I donʼt think this proposal improves anything about that.
When would you use system-ui-serif instead of serif?
When you wanted New York instead of Times. Times has been baked into the Web Platform for so long, we effectively can’t change the serif - Times mapping.
We also don’t want to automatically opt a bunch of websites into using New York because it is intended to be used selectively in new content. It isn’t a document font that is supposed to be used everywhere.
Times has been baked into the Web Platform for so long, we effectively can’t change the serif - Times mapping.
There is nothing baked-in about using Times and Arial for serif
and sans-serif
. Other browsers let the end user change the mappings. I use Georgia and Tahoma. For monospace
, even the default mapping varies by browser/OS.
Any website that is using the generic font family keywords is accepting that the appearance will vary by browser & OS & user preferences. If an author really wanted Times, it's easy for them to say so.
That said, if Apple for branding purposes doesn't want the new fonts to ever be the default font used in web content, that's fine. As I said before, this is one case where I think it's fine to keep using CSS prefixes, since this (fonts that you can't access by a normal name) is a feature that has no equivalent in other OS.
@AmeliaBR I think your objection has three core elements. I'll try to restate it, and please let me know if I got anything wrong. I'll use the system-ui-serif
example, but this could apply to all of these:
Objection: Introducing system-ui-serif
to mean the system serif font (where that is defined and is not Times) is unnecessary, because the browser could just change the meaning of serif
to be, say "New York" on Apple platforms.
Objection: system-ui-serif
is redundant with serif
, because they don't have meaningfully distinct use cases for authors.
Objection: Introducing new symbolic font names is sad, because the old names like serif
allow customization in many browsers, but system-ui
and its possible future friends do not.
Let me know if I missed a key part of your objections.
Now, addressing these in turn:
Response: In practice, browsers can't change the default meaning of serif
. Nearly all browsers map it to Times by default, and some web content has come to depend on this. The default Times mapping is necessary for web compatibility, at the very least for desktop web content. It's true that the user could customize it, and some website may subvert author intent or outright break if the user does that.
Response: system-ui-serif
has a distinct use case from serif
for authors. It means: give me a serif font that matches the system UI appearance, because I'd like this web content to blend in with the system look. On the other hand, serif
, depending on author expertise, means one of "give me a serif font, I don't care which" or "give me Times, that's what I see on my system so that's what users will get". Neither of these is the same as "match the system standard serif font". In reality, the alternative to system-ui-serif
for its intended use case is a long fallback list of the known system serif fonts, carefully ordered to avoid the wrong one appearing on the wrong system.
Response: Customizability can be valuable. On some systems, the system fonts are customizable. It would make sense for the system-ui
family of symbolic font names to follow system customization, rather than browser-only customization. But, in any case, authors already have access to requesting specific fonts by name, in such cases, the font is not customizable at all. In the absence of system-ui-serif
and the like, websites would have to specify fallback lists of exact fonts to get the same effect. And that isn't customizable even in theory, or at the system level.
I'll add that none of this depends on the fact that the fonts aren't normally accessible by name. That makes the use case more urgent for some, but the use case is not really satisfied by specifying exact font names.
Thank you for the detailed response, @othermaciej. Yes, you summarized my concerns fairly. But I remain unconvinced.
I still don't see an authoring use case for "match the system standard serif font" because most systems don't have standard serif (or rounded or monospace) fonts. @litherum's proposal states that there is an authoring demand to access these particular new fonts on Apple devices. But that's different from the argument for system-ui
, which was that many major websites were crafting font stacks designed to match the standard system font for each OS.
I'd also be curious to see any evidence of web incompatibility for changing the Times/Arial defaults — just because something would change doesn't mean it would be incompatible. And if changing the generics is incompatible for a given website, then that website is probably already broken for many users. If there is a web compability reason to map the generic font names to specific fonts, we should put that in the spec.
Evidence of WebGPU incompatibility
In the WebKit source, we spoof the metrics of Times to match Windows’s metrics. We did this for web compat. Asking for Times by name is relatively rare compared to asking for serif and expecting Times.
Another piece of this issue that I forgot to include in the original post is the fact that the macOS and iOS APIs that access these fonts do it by token, not by name. Nowhere in source code do you ever say “New York” to get New York in a native app. Instead, you ask for “the serif design of the system font.” The mapping of system-ui-serif -> New York may change in the future. So, asking for New York by name isn’t expected to be stable over time.
I still don't see an authoring use case for "match the system standard serif font" because most systems don't have standard serif (or rounded or monospace) fonts.
Rounded appears unique to Apple platforms. But system serif and monospace system fonts seem to exist on at least Android, iOS/iPadOS and macOS. According to statcounter, these operating systems account for 59.56% of global browsing use share. That seems like a significant enough share that it would be valuable
So far, we've not exposed these fonts to the web at all, and we'd be very reluctant to expose them to the open web as symbolic names with a -apple or -webkit prefix. That would leave other platforms out in the cold (either with existing serif/mono system fonts, or if they add them in the future) and would lead to authoring of Apple-platform-specific CSS, which we would prefer not to encourage further. Right now they are only exposed in specific native apps that opt in. We'd prefer websites and web apps to have access to this functionality as well, if a suitable syntax is accepted as standards-track
How are existing font
keywords caption
, icon
, menu
, message-box
, small-caption
, status-bar
not suitable to access these fonts?
System fonts can only be set as a whole; that is, the font family, size, weight, style, etc. are all set at the same time. These values can then be altered individually if desired.
I support the proposal.
IIUC @AmeliaBR's points apply not only to this proposal but also to the original system-ui
. At that point, we understood two different web author's voices:
We resolved generic families to serve for 1, while system-ui
to serve for 2. When certain number of web authors wanted to create app-looking pages, adding system-ui
had a clear benefits over hard-coding system font names of all major operating systems in their CSS.
Because the motivation for system-ui
is to give the same capability as applications to the web, when applications got new capabilities, I think it's natural and necessary to allow the web to use them.
Aren't system font's the mechanism for (2)? What's the status of that in other browsers?
In Gecko, you can do font: message-box
or font: caption
for example to get a font that looks like your system's. It seems like Blink and WebKit also support these.
Not particularly opposed to the proposal, but want to understand how it compares to them. These look more like system fonts than font family names per se. But I guess since they don't convey the size and such that a system font would have it's ok to make them just generic family names?
font: message-box
orfont: caption
for example
Yep, these get you San Francisco in WebKit on macOS and iOS. None of the existing font
or font-family
keywords get you New York, SF Mono, or SF Rounded. And, because these fonts aren't exposed to the system as regular fonts available in pickers, there is currently nothing you can type in CSS that will give you access to them. system-ui-serif
, system-ui-monospaced
, and system-ui-rounded
would be the only way to access these fonts.
How are existing
font
keywordscaption
,icon
,menu
,message-box
,small-caption
,status-bar
not suitable to access these fonts?System fonts can only be set as a whole; that is, the font family, size, weight, style, etc. are all set at the same time. These values can then be altered individually if desired.
Two reasons:
None of those necessarily correspond to "the system serif font" or "the system monospace font". On operating systems I am familiar with, none of those are set in serif or monospace.
The system serif and monospace fonts (just like the regular system font) do not necessarily have an implied size, weight or style; they are used in different sizes, weights or styles in different contexts.
This particular set of keywords is also somewhat old-fashioned in that it maps to desktop-style mouse plus overlapping window UIs, but not to modern mobile-style touch-based UIs.
But I guess since they don't convey the size and such that a system font would have it's ok to make them just generic family names?
This is exactly the reason these are proposed as symbolic family names instead of special font keywords (as with system-ui
).
Aren't system font's the mechanism for (2)?
Yes, that's s what I meant.
What's the status of that in other browser?
Blink added it a few years ago given web authors' requests, and app-looking sites (eg github) started using it.
If the use case is to adaptively mimic the OS look, I expect the OS to actually use these fonts for some part of its GUI. This would not be monospace
but console
or terminal
, not serif
but body
or document
, not rounded
but caption
or whatever.
Apple should probably be proposing font
keywords to map to their HIGʼs Dynamic Font Variants, if the existing ones cited earlier do not suffice:
I did not find New York being documented for any of that (yet), though.
Furthermore, it is perfectly fine to map the the fonts in question to font-family
keywords like serif
, monospace
and fantasy
. If any website out there “fails” because its authors expected serif
to mean Times [New Roman], it absolutely needs to “fail”. However, I cannot imagine how anyone would consider a slightly different font being used as “failing”.
If the use case is to adaptively mimic the OS look, ...
This is probably the most confusing part, but as I read more feedback and articles about system-ui
, authors do not want to mimic the OS look. Before, I thought they do, but I'm revising my understanding now.
The article Using UI System Fonts In Web Design: A Quick Practical Guide explains that the goal is:
and the emphasis on the item 3. It says using system UI fonts suffice this goal, namely Roboto, San Francisco, and Segoe.
Then this github article explains that, it turns out that using the system font of the platform does not suffice these goals on older and/or CJK versions of Windows. They prefer Segoe or Arial over decades-old Tahoma or poorly rendered Chinese fonts, and that stopped using system-ui
. And this isn't only github saying.
In my new understanding, authors want modern, beautiful UI fonts, rather than the actual system UI fonts of the platform. I think it's more similar to a UI version of sans-serif
generic font family rather than a different version of font: menu
keyword. Authors want to use serif
or sans-serif
for UI, rather than exactly the same font family, style, and size of caption
or status-bar
of the platform.
I'm looking into updating Blink's system-ui
to reflect the feedback, and this proposal looks like a good extension to it.
Thanks Koji, I think I understand the actual issue better now.
My problem then is with the ui-
part of the proposed keywords, because apparently the fonts in question are not part of the system user interface (i.e. UI) at all. They are part of the OS vendorʼs flagship font super family, which is an essential and important part of their corporate design and identity. Seriously, please just drop it from the proposed keywords.
Hence, serif
would mean give me some generic letters with serifs that look somewhat like everywhere else while system-serif
or perhaps env(serif-font, serif)
would mean give me some iconic letters with serifs that represent the look of the system/environment.
For Apple, at least the serif (New York) and monospace (SF Mono) variants are used in parts of what we consider to be system UI, just not very often compared to sans. The serif variant is used when significant sections of published text are to be presented in a readable format. The mono variant is used when displaying code, a command-line terminal, or things of that nature.
(I am not aware offhand of a place that uses the rounded variant, but @litherum might know.)
The wallet app on iOS uses it as part of the UI:
And it’s used throughout the watchOS interface.
I agree with Myles on this.
The usecase for system-ui
, system-ui-serif
, system-ui-monospaced
, etc is different than the usecase for serif
or monospaced
.
By using a system-ui-*
font, an Author is asking the browser to pick fonts that match the Operating System, knowing that if/when the operating system changes it's fonts, their website/app will be changed as well. It's stating an intention to blend into the OS.
By using a generic serif-
or monospaced
, and Author is saying, give me whatever is available in this browser, I can't really care what it is, just give me something that works in the serif/sans-serif/monospaced bucket of fonts. This is used most commonly as a fallback. Authors state: I want this fancy webfont I'm providing, or if that didn't download then please use this particular built-in-the-browser font, but if you don't have that font, then please at least pick some sans-serif font. In that usecase Authors are not expecting their project to suddenly then match the OS. In fact ,it's likely they do not want their project to suddenly match the OS' typography.
I also agree with Myles and Jen, so far. But I would like guidance on what to author for fallback to cover Android, Windows, etc. Would there be system-ui-sans
on some OS’s? Would I have font-family: system-ui-rounded, “Helvetia Rounded”, system-ui-sans, system-ui, san-serif;
?
system-ui-rounded
might map to Segoe Script or Segoe Print on Windows.
@litherum wrote:
This choice is intentional, as these fonts are not intended to be document fonts for regular content. Instead, they represent the identity of the platforms themselves.
A little odd, but understood. But then "We've gotten requests to use these three fonts on the Web" should surely be met with "No, we don't want you to do that so we hid them" not "here is the CSS to do just that".
On a more detailed note, it is clear what happens with a browser that does not understand the new generic name. However, what happens if the browser does understand, say, system-ui-rounded
but that doesn't translate to a suitable font on the platform. Should it
a) be skipped over, to the next font in the list, or
b) fall back to system-ui
which is kind of the super-family?
The CSS Working Group just discussed system-ui-serif, system-ui-monospaced, and system-ui-rounded
.
@svgeesus Given the design usage of these fonts, it makes more sense that they would fallback to system-ui
than to be ignored in the font-family list. Therefore, a browser which supports these fonts but is running on a platform where they aren't relevant, should consider them synonyms for system-ui
.
Would it be helpful to consider this as a functional notation?
Like system-ui(rounded)
to say "use a system UI font, rounded if you have one, otherwise the default system UI font", or system-ui(serif, monospace)
to mean "use a system UI font, serif if you have it, otherwise monospace (otherwise the default). The function as a whole would be guaranteed to match a System UI font, but the style keywords inside create their own internal fallback list.
system-ui(serif, monospace)
seems like overengineering the problem. This is exactly what the font family cascade is supposed to solve. It's true that, if we enforce the behavior suggested in https://github.com/w3c/csswg-drafts/issues/4107#issuecomment-524565243, it will be impossible to fall back from serif to rounded, but I can't think of a case in UI design where that's desirable.
As for syntax, I think there are a few contestants:
system-ui-rounded
: Familiar to authors, yet possibly causing compatibility problems if anyone ever makes a real font with this exact name for some reason. (Note: This concern is relevant to every generic font family name.)system-ui(rounded)
: Simple, yet possibly confusing because font family names are strings in every other contextenv(system-ui-rounded)
: Conceptually pure, but exposes the platform-specific font name to the Web, if this environment variable was used in another context. E.g. content: env(system-ui-rounded)
.Itʼs up to [css-env] to ensure that sensitive data about the system environment is not unduly exposed. The variable name would certainly need to include “font”, nonetheless. env(rounded-font, system-ui)
seems sensible to me.
PS: Two-part keywords could be a solution as well, e. g.: (system-ui|system-cd) [ [rounded | squared] || [serif | slab-serif | sans-serif] || [fixed-width | full-width | half-width | proportional] || [current | gothic] || …]
Agree with @litherum , CSS font cascading is better mechanism than env
default value.
a browser which supports these fonts but is running on a platform where they aren't relevant, ...
If we skip, we can give authors a choice whether they want to fallback to system-ui
or some other rounded fonts by using CSS font cascading. Not strong but doesn't it give more flexibility to authors?
it makes more sense that they would fallback to system-ui than to be ignored in the font-family list.
That seems like a good decision
The CSS Working Group just discussed system-ui-serif, system-ui-monospaced, and system-ui-rounded
.
I think my position is, this is a good idea iff:
I see two ways people might want to use these:
People find these specific fonts pretty and want to use them. If so, the use case is not solved by having keywords that don't promise to match these specific fonts, and merely happen to do so on the first system on which they ship, may stop matching these specific fonts in the future, and will match different fonts on different systems.
People want to match the look and feel of native apps. In that case, they not only need a keyword to match the fonts that are used in native apps, but also to match the platform conventions about where these fonts are used. And these conventions are OS specific, the resulting layout will be odd on different OSes than the one the author had in mind when designing the page/app. Given that these fonts are fairly generic, and that the current design trends are fairly flat / minimalist, then it may not be too jarring now. But if you comparing very different OS styles, the problem becomes more apparent: if an app is used with these fonts to look native on iOS, it probably would look alright on android, but it absolutely would not look native on windows 95, regardless of how you mapped the fonts.
So, all in all, it doesn't seem to me that the proposal solves the use cases, as I understand them.
I think the way @fantasai is proposing to handle them in https://github.com/w3c/csswg-drafts/issues/4107#issuecomment-525824422 is the way to go if we do it, but I am not convinced we should.
Agreed with @fantasai.
My two cents:
To me, it doesn't look like this is particularly better than an -apple-*
name. In fact, it may be worse, because it will be used like an -apple-*
name, but it's not syntactically Apple-specific, so it misleads. Not only do these keywords not have a corresponding font in other systems, there is also no interest from other vendors into implementing something similar, and if they do, it will be just because these keywords pushed them to. Also, were these keywords to be added, authors would use them with the expectation that they get those specific fonts, and not what system-ui-*
semantically implies. Honestly, these keywords are a band-aid solution to the weird decision to not expose these fonts to the Web platform (which is what's appropriate here and what authors actually want), and we shouldn't contort the CSS language to cater to Apple's branding decisions.
I don’t agree that what authors want is to ask for by name for whatever the exact font is today. From what we heard on the call, they want to ask for the system U.I. Serif font, and today get whatever that font is, and tomorrow get whatever it is then.
That said, -apple-ui-*
might make a certain amount of sense, if we are sure it truly will not ever be meaningful on non-Apple platforms, other than possibly as an alias of a more general system-ui
. But even in Firefox and Chrome, they might still want to get the right font with it in their Mac versions (thus -apple-
instead of -webkit-
).
@litherum What are the IP claims for the fonts that Apple intends to expose? I tend to think that any font that is exposed through a CSS generic keyword ought to be free of any copyright, patent, trademark and other IP claims. Otherwise, if Apple decides to remove these fonts some time in the future, it becomes impossible to faithfully and legally reproduce the rendering of a web page using these fonts.
@frivoal is right, adaptive font keywords alone would not be enough to mimic system GUIs. The deprecation of system color keywords and the insufficiency of font
role keywords are further indications that it is hard to provide an appropriate mechanism that works well across platforms. Authors would need to either know or access various lengths, for instance, as well. [css-env] specifies only a handful of those yet. I now strongly believe that environment variables (our rather constants) are the proper place for all of this, because (while itʼs possible to maintain for font or color names only) we donʼt want to add keywords for all user interface lengths to all the properties they might be used with. A different syntax should also signal to authors that these fonts must not be used like others.
TLDR: Use env()
for this!
What are the IP claims for the fonts that Apple intends to expose?
The same as font-family: system-ui
, which is already a web standard.
Fundamentally, this proposal is about exposing OS features to the Web. Therefore, getting feedback from OS vendors is crucial.
I don't believe anyone from Microsoft has commented in this thread; I'd love to hear from them about whether this proposal works with the Windows platform. @atanassov
@kojiishi Thanks for commenting here! I'm very excited to hear interest from Google.
As for syntax, I think there are a few contestants:
system-ui-rounded
: Familiar to authors, yet possibly causing compatibility problems if anyone > ever makes a real font with this exact name for some reason. (Note: This concern is relevant to every generic font family name.)system-ui(rounded)
: Simple, yet possibly confusing because font family names are strings in every other contextenv(system-ui-rounded)
: Conceptually pure, but exposes the platform-specific font name to the Web, if this environment variable was used in another context. E.g.content: env(system-ui-rounded)
.
@grorg had an idea for one more:
font-style
, to allow for these styles. So, for example, font-family: Arial; font-style: rounded;
would render with Arial Rounded.Clearly that would rely on some heuristics to identify that Arial and Arial Rounded MT are the same family. Similarly for Roboto and Roboto Monospaced, etc.
Fonts can be classified by function or feature. I see confusion about using new proposed values because these two are mixed up.
Function categories may be something like system-ui font family, which is "default font family for system UI". There are also more detailed property values specific to OS vendor: legacy Windows categories like icon, or Apple's -apple-system-headline. I see extending function-based categories as separate issue from property values discussed in this thread.
Proposal here to add system-ui-rounded, system-ui-monospace, or system-ui-serif, doesn't seem to be in this category. I expect, and this is what what I see above in this thread, web developers to use new families because of font design characteristics rather than how they are used in system UI. It is classification based on font feature, which may be well covered by extending generic family values by adding 'rounded' keyword. Only reason for not doing so is backward compatibility. For that reason, I'm ok with adding new set of system-* properties, but because this is feature-based classification I would drop -ui- from property names. And add system-sans-serif to make list internally consistent.
And coming back to classification by function, we can try defining another, universal, set of those. This may be hard because of differences in UI design principles and also they tend to change all the time. I any case, if we do this, I agree it should also include other properties like weight. Modern Windows API provides set of categories similar to Apple's (https://docs.microsoft.com/en-us/uwp/api/windows.globalization.fonts.languagefontgroup), which includes width/stretch/style for each category.
Hey folks! I think this is a great idea, and a good discussion. Please forgive me if this has been covered already or if I’m not fully understanding, but here are some thoughts:
“Serif”, “Monospace”, “Rounded” ... Maybe the syntax for alternate styles of system UI fonts should avoid describing the fonts themselves, and instead describe their intended use — which may not necessarily map to document structure.
@litherum notes that New York, a serifed face, is not the same as other serifed faces:
We also don’t want to automatically opt a bunch of websites into using New York because it is intended to be used selectively in new content. It isn’t a document font that is supposed to be used everywhere.
And @Crissov notes that UI fonts do specific jobs, regardless of how they look:
If the use case is to adaptively mimic the OS look, I expect the OS to actually use these fonts for some part of its GUI. This would not be monospace but console or terminal, not serif but body or document, not rounded but caption or whatever.
So, for examples:
system-ui-serif
for selective content, intending to as @jensimmons said, “blend into the OS”. Then Apple changes the typeface it uses for selective content like this from a serifed face into a bold sans. Does system-ui-serif
then reference the bold sans? Would something like system-ui-dramatic
(or similar) be more appropriate?system-ui-rounded
. What if instead authors could use something like system-ui
and system-ui-secondary
?There seem to be a lot of objections to this proposal, but objections based on confusion about what use case this is for.
Imagine an Author who is designing a "PWA" / website, where they want the header of the "web app"/page, including the navigation, to look like the OS the site is on. They might especially want this because their users are saving the site to their home screen, and opening it without browser chrome.
On iOS, they want it to look like Apple's iOS HIG. On Android, they want it to look like Material Design. Same on other systems — ‘mobile’, ’desktop’, TVs, game console, refrigerators, & who knows where — the Author just wants to match the interface for the overall software environment.
At the moment, Authors can attempt do this by carefully designing a font stack. Like these:
/* System Fonts as used by GitHub */
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
/* System Fonts as used by WordPress and Medium */
body {
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}
This only works if the fonts used by one OS are not shipped in another OS. For example, if Roboto were suddenly shipped in macOS, and the font stack wasn't written in "the right" order, an Author could end up with Roboto being used instead of San Francisco. It's hard to predict what the future will bring.
Currently, Authors must put a lot of effort into researching what each different OS needs — which means it's likely only the most popular ones will be properly supported. OSes (and scripts) that are less-commonly-thought-about-by-Authors are out in the cold.
This is fragile. And finicky. There is no solid way to write robust long-lasting CSS to fill this need.
The current 'solution' also depends on Authors updating their CSS anytime an OS redesign switches to a new font. Which keeps happening — Roboto, San Francisco, Material Design, New York... modern operating systems keep evolving their typography.
Why shouldn't websites be able to say what they mean? — "I want you to use the System UI typography here. When it changes, automatically use the new one".
Other Authors are using User Agent sniffing via JavaScript to try to identify the OS and deliver the right font. Which is a terrible solution.
What Apple is proposing would eliminate the nonsense and fragility, and provide a real, robust, future-proof, long-term solution to this. Github, WordPress, and Medium are just a few of the massive companies attempting to bubble up the System typography in their interfaces. Authors need this. Both Smashing Mag & CSS Tricks have multiple tutorials covering this problem space.
What I see is a proposal for:
system-ui
system-ui-serif
system-ui-monospaced
system-ui-rounded
where system-ui
would be the main font for a System UI. And three others that are a a "bit more specific" in a way, to say — oh, give me the monospaced, or give me the serif...
I might suggest changing it to this to this:
system-ui
system-ui-serif
system-ui-sans-serif
system-ui-monospace
There are suggestions in this thread to define many more. To go nuts. To question why three? Why these three? My answer is: Well, Typography.
If you look at typography, both recent innovations and historically, serif, sans-serif, and monospace are the three giant buckets into which most fonts fall. Yes, there are others (cursive, decorative...) but those are used much less commonly, and we've seen hardly any use of such fonts in System UI. Let's not over-engineer this. We are not talking about mapping entire design systems into CSS. The burden is still on the Author to figure out when to use which when or why (or to use a framework like Material Design, to let someone else do to the work for them).
(Actually more thinking is needed here because of SF Rounded... maybe a system-ui-alternative
is in order. But we can refine the list of keywords & what they might map to, if we can agree that we should go in this direction...)
Next question — what should browser vendors do if they need to define these three "buckets" for a System UI font, and then choose one of those to be the more generic primary system-ui
choice? How is an Implementer to know what to do. What if there is no obvious 'serif' or 'monospace' choice? Perhaps those fonts are just undefined in certain cases?
We do need to hear from Windows, Android/Material Design, and other OS designers about this. Do their HIGs have enough info? Do all the operating systems have the UI typography systems needed?
Perhaps, browsers simply make their best guess — and kind of make it up. Perhaps we write some guidelines in the CSS spec as to how to do that. Maybe there's some kind of spec process where we ask OS vendors to chime in and fill in these blanks. Or perhaps, even better, this is a pass-through directly from CSS to the OS — the OS defines this, not the browser. (Like Dark Mode and Prefers Reduced Motion.)
As for the discussion of the fallbacks, I do think we should keep to what we already have, and not engineer a whole different way of doing things. Authors are going to have to provide fallbacks for older browsers anyway. This will make sense to Authors:
font-family: system-ui-sans-serif, system-ui, Helvetica, Aria, sans-serif;
We already have an entire mechanism for what happens when a font isn't available. Let's use it.
This is not about providing access to new Apple fonts to web designers like other normal system fonts. I feel like a lot of this discussion has been derailed by people who are mad at Apple for not making their fonts more "open". Please let's set those feelings aside, and talk about the actual use case at hand — providing Authors with a way to simply and robustly build a font stack that uses the current System UI typography system for the Users OS. Don't punish Authors who need this problem solved because you don't like a particular tech company's choices regarding their new font files.
@jensimmons Thanks for the explanation.
I feel like a lot of this discussion has been derailed by people who are mad at Apple for not making their fonts more "open".
Apple has at some point during this conversation stated the main reason for wanting this is that designers told them these fonts were pretty and they wanted to use them. That's what brought the "if so, just give them access to the fonts". I don't think anybody was particularly mad at anyone.
Based on the rest of your comment, we can discard that line of reasoning, regardless of how we ended up there.
For the purpose of matching the design of the OS, I am still a bit skeptical, not of the intent, but of how well it is achieved by this: authors will not only need a keyword to match the fonts that are used in native apps, but also to match the platform conventions about where and how these fonts are used. And these conventions are OS specific, the resulting layout will be odd on different OSes than the one the author had in mind when designing the page/app. Given that these fonts are fairly generic, and that the current design trends are fairly flat / minimalist, then it may not be too jarring now. But if you comparing very different OS styles, the problem becomes more apparent: if an app is used with these fonts to look native on iOS, it probably would look alright on android, but it absolutely would not look native on enlightenment, windows XP, WebOS on LG TVs or nextSTEP, regardless of how you mapped the fonts: matching the look and feel of various OSes goes way beyond picking the right fonts. And giving that we don't have tools for that, I am concerned that this will result in making it easier for Authors to ship apps that look like iOS on all iOS browsers (of which there aren't very many), and like iOS-modulo-fonts everywhere else.
Now, maybe authors are going to do that anyway, so we should still ease that pain. But that's not the same as enabling portable apps that look native on any platform.
Actually more thinking is needed here because of SF Rounded... maybe a system-ui-alternative is in order
That seems to play into my concern: system-ui-alternative
feels like fantasy
generic family: if you don't know what you're going to get, there's not way to use this correctly. And if you build your design based on the assumption that you'll get apples rounded fonts because iphone, then who knows what it's going to do on other systems.
The CSS Working Group just discussed system-ui fonts
, and agreed to the following:
RESOLVED: Add them with the `ui-` prefix and make them not match if they're not available
Note: CSSWG also recommended that fonts exposed via these keywords also be exposed by some normal font names, so that people don't start to use the keywords as a proxy for certain fonts (and then start to depend on that behavior).
Hi!
This year, Apple has released 3 fonts in macOS and iOS. Here are what they look like:
New York:
SF Mono
SF Rounded
We've gotten requests to use these three fonts on the Web. However, we don't want to treat these fonts just like any other font. On macOS and iOS, these fonts are only available by running special AppKit/UIKit functions, and don't appear in font enumerations. This choice is intentional, as these fonts are not intended to be document fonts for regular content. Instead, they represent the identity of the platforms themselves.
Because of the requests, we'd like to propose adding these fonts to the CSS Fonts spec as siblings to
system-ui
, and including some explanatory text in the spec about the difference between these fonts and any other installed fonts on the system.Android has Droid Serif and Droid Sans Mono which would map to
system-ui-serif
andsystem-ui-monospaced
. I don't know if Windows has any analogues with Segoe UI.We've recently implemented support for these in Safari behind an SPI flag, off by default. This is an SPI, not an experimental feature, so Safari users can't even enable the fonts if they wanted to just yet.