Skip to content
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: Stable Font File URLs? #1067

davelab6 opened this issue Jun 28, 2017 · 5 comments

Suggestion: Stable Font File URLs? #1067

davelab6 opened this issue Jun 28, 2017 · 5 comments


Copy link

@davelab6 davelab6 commented Jun 28, 2017

@zachleat has an idea (detailed in zachleat/idea-book#15) about how the fonts API could offer predictable font file URLs; filing this here for future discussion :)

@davelab6 davelab6 added this to the Questions about Google Fonts service (API) milestone Jun 28, 2017
@davelab6 davelab6 self-assigned this Sep 21, 2017
@davelab6 davelab6 changed the title Stable Font File URLs? Suggestion: Stable Font File URLs? Sep 21, 2017
@davelab6 davelab6 removed their assignment Oct 6, 2017
Copy link

@zachleat zachleat commented Nov 9, 2018

Just as background information, I was clued in that this kind of thing is happening 😇


Curious how reliable this is?

Copy link

@garretrieger garretrieger commented Nov 14, 2018

CSS responses from the API should not be copied and inlined into a pages html:

  • The CSS response is specific to the user agent of the browser making the request to the CSS api. So CSS collected from one browser may not work correctly for other browsers.
  • We make no guarantees that font files at older versions will always be available.

Copy link
Member Author

@davelab6 davelab6 commented May 11, 2019

Further discussion here

Leaving this issue open, but we should address this better in our faq

Copy link

@addyosmani addyosmani commented Jul 11, 2019

A few thoughts on directions we could take here...

  • Document that if you want to use rel=preload with stable URLs today, self-hosting may be your best option (FAQ entry). Tools like google-webfonts-helper are used by developers to do this.
  • If we wanted to formally support preloading, consider a "stable" font-file URL developers could leverage such as /latest.woff2 (which redirects to the appropriate version for the UA). This would probably need to factor in a few things, including caching, redirects etc.

Something like...

<link rel="preload" as="font" type="font/woff2" 
  href="" crossorigin>

There are other options like build-time plugins, but I think these suffer from the same challenge - the URLs you statically specify in HTML to preload can easily change based on UA. We likely don't want developers having to worry about font content negotiation too much themselves.

Copy link

@rsheeter rsheeter commented Jul 30, 2020

I suppose I'm late but the suggestions here are interesting :)

Thinking "aloud," the static nature of the font files combined with dynamic css lends itself to aggressive cache durations and CDN use for the font binaries. If we had to make /latest dynamic (so it would send you the right font for your platform and UA) we might have to give up some of that

Another concern is that there isn't necessarily a single file to return given unicode-range slicing, particularly for CJK ( Starting download earlier but pulling 10x the number of bytes requires a fast unmetered connection to be a win. Now I need:

<link rel="preload" as="font" type="font/woff2" 
  href="" crossorigin
  min-connection=(veryfast, unmetered)>

Our current long term play is progressive font enrichment, described at and in the later slides of

zzzeek added a commit to sqlalchemyorg/sqlalchemyorg that referenced this issue Dec 17, 2020
Due to firewall restrictions, users are not able to download
content from google in a timely manner, causing loading delays.
We may use custom font-display settings for a font file to mitigate this issue
however the @import tag itself does not offer such
a feature.  As google does not provide stable URLs for the font
files themselves [1] we must self host.

[1] google/fonts#1067
References: sqlalchemy/sqlalchemy#5727
@RosaWagner RosaWagner removed this from the Questions about Google Fonts service (API) milestone Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants