1. Oliver
  2. Sherlock Holmes
  3. News / Announcements
  4. Tuesday, 14 December 2021
  5.  Subscribe via email
Hello Ciaran,

I am quite not sure, if this forum category is the right place for my feature request. Pls move it, if necessary.

I wonder if it is not possible to add a possibility to localize the webfonts.
Currently the fonts are almost Google Webfonts that are called directly form the Google fonts server. In the European GDPR it is recommended to localize the font files so there is no connection to a Google server, which stores personalized data like IP addresses in the US.
Currently I am doing like this:

  • I got to https://google-webfonts-helper.herokuapp.com/fonts and search the font I am using (or more than one but than one after the other). I check the styles I want to use and copy the css code. This code I store in a CSS file which I call local-fonts.css and upload it to templates/j51_xxx/css/
  • Then i download the prepared ZIP file at the end of the css code section on the webfonts helper page. I unpack it and upload the font files to templates/j51_xxx/fonts/ . Now the references in the CSS file local-fonts.css point to the correct font files (e.g.: url('../fonts/gudea-v10-latin-regular.woff2') format('woff2') points to ../fonts/ which is the directory whrere I uploaded the font files)
  • the last step is the most critical one, because it will be overwritten in case of a template update. I open the file templates/j51_xxx/inc/fonts.php. There I disable the lines with the loop, starting with "foreach ($googlefonts as $v) { // loop" and add a line below which contains: $app->getDocument()->addStyleSheet('/templates/j51_xxx/css/local-fonts.css');


Now all my webfonts are called from my local webserver.

Maybe its an idea to set a folderpath in the template for a local fonts file. And if local fonts = YES then set the value also in the fonts.php.
Then the files upload and the local-fonts.css content must still be done by the user, but the danger of overwriting the fonts.php is no longer available.

If this is not possible maybe its possible to add this as tutorial article. In this case I would write it more detailed.

Regards
Oliver
Accepted Answer Pending Moderation
0
Votes
Undo
Thank you Oliver

This is very helpful indeed. With your permission we would love to include this in our tutorial section as it is a question that comes up quite often.

Wish in you and yours a very happy new year :)

Ciaran
  1. more than a month ago
  2. News / Announcements
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Hello Ciaran,
sorry for my late reply.

Of course you can use this, if you want, I send you a more detailed tutorial.

Regards
Oliver
  1. more than a month ago
  2. News / Announcements
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
Thank you Oliver

This tutorial is now available in our tutorials section (https://www.joomla51.com/tutorials/template-customization/localize-web-fonts).

Ciaran
  1. more than a month ago
  2. News / Announcements
  3. # 3
Accepted Answer Pending Moderation
0
Votes
Undo
Hello Oliver, Hello Ciaran,

I use the j51_jasmine template and followed these instructions exactly to host the fonts locally. Unfortunately it doesn't work for me and I get an error message when I call up the page.

0 unmatched '}'

I've attached a screenshot.

Am I missing something or am I still doing something wrong?

Please excuse my bad English, I use google translate.

Greetings Olaf
Attachments (1)
  1. more than a month ago
  2. News / Announcements
  3. # 4
Accepted Answer Pending Moderation
0
Votes
Undo
Solved
I have made a mistake.
It works now.
excuse
  1. more than a month ago
  2. News / Announcements
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!

Join Our Newsletter

* indicates required
We respect your privacy and do not tolerate spam and will never sell, rent, lease or give away your information (name, email, number, etc.) to any third party. Nor will we send you unsolicited email.
Joomla51 - Mullaghmore, Co. Sligo, Ireland
Joomla51.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by
Open Source Matters
the trademark holder in the United States and other countries.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok