Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #40136

    xavier x
    Participant

    Hi,

    I am using a custom font (dosis)
    I want to use font-weight: 300, however this is not provided.
    How can font-weight 300 be added to the custom font?

    Thanks!

    @font-face {
    font-family: ‘Dosis’;
    font-style: normal;
    font-weight: 400;
    src: local(‘Dosis Regular’), local(‘Dosis-Regular’), url(http://themes.googleusercontent.com/static/fonts/dosis/v2/7L9_zC5qZfwiKVyE9UcfBqCWcynf_cDxXwCLxiixG1c.woff) format(‘woff’);
    }
    @font-face {
    font-family: ‘Dosis’;
    font-style: normal;
    font-weight: 700;
    src: local(‘Dosis Bold’), local(‘Dosis-Bold’), url(http://themes.googleusercontent.com/static/fonts/dosis/v2/SD_sh9aV9vitKsBsjDXok3YhjbSpvc47ee6xR_80Hnw.woff) format(‘woff’);
    }

    #40238

    Christian
    Moderator

    Hey Xavier,

    If your font doesn’t have that font weight, we’re sad to say that there is no remedy for it.

    Thank you for understanding.

    #41483

    xavier x
    Participant

    Hi Support,

    Dosis has that font weight however you are not loading this.
    We need 300 and 200.

    Check here -> https://www.google.com/fonts#UsePlace:use/Collection:Dosis

    Thanks for any assistance provided.

    Xavier.

    #41887

    Rad
    Moderator

    Hi there,

    You gave a link from google font, this means you’re able to use a direct link from google.

    First, remove those css you given above.

    Then add this code at your child theme’s functions.php

    add_action('wp_head', 'x_font_dosis');
    function x_font_dosis() {
    ?>
    <link href='http://fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700,800' rel='stylesheet' type='text/css'>
    <?php
    }

    If you examine the link http://fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700,800 , you’re given a css with different font weights.

    Hope this helps.

    #42022

    xavier x
    Participant

    Hi Support,

    Thanks for the reply!
    I know this can be done like that, but I am selecting this font through the customizer which results in this font getting loaded in the theme:
    <link rel=’stylesheet’ id=’x-font-custom-css’ href=’http://fonts.googleapis.com/css?family=Dosis:400,400italic,700,700italic|Dosis:400|Dosis:400|Dosis:400&subset=latin,latin-ext’ type=’text/css’ media=’all’ />

    So I would expect this to be done at the Customizer level right?

    best

    Xavier

    #42316

    Rad
    Moderator

    Hi Xavier,

    Yes of course, but depending on chosen font, then font weight options may varies. If you need some font weight options that wasn’t there, then you will have to load/embed it manually at your child theme.

    You could change your “Body Font Weight” or any font settings at Customizer’s Typography area.

    Using Dosis, it ranges from 200 to 800, while 400 is the regular size.

    Thank you.