Self-Hosting Fonts - No more excuses
Tags: webdev, privacy, tooling, css
Published: 2022-09-29 17:23:52

### Google Fonts - Privacy & DSGVO

For some time now it is *forbidden* in germany to use the google-fonts-api for your website. The idea behind this is that the user has no chance to prevent google from loading the fonts when visiting the website. The whole thing has actually been known for a while, but I still see a lot of sites from the EU/GER using google-fonts. With this short blog post I try to draw some more attention to the problem and show you some tools that can solve the data-privacy dilemma quickly.

### Self-Hosting Fonts - Tools

With the help of the `@font-face` ([MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face)) rule and a dedicated tool, the problem can be fixed in no time. Two of them I can recommend:

- [google-webfonts-helper](https://github.com/majodev/google-webfonts-helper) (wep-app & rest-api)
- [webfont-kit-generator](https://github.com/rafaelmardojai/webfont-kit-generator) (linux)

I came across the tool "Webfont-Kit-Generator" for linux only recently.

With the helpful tool it is possible to generate woff/woff2 font formats from non-web fonts (otf & ttf). Additionally you get a css snippet which you can use for embedding.

What I like the most is that you can also download google-fonts and convert them automatically. Webfont-Kit-Generator uses [fonttools](https://github.com/fonttools/fonttools) (written in Python), that's pretty cool too.

In the settings you can then adjust and optimize the fonts a little more ([unicode-range](https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range), [font-display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display) etc.).

![webfont-kit-generator-screenshot](https://rob.fra1.cdn.digitaloceanspaces.com/images/webfont-kit-generator-screenshot.png)

The tool is also available via Flatpak and can be obtained from [Flathub](https://flathub.org/apps/details/com.rafaelmardojai.WebfontKitGenerator):

```
flatpak install flathub com.rafaelmardojai.WebfontKitGenerator
```

As an alternative there is the [google-webfonts-helper](https://github.com/majodev/google-webfonts-helper). It can be used online and regardless of the operating system.

### Bottom line

Actually, there is no reason to use google-fonts anymore (CDN). The average internet speed has become so fast that the performance hardly plays a role in self-hosting. The performance can even be improved when self hosting (adjustable charset, S3-CDN etc.). Also for privacy reasons I think it is important not to leave things like fonts to a data giant. Unfortunately, there are still a lot of sites that use google-fonts. Even medium-sized and large corporate sites from germany. I hope the trend goes here more in the direction of data privacy.

Interesting links on the topic:

- [GDPR compliance · Issue #1495 · google/fonts](https://github.com/google/fonts/issues/1495)
- [developers.google.com/fonts/faq](https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users)
- [Angeblicher DSGVO-Verstoß: Abmahnwelle wegen Google Fonts | heise online](https://www.heise.de/news/DSGVO-Abmahnwelle-wegen-Google-Fonts-7206364.html) (german)

---

Thanks for reading.

Originally published at [rburkhardt.com](https://rburkhardt.com/)
Feel free to subscribe to my [RSS](https://rburkhardt.com/feed/) and connect on [Twitter](https://twitter.com/rob_burkhardt) or [Github](https://github.com/rob32)