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

Determine locations for font files #13

Open
Lorp opened this issue Dec 4, 2023 · 7 comments
Open

Determine locations for font files #13

Lorp opened this issue Dec 4, 2023 · 7 comments

Comments

@Lorp
Copy link
Owner

Lorp commented Dec 4, 2023

The Noto Color Emoji font, as well as the default set of fonts in the Text mode, need to be hosted somewhere rather than be delivered with the plugin. Their locations are defined in fontlist.js, and are currently either https://www.axis-praxis.org/ or https://raw.githubusercontent.com/. Neither of these domains is ideal for production — githubusercontent.com is not a CDN, and axis-praxis.org is not set up for heavy traffic.

Note that any domains from which assets may be downloaded by a plugin must be listed in manifest.json — one cannot dynamically download from arbitrary URLs (e.g. by letting users enter a URL).

Note also that, to minimize bandwidth, Noto Color Emoji has had its SVG table removed and is compressed as a WOFF2 file.

@Lorp
Copy link
Owner Author

Lorp commented Dec 4, 2023

The WOFF2 font at this URL appears to be what we want:

https://fonts.gstatic.com/s/notocoloremoji/v25/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFWRxHy9WY8YXt1PQ.woff2

It is 1.9MB (that is comparable to the size of the font created by manually removing the SVG table from the unmodified binary font, after WOFF2-compression).

We need confirmation that this is safe to hard-code.

Obtained via:

  • Go to Noto Color Emoji page on Google Fonts
  • Click "Select Regular 400"
  • Select the @import option in the right-hand column
  • Take the url string and load the CSS file it points to
  • In the CSS file, take the src descriptor of the last @font-face rule

@Lorp
Copy link
Owner Author

Lorp commented Dec 4, 2023

Note also that this URL is for the updated Noto Color Emoji with Emoji 15.1 support, whereas testing until now has been with the font covering Emoji 15.0.

For reference: new emojis in Emoji 15.0, Emoji 15.1

@Lorp
Copy link
Owner Author

Lorp commented Dec 5, 2023

We can also use this location for Noto Emoji (mono):

https://fonts.gstatic.com/s/notoemoji/v47/bMrymSyK7YY-MEu6aWjPJGaTe34h0Wq7.woff2

@Lorp
Copy link
Owner Author

Lorp commented Dec 5, 2023

The two emoji font references now point to fonts.gstatic.com links mentioned above (commit: 5815fb0)

@Lorp
Copy link
Owner Author

Lorp commented Dec 6, 2023

Since they are available at fonts.google.com, it’s tempting to use the same technique for Bitter, Foldit and Nabla. However, in each case, the CSS does not point to any single font covering the whole character set; they are split into Latin, Vietnamese and (in the case of Bitter) Cyrillic. A method to get a URL for the non-subset WOFF2 font would be ideal.

@tomasdev
Copy link

tomasdev commented Dec 6, 2023

I think https://fonts.gstatic.com/s/foldit/v5/aFTV7PF3Y3c9WdjXozeyCYQ.woff2 has the un-subsetted Foldit.

The hashes can be pre-calculated for the specific settings you need (undocumented)

@Lorp
Copy link
Owner Author

Lorp commented Dec 6, 2023

Thanks for this, looks good!

Note that it has 615 glyphs vs 619 glyphs in the binary I’ve been using. Perhaps an optimization based on unused glyphs or a minor version difference.

Do you have similar URLs for Bitter, Bitter Italic, Blaka Ink, Bungee Spice, Nabla (those are the other Google fonts I’ve been using in the text fonts menu).

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