0
Welcome Guest! Login
0 items Join Now

Google font subset (script) selection

    • DenisBz's Avatar
    • DenisBz
    • Jr. Rocketeer
    • Posts: 31
    • Thanks: 0

    Google font subset (script) selection

    Posted 10 years 11 months ago
    • Please add Google Font subset selection, named 'script' on Google Fonts site. Currently Latin script is used by default and hardcoded in Gantry files (on Joomla it is /libraries/gantry/features/font.php). To choose another font script I change the code to llok like below, but with every Gantry update it is lost. Would be great to see it in settings in the backend. Thanks.
      	function _addGoogleFont($name, $variant)
      	{
      		/** @var $gantry Gantry */
      		global $gantry;
      
      		$variant = $variant ? $variant : '';
      
      		$protocol = JUri::getInstance()->isSSL() ? 'https' : 'http';
      		$gantry->addStyle("{$protocol}://fonts.googleapis.com/css?family=" . str_replace(" ", "+", $name) . $variant . "&subset=cyrillic-ext,latin,latin-ext,cyrillic");
      		$gantry->addInlineStyle("h1, h2 { font-family: '" . $name . "', 'Helvetica', arial, serif; }");
      	}
    • Last Edit: 10 years 11 months ago by DenisBz.
    • Henning's Avatar
    • Henning
    • Preeminent Rocketeer
    • Posts: 29362
    • Thanks: 954
    • Volunteer

    Re: Google font subset (script) selection

    Posted 10 years 11 months ago
    • Just copy
      /libraries/gantry/features/font.php
      into the features folder of the template.

      Change the code for your needs.
      You won't loose that file when you update Gantry ot the template.


      Not really hardcoded ... in fact Gantry is "overridable" in many aspects ... and pretty flexible.
      You can see the font.php just as an exmaple how a feature-concept in Gantry works.
      It's a "real" framework ...
    • Last Edit: 10 years 11 months ago by Henning.
    • DenisBz's Avatar
    • DenisBz
    • Jr. Rocketeer
    • Posts: 31
    • Thanks: 0

    Re: Google font subset (script) selection

    Posted 10 years 11 months ago
    • Great, thank you for a quick response!
    • Yulya's Avatar
    • Yulya
    • Newbie
    • Posts: 6
    • Thanks: 0

    Re: Google font subset (script) selection

    Posted 10 years 5 months ago
    • hi, where is that file in WP?
      i have the same problem.
    • Henning's Avatar
    • Henning
    • Preeminent Rocketeer
    • Posts: 29362
    • Thanks: 954
    • Volunteer

    Re: Google font subset (script) selection

    Posted 10 years 5 months ago

Time to create page: 0.074 seconds