0
Welcome Guest! Login
0 items Join Now

No special characters with google fonts - solution

    • Krx's Avatar
    • Krx
    • Sr. Rocketeer
    • Posts: 120
    • Thanks: 1

    No special characters with google fonts - solution

    Posted 1 year 5 months ago
    • Hi
      I've noticed that our (Croatian) šđčćž special characters was missing in titles and menu links if (newer) template was set to use Google fonts.
      After some investigation I've found the solution.
      In order to render (various) special characters, command to load Google fonts needs to be extended like this:
      " fonts.googleapis.com/css?family=Allura " - just add this to end: "&subset=latin,latin-ext"
      so that it looks like this:
      " fonts.googleapis.com/css?family=Allura&subset=latin,latin-ext "

      Example with Gantry in Kirigami template in template/features/font.php file:
      old code, approx line 115:
      $gantry->addStyle('//fonts.googleapis.com/css?family=' . str_replace(" ", "+", $name) . $variant);
      new code:
      $gantry->addStyle('//fonts.googleapis.com/css?family=' . str_replace(" ", "+", $name) . "&subset=latin,latin-ext" .$variant);

      This bothered me for months, but now finally I can see our special characters in desired font.
      I hope that this will help someone with similar issue. :cheesy:

      Hint: Maybe RT could extend Gantry font settings so that we can select various subsets?

      Regards
  • Re: No special characters with google fonts - solution

    Posted 1 year 5 months ago
    • Thank you very much for this suggestion. I will pass this to our devs so they can take a look and decide to add this (hopefully) in the future Gantry updates :)
    • Please search forums before posting. Please make sure your post includes the Joomla version you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals.
    • render8's Avatar
    • render8
    • Rocketeer
    • Posts: 51
    • Thanks: 1

    Re: No special characters with google fonts - solution

    Posted 1 year 3 months ago
    • That would be nice.
  • Re: No special characters with google fonts - solution

    Posted 1 year 2 months ago
    • Maybe it will be good to make it also in Gantry Framework in future versions. I have changed file libraries/gantry/features/font.php by adding
      . "&subset=latin,latin-ext"
      on line 113 and it works.
    • Krx's Avatar
    • Krx
    • Sr. Rocketeer
    • Posts: 120
    • Thanks: 1

    Re: No special characters with google fonts - solution

    Posted 1 year 2 months ago
    • Hi

      I wonder how come that this feature needs so much time to be implemented.
      This is essential feature for all users which uses special characters.
      They just need to add one multiselect list next to Font chooser in template settings,
      to enable subset settings, and tweak code to accommodate this extra setting.
      Now, we need to check and/or reedit this after every gantry upgrade.

      Regards
    • Krx's Avatar
    • Krx
    • Sr. Rocketeer
    • Posts: 120
    • Thanks: 1

    Re: No special characters with google fonts - solution

    Posted 11 months 4 days ago
    • Hello

      Please add this feature in Gantry template font settings.
      Just add multiple select list next to the font settings to choose desired subset
      It's getting tiresome to add it manually whenever Gantry updates
      Pretty please? :cheesy:

      Regards
    • Henning's Avatar
    • Henning
    • Preeminent Rocketeer
    • Posts: 27726
    • Thanks: 464
    • Volunteer

    Re: No special characters with google fonts - solution

    Posted 11 months 4 days ago
    • Since loading fonts from external source has a very bad impact in the loading time we can't really recommend doing that (no matter if it's google, typekit or extensis ...)

      The google-fonts feature in gantry is really something for those that look for
      the most simple way to use them.
      If you are serious about web-design I suggest to add the google code directly to your index.php or even better host the fonts yourself.

      Without having too much inside into RT I would say ... for a more advanced font solution you probably have to wait for Gantry 5.
    • Krx's Avatar
    • Krx
    • Sr. Rocketeer
    • Posts: 120
    • Thanks: 1

    Re: No special characters with google fonts - solution

    Posted 11 months 4 days ago
    • Thanks for your advice

      Regards
    • Henning's Avatar
    • Henning
    • Preeminent Rocketeer
    • Posts: 27726
    • Thanks: 464
    • Volunteer

    Re: No special characters with google fonts - solution

    Posted 11 months 4 days ago
    • Just to make complete:
      You dont have to change ibraries/gantry/features/font.php.
      Now, we need to check and/or reedit this after every gantry upgrade.

      Not true. You can easily override font.php.
      All you need to do is to copy libraries/gantry/features/font.php into the features folder of your template.
      That's the file you need to change now and it won't get overridden with every Gantry or template update.
    • Krx's Avatar
    • Krx
    • Sr. Rocketeer
    • Posts: 120
    • Thanks: 1

    Re: No special characters with google fonts - solution

    Posted 11 months 4 days ago
    • Thanks Henning

      I wonder why I haven't tried it by myself. Previous templates had font.php in template dir, but with recent Gantry updates, it went into gantry own folder.

      Regards

Time to create page: 0.085 seconds