fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: One and a half issues with Google Fonts

One and a half issues with Google Fonts 10 months 3 weeks ago #30619

  • lousyfool
  • lousyfool's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 4
  • Karma: 0
Case:
- Astroid 2.5.2 "dev" from GitHub
- Template "Zero" (ditto), or any other
- Typography settings: Body "Nunito", all others "Default", font weights only 400 and 700
- No server, Joomla or other cache. Astroid and browser caches cleared.

First problem:

Error in JS console (typically 2 lines of this) :
GET https://fonts.googleapis.com/css2?family=Nunito:[email protected];200i;300;300i;400;400i;600;600i;700;700i;800;800i;900;900i&display=swap net::ERR_ABORTED 400

Symptom in frontend:
In case of Nunito, the body font looks more like a 600 weight. (With some other fonts (e.g. Open Sans) it seems still ok, though.)

Cause:
The value of the "family" parameter in the "googleapis" URL as generated by Astroid is wrong. Indeed, loading the URL in a browser generates the 400 error. Try it!

Fix:
According to fonts.google.com/, the URL should be like this:
https://fonts.googleapis.com/css2?family=Nunito:ital,[email protected],200;0,300;0,400;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap
Note the difference.

So, you'll need to fix the URL generation in the "loadGoogleFont() function in /libraries/astroid/framework/library/astroid/Helper/Font.php (and/or eventually in /media/astroid/assets/json/webfonts.json).


The half issue:

If I'm specifying only one or two font weights in Astroid, why do you force-load all weights from Google? It unnecessarily increases the overhead, obviously.
For instance, in my case this would be enough:
https://fonts.googleapis.com/css2?family=Nunito:ital,[email protected],400;0,700;1,400;1,700&display=swap
Shouldn't be a big issue to improve the code accordingly, to only load weights and styles as spec'd in Astroid.
(I'm thinking of "the Average Joe" here = the Astroid user who doesn't know or bother, yet minds about site performance. I know I could as well have the fonts locally on my server and load them from there... and I'll certainly do that if I really ever use Astroid on a production site...)

Conclusion:

Obviously, you'll also want to make these and other "recent" (made in the last 5 months!!!) changes in "dev" available in a new version for the public, no?

Please keep us all posted on your progress, hopefully in a timely fashion.

If you need professional and affordable help due to a lack of experience or in-depth knowledge of web development etc, including Joomla, config, structure & design, customisations or avoidance/fixing of errors: contact me at This email address is being protected from spambots. You need JavaScript enabled to view it. (English or German)
Last Edit: 10 months 2 weeks ago by lousyfool.
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 3 weeks ago #30648

  • chandandeep
  • chandandeep's Avatar
  • Offline
  • Administrator
  • Posts: 4614
  • Thank you received: 652
  • Karma: 116
Please test again. We fixed it in the dev branch.
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.

To know more about products check out the their documentation.
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 3 weeks ago #30650

  • lousyfool
  • lousyfool's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 4
  • Karma: 0
Yup, partially solved.

Still having multiple "preconnect" in the head tag:

But that's a minor "issue", I guess.

More see next post below.

Thanks!

If you need professional and affordable help due to a lack of experience or in-depth knowledge of web development etc, including Joomla, config, structure & design, customisations or avoidance/fixing of errors: contact me at This email address is being protected from spambots. You need JavaScript enabled to view it. (English or German)
Last Edit: 10 months 2 weeks ago by lousyfool. Reason: "partially" and "More see next post below" added
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 2 weeks ago #30655

  • lousyfool
  • lousyfool's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 4
  • Karma: 0
Even if only e.g. font-weight 400 and non-italic is specified for all typography in Astroid, still all available weights including italic are loaded for that font from Google, though.

And in a template like Medicx there are no less than eight (8!) "preconnect" link tags in the head.

Hmmm... all very unnecessary. :dry:

If you need professional and affordable help due to a lack of experience or in-depth knowledge of web development etc, including Joomla, config, structure & design, customisations or avoidance/fixing of errors: contact me at This email address is being protected from spambots. You need JavaScript enabled to view it. (English or German)
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 2 weeks ago #30658

  • chandandeep
  • chandandeep's Avatar
  • Offline
  • Administrator
  • Posts: 4614
  • Thank you received: 652
  • Karma: 116
We will fix "preconnect" issue also.
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.

To know more about products check out the their documentation.
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 2 weeks ago #30664

  • chandandeep
  • chandandeep's Avatar
  • Offline
  • Administrator
  • Posts: 4614
  • Thank you received: 652
  • Karma: 116
multiple "preconnect" issue is fixed.
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.

To know more about products check out the their documentation.
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 2 weeks ago #30667

  • lousyfool
  • lousyfool's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 4
  • Karma: 0
chandandeep wrote:
multiple "preconnect" issue is fixed.

Yes, thanks.

Now still remaining:

1. Actually, according to fonts.google.com/, there should be two "preconnects", like this:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
and obviously they should be placed before the fonts are loaded from Google.
Astroid currently does only
<link rel="preconnect" href="https://fonts.gstatic.com">
at the very end of the head = too late, haha.

2. Still, Astroid loads all styles of a font, no matter what little is specified/used.
Example: if I'm specifying/using only "Roboto 300 non-italic", nothing else, this should be the head entry (after the "preconnect", indeed):
<link href="https://fonts.googleapis.com/css2?family=Roboto:[email protected]&display=swap" rel="stylesheet">
Instead, this is what Astroid is putting there:
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,[email protected],100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet" type="text/css">
Overkill...

If you need professional and affordable help due to a lack of experience or in-depth knowledge of web development etc, including Joomla, config, structure & design, customisations or avoidance/fixing of errors: contact me at This email address is being protected from spambots. You need JavaScript enabled to view it. (English or German)
The administrator has disabled public write access.

One and a half issues with Google Fonts 10 months 2 weeks ago #30725

  • chandandeep
  • chandandeep's Avatar
  • Offline
  • Administrator
  • Posts: 4614
  • Thank you received: 652
  • Karma: 116
Sorry for the delay. I will share this post with the dev team. We will fix it soon.
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.

To know more about products check out the their documentation.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: chandandeep
Time to create page: 0.400 seconds
Cron Job Starts