Page 1 of 2

X3 self-hosted Google fonts

Posted: 27 Jul 2022, 04:13
by mjau-mjau
Edit 12. Sept 2023: Since X3.32.0, the below fix is no longer required. Google fonts are now replaced by fonts.bunny.net for improved privacy and to avoid issues with GDPR. See bunny.net About and FAQ.



There has been reports (see topic) about legal challenges when loading Google fonts from websites in Germany. Below is a HOTFIX that allows you to host the Google fonts on your own server, effectively avoiding any legal concerns.

* This fix is specifically for X3.31.1. In next release, I will include an easier solution.

1. Open the file app/templates/bb/f8/4e8334aa77fc3e030e582b6b9bca6aa66114b7201078c756af50f9885fea.php in any text editor.

2. Go to line 278 (or search "fonts.googleapis.com"), you will find something like this:
Image

3. Remove all the code between the {brackets}. It should look like this:
Image

4. Go to your panel Settings > Style > Font and see which font(s) you are using:
Image
It's easiest if you have only one font, but often you will have two fonts. In the example above, there are two fonts "PT Sans" and "PT Sans Narrow".

5. Go to https://google-webfonts-helper.herokuapp.com/fonts/, search for the font you are using. Click the font, and select the font-weight styles your font requires (when weight is unspecified, it means 400 "normal").
Image

6. Scroll down to "Copy CSS", click "modern browsers", scroll down to "Customize folder prefix" and change it from "../fonts/" to "/fonts/"
Image

7. Copy the provided font-CSS into X3 Settings > Custom > Custom CSS.
Image

8. Back on google-webfonts-helper website, click to download the fonts in ZIP format. Unzip the font files, and upload into new directory /fonts/ inside your own X3 dir.
Image

* If you are using TWO fonts, which is highly likely, you will need to repeat 5-8.

Working example:
https://lightshades.de/

Re: X3 self-hosted Google fonts

Posted: 19 Aug 2022, 11:28
by Ch3ck3rM0n
I did it two times like discribed, but my page is still loading fonts from Google to my website https://manuelfocus.de !
I am completely lost to find the reason why?


EDIT: Found the reason, it was neccessary to clean Page Cache over tools menu.

Re: X3 self-hosted Google fonts

Posted: 21 Oct 2022, 09:51
by marco-urban
Works fine, thank you!

Re: X3 self-hosted Google fonts

Posted: 28 Oct 2022, 23:25
by yellowbee
Many thanks! I also received this kind of letter recently. This solution helps! 

Re: X3 self-hosted Google fonts

Posted: 03 Nov 2022, 13:05
by Falcon
Thank you very much! This workaround/hotfix is very helpful here in Germany concerning the new legal challenge regarding the Google fonts. It works fine. Again, thank you!  :thumbsup: 

Re: X3 self-hosted Google fonts

Posted: 04 Nov 2022, 00:27
by mjau-mjau
I'll create a built-in option for this in next release. I'm just working through another task right now before I can start this update.

Re: X3 self-hosted Google fonts / Font Awesome?

Posted: 05 Nov 2022, 14:55
by Falcon
May there is a similar hotfix for "Font Awesome" too? (same legal challenge) - again, thank you very much! (hotfix for Google fonts is working fine)

Re: X3 self-hosted Google fonts / Font Awesome?

Posted: 06 Nov 2022, 01:46
by mjau-mjau
Falcon wrote:May there is a similar hotfix for "Font Awesome" too?
Font awesome is part of the X3 plugins, and can therefore be served locally by disabling Settings > Advanced > "Use CDN".
Falcon wrote:(same legal challenge)
Is it though? One of the factors of the single ruling against Google fonts in Germany, is that loading a font is not strictly required for the website to function. Loading icons is, because without them, buttons and navigation looses it's meaning ... The website can't function properly without loading icons. A small difference, but legally, a big difference. The CDN version is hosted at JSDelivr, and they wrote about this:
https://www.jsdelivr.com/blog/how-the-g ... fe-to-use/

Re: X3 self-hosted Google fonts

Posted: 06 Nov 2022, 10:54
by Falcon
Thanks for your fast reply!
You're right, of course (the site can't function properly without loading essential icons…).
However, the key point in German law seems that if you are using CDN (meaning i.e. the transmission of IP by a company outside the EU using an online service) you have to inform the visitor of your website and obtain consent (omg! :disappointed:). In this case (for the necessary icons from Fonts Awesome) it’s really crazy at all, meaning you have to obtain consent from the visitor before entering the website.
So, to minimize the ‘risk’ and to be safe, I have added in my privacy policies the corresponding information of using Google fonts and Font Awesome on the website as recommended (in my case local installation, so no connection to servers of Google or Fonticons, Inc.).
Furthermore, I have disabled the use of CDN (although all the drawbacks) to avoid the obtaining of consent in this case (seemingly necessary because of the German law).
This topic is really tough stuff and really crazy at all (EU/German legally).
Hope there will be a clear legal interpretation in near future concerning this issue… (just dreaming…).
Again, thank you very much.  :slight_smile:

Re: X3 self-hosted Google fonts

Posted: 06 Nov 2022, 11:09
by mjau-mjau
Falcon wrote:However, the key point in German law seems that if you are using CDN (meaning i.e. the transmission of IP by a company outside the EU using an online service) you have to inform the visitor of your website and obtain consent
Are you sure this isn't some website's interpretation? I haven't seen this before in any legal text. If you load a website outside of EU, you are transmitting your IP to the server outside EU, but this itself doesn't require any consent.

Re: X3 self-hosted Google fonts

Posted: 15 Nov 2022, 11:18
by ed_f
If you load a website outside of EU, you are transmitting your IP to the server outside EU, but this itself doesn't require any consent.
It doesn't require consent, but these poor lawyers or their machines are suing us for exactly that and ask money from thousands meanwhile.

is your hotfix from #1 still the way we must go today? and when your next release including an easier solution is to be expected?

Re: X3 self-hosted Google fonts

Posted: 19 Nov 2022, 10:04
by ed_f
ok, it works. if necessary, as in my case, the style "regular" has to be toggled off on the google site.

Re: X3 self-hosted Google fonts

Posted: 20 Nov 2022, 00:19
by mjau-mjau
ed_f wrote:It doesn't require consent, but these poor lawyers or their machines are suing us for exactly that and ask money from thousands meanwhile.
Not when you load a website that uses absolutely no cookies, no external files and stores nothing. My point was, the client is always sending it's IP to the visited website. That's how the internet works. Anyway, this is off-topic.
ed_f wrote:is your hotfix from #1 still the way we must go today? and when your next release including an easier solution is to be expected?
Right now yes. Next version will include an easier solution yes, in a couple of months.

Re: X3 self-hosted Google fonts

Posted: 21 Dec 2022, 13:17
by ed_f

Re: X3 self-hosted Google fonts

Posted: 21 Dec 2022, 22:18
by mjau-mjau
Great news! :heart_eyes: