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

URLs in families.json point to GitHub instead of a CDN #15

Open
Nateowami opened this issue Jul 11, 2024 · 1 comment
Open

URLs in families.json point to GitHub instead of a CDN #15

Nateowami opened this issue Jul 11, 2024 · 1 comment

Comments

@Nateowami
Copy link

In families.json, a lot of Noto fonts have a URL starting with https://github.com/notofonts/notofonts.github.io/raw/main/fonts/

This doesn't seem to me like an appropriate place for serving fonts.

notofonts.github.io shows that these fonts are available at https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/, which is an actual CDN. Would it be possible to change the URLs to point there?

Or perhaps you aren't intending the URLs in families.json to be used for directly serving fonts?

@jvgaultney
Copy link
Contributor

jvgaultney commented Jul 12, 2024

The jsDelivr-based URLs on the Noto Dashboard are a more recent change. We don't, however, get our data from that page, but rather a more upstream file that continues to use the Github-based ones. We don't attempt to constantly track every change to that file. The intent is to update our data every few months (though we are late on doing that).

The Github URLs remain a good source for the fonts if you're occasionally grabbing a new font here and there to be downloaded to the desktop machine, which is what the URLs we provide are intended to help you do. The difference in download speed between Github and jsDelivr is not that significant for that purpose. The Github URLs are not at all good if you are trying to load them on demand as webfonts. Neither we nor Google suggest you do that.

If you want dynamically-loaded Noto webfonts from a fast, global CDN you should be using them via Google Fonts. We don't give URLs for that because using them from that source is a bit more involved than just a URL. Each web app needs to decide which method of loading to use (link or import) on each target OS, etc. Once you decide by which mechanism you want to load the fonts, then you can use some of the other metadata in families.json to construct the links, styles, etc.

For example if you want Noto Serif Mahajani for a web app using a mechanism you might use this link and CSS:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mahajani&display=swap" rel="stylesheet">
.noto-sans-mahajani-regular {
  font-family: "Noto Sans Mahajani", sans-serif;
  font-weight: 400;
  font-style: normal;
}

This can be constructed (or at least guessed at) from the data in families.json. But since we don't control the Google Fonts service, and it's not possible to track the changes in their service APIs, we don't attempt provide this for every combination of platform and mechanism. This method is reasonably stable, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants