owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.38k stars 229 forks source link

Self-host our webfonts #1910

Closed ikesau closed 1 year ago

ikesau commented 1 year ago

Currently we use Google to deliver webfonts with a <link> in our head to: https://fonts.googleapis.com/css?family=Lato:300,400,400i,700,700i,900|Playfair+Display:400,600,700&display=swap

This loads a CSS file that requests several webfonts:

/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/lato/v23/S6u8w4BMUTPHjxsAUi-qNiXg7eU0.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/lato/v23/S6u8w4BMUTPHjxsAXC-qNiXg7Q.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* etc */

If we hosted and served this data ourselves, we wouldn't have to make unconsented requests to Google which are in violation of the GDPR and not affected by ours users' responses to the cookies banner.

marcelgerber commented 1 year ago

Oh this is interesting. Just a few days ago I went down a tiny rabbithole to check why 10¹⁵ doesn't render well with our Google Fonts Lato font. What I'm saying is that self-hosting Lato could also bring in other (arguably tiny) improvements.

It seems that the Lato typeface has in the meantime been updated to support the glyph, but the Google Fonts version (on the left) has not been updated. The Adobe Fonts version, for example, shows this just fine: image

samizdatco commented 1 year ago

Note also that the version of Lato posted here has additional weights that would be particularly useful for UI labels. It would be nice if we could get away with using the smaller latin-only variants but I'm not sure whether they include the niceties @marcelgerber mentioned above…

ikesau commented 1 year ago

Closed by #2518