[Resolved] Font weights

Home Forums Support [Resolved] Font weights

Home Forums Support Font weights

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #805899
    Jason

    Hello,

    I am having some trouble with the font weights, hoping you can help. In this reply, you mentioned that all of the variants are loaded by default:

    https://generatepress.com/forums/topic/generatepress-adds-all-the-google-font-weights/

    However, I am not experiencing this. For example, I would like to use Poppins for my headings and google fonts shows it has variants 100-900. However in customizer, headings, I only have 300, regular, 500, 700 font weights to choose from.

    I saw in some forum posts, you suggest altering the PHP to include custom fonts and variations. However, I don’t think this is a good solution. If I were to hand this site off to a client they are going to expect the font weights to function like any other theme without coding in the functions.php or adding custom css.

    Can you help me identify how to get all of the variations of all google fonts to load in the customizer? Thank you guys.

    #806023
    Tom
    Lead Developer
    Lead Developer

    Hi Jason,

    It’s likely that we just need to update our built-in list to include those new variants.

    For now, you will need to add a function to the site. However, this function adds the missing variants to the Customizer option – it doesn’t make it necessary to add custom CSS or do anything different.

    add_filter( 'generate_typography_customize_list', function( $fonts ) {
        $fonts['poppins']['variants'] = array( '100', '200', '300', '400' );
    	
        return $fonts;
    } );

    You can adjust the list of variants to whatever you like.

    #808601
    Jason

    Thank you for the reply.

    While that may help in one instance, font trends are always changing….and so is the need to update fonts. I don’t think adding a function or CSS on a per case basis is going to work.

    Is there a way to update the database? Would you suggest I add a font plugin? Help lol

    #808815
    Tom
    Lead Developer
    Lead Developer

    The only way to do what you’re wanting is to have a direct link to the Google Fonts API which updates fonts and variants automatically. Technically, I believe it’s possible. However, it can introduce a lot of issues as well. It’s something I’d like to get figured out.

    I’m not sure what you mean about updating the database?

    #808819
    Jason

    I was referencing:

    “It’s likely that we just need to update our built-in list to include those new variants.”

    I am not certain what’s involved to update your list/data but if you could do that I would appreciate it. I am running into this issue all over the place. Just created a subheading and font weight missing for that font also!

    #808835
    Tom
    Lead Developer
    Lead Developer

    I’ll see if we can get that updated in the next GP Premium update πŸ™‚

    #809600
    Jason

    Thanks!

    I used the filter above and it worked. However when I tried to do the same for josefin sans font, it didn’t work.

    Can you tell me. Is this correct?

    add_filter( ‘generate_typography_customize_list’, function( $fonts ) {
    $fonts[‘josefin sans’][‘variants’] = array( ‘100’, ‘200’, ‘300’, ‘400’ );

    return $fonts;
    } );

    #809783
    Tom
    Lead Developer
    Lead Developer

    Looks like you’re just missing the underscore in the name:

    add_filter( 'generate_typography_customize_list', function( $fonts ) {
        $fonts['josefin_sans']['variants'] = array( '100', '200', '300', '400' );
    
        return $fonts;
    } );

    Let me know πŸ™‚

    #809838
    Jason

    Worked perfectly thanks

    #809839
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

    #2052872
    Jan

    Hi Tom,

    I’m having the same issue. As of GPP v2.1.1 there is presumably an easier way for adding a font-weight of say 600 to the Font Manager, correct?

    Background: I have added Google-fond “Quicksand” to the Font Manager. Whether I select H2 font-weight “bold” or “600” does not make any difference ;-(

    I sense that something else is needed in order to get font-weight 600 to take effect. (See screenshot).

    Any advice is much appreciated.

    Thanks,
    Jan

    #2053215
    Ying
    Staff
    Customer Support

    Hi Jan,

    Have you assigned the font to H2? https://www.screencast.com/t/kzBhA4xLeZF

    And Have you defined the typography in the page editor for this specific H2?

    Any chance you can open a new topic and link us to the page?

    #2053485
    Jan

    Hi Ying,

    Thanks for sharing the screenshot. I forgot to define the typography for H2.

    It works fine now.

    Best,
    Jan

    #2054690
    Ying
    Staff
    Customer Support

    You are welcome πŸ™‚

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.