-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Suggestion: Implement font-display #358
Comments
Is there any progress on this topic? |
I'm not familiar with this but, I'm curious why you can't provide this css
rule yourself, and need the fonts API to do it? :)
…On Jun 18, 2017 4:55 AM, "João Ramos" ***@***.***> wrote:
Is there any progress on this topic?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#358 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAP9y8IS9nkj3ao5N90w4NFxxyOIW0u7ks5sFOX8gaJpZM4Joy0K>
.
|
It's a descriptor that goes into the @font-face block. |
Aha, got it! :) Thanks!! |
Now that Chrome 60 is stable, the priority for this should be bumped up! It’d be an awesome addition. |
This would still be really great to have but https://twitter.com/zachleat/status/892372316092608512 Doesn’t look like this is available anywhere yet though, so there is obviously going to be browser support mismatches between |
Indeed I see on the twitter more and more interest :) https://twitter.com/jeff_archibald/status/892861206939095040 |
W3C specification: High-level overview: new multi-browser CSS key/value pair that needs to go into each CSS snippet generated and delivered by Google Fonts: font-display: {auto,block,swap,fallback,optional}; When a remotely-served font is taking too long to load (or will never be loaded), this helps the browser know what to do with the textual content it is waiting to rendering. By adding Article and |
The question is whether it is save to just copy the font-face declaration which google generates for now and add the |
It's not just a question of how often the font URL changes. Google fonts's css file is different for different browsers. Even the same version of Chrome in Windows and Mac will receive different css files. So if you are suggesting that one can generate a css file simply by copy-pasting the font-face declarations into your own css file doesn't work for everyone. So it is useful to have font-display generated in the css by the Google Fonts server itself. |
@vijayaraghavanramanan |
What do you have in mind here? Since since the font, weights, style etc are passed in the query string in the URL, so I thought it's natural to pass "font-display" in the URL. |
@vijayaraghavanramanan I was just curious about why we don't redirect from some static URL to I know, this becomes irrelevant with query strings. But until then, it would have been reasonable to be able to define something like:
What are the technical considerations on serving different content on static paths for single font files instead of putting different paths inside |
What Google Fonts does is that it creates different css files for different browsers. The server sees the browser/version/OS and sends the right css file. Even for a single version of Chrome in Windows/Mac OS, the font files (woff2/woff/ttf/svg/eot) are different. Try to look at the css files in different browsers to check. So that's why it's not appropriate to link the woff2/woff files directly. And for that reason, the website using Google Fonts can't control "font-display" and Google may have to introduce it from their side. |
@vijayaraghavanramanan |
There are 847 fonts right now. Each has different weights, language, styles etc. One can even request multiple fonts like 2, 3 or maybe even 10 in the same request. So I guess having static css files might not be optimal. Because there can be millions of different combinations. Just guessing. Does that sound right? |
@vijayaraghavanramanan |
Apologies I didn't get the points you raised right. Font files can be multiple. So how a single request serve multiple files? |
@vijayaraghavanramanan
and have [3] dynamically resolve to the font file needed (like e.g. [2]). This would move the responsibility from [1] resolving as needed to [3] resolving as needed and give developers more freedom in using CSS because the ugly URL like [2] would have been moved even more away from them. |
Understand better now. But how will you address the fact that one needs options for weights, styles and languages: For example, I use the link for my site:
which generates a css file with 28 font-face rules. your [3] will just give the woff2 file for weight 400 and style normal, latin. Nor is it desirable to request every weight and style etc. The browser looks at a page and decides which fonts to download. So I think what Google does now is good. One quibble is that there are two servers. Ideally should have been just one - both for the css and the font files. Another way is Typekit, where you have an account and make a kit. |
@vijayaraghavanramanan I think the query string solution is great in terms of being able to customize the font behaviour more. But in addition to this change, I might be practical to canonicalize the URL used to retrieve the respective font files. This shouldn't be hard to implement but might de-complicate things over the long run with caching being just one example. The real question really is: What would be used?
Any of these options should meet come in handy in terms of e.g. cache-ability but other technical aspects might have to be considered as well. |
It's not easy. The latest browsers get multiple woff2 files depending on the unicode range. So the recent versions of Chrome have separate files for latin, latin-ext, greek, greek-ext. Which the browser downloads depending on whether the page needs it or not. Older browsers or Edge receive just one font file for a weight and a style. So there's no one font file really. |
@vijayaraghavanramanan Current: Static URL -> Dynamic CSS -> Dynamic Font Paths (-> No Redirects) |
Don't know enough to know about redirecting to multiple files, but not the most efficient, I'd imagine. The way |
@vijayaraghavanramanan
[2] would become [4]
and the information, that [1] currently uses to determine the respective URL [2] and [3], could then be used to let [4] and [5] serve to font files. The only thing that would change is that the URL pointing to the individual font files would contain just the information about the font family and the range and would then serve the font file needed using the information sent by the browser otherwise used to compile the CSS file. |
We currently have the ability to pass through font weights in the request query string (e.g. Could the query string functionality not just be amended slightly so we can pass through our font-display preference in the query string too? e.g. OR To enable different Personally I'd be happy with either solution. |
Dropping the |
Happy to confirm this is coming soon to a Google Fonts near you using the query param |
So, is that how I use the feature now? 😃 |
Yup. This will be the final syntax and should be safe to deploy. Per Nathan on the team, the rollout with the |
Rollout complete! |
Addy, Any update on But there's a use case for |
For |
According to https://bugs.chromium.org/p/chromium/issues/detail?id=777846#c10, support for |
The feature has been available since a few months now. That update seems to suggest that font-display via font-feature-values won't fix. |
Origin hugo-coder added this, copy it into my local fonts version For reference: luizdepra#269 https://fontsplugin.com/google-fonts-font-display-swap/ google/fonts#358
font-display is getting some attention, although still experimental in many browsers.
https://css-tricks.com/font-display-masses/
Chrome/Canary, Opera and Firefox have it although it is disabled by default. Hope it comes out soon.
This leaves Google Fonts to implement it. Since it should be included with the @font-face declaration, Google Fonts can allow passing of a parameter such as "&display=swap" in the URL which creates css files with a declaration:
font-display: swap;
in the css file.
Are developers of Google Fonts thinking about it?
The text was updated successfully, but these errors were encountered: