Limit font variants in text blocks

Hello everyone.

How can I limit the variants that are loaded of the fonts in all blocks with text in generateblocks?
For example if I want Roboto it will always load only 300,400,500 and 700 instead of all the variants it has.

This is because every time I create a block (that is not reusable) I have to remove the variants that I don’t want.

Can it be done with some code in functions.php?

I have generatepress premium and generateblocks pro.

Sorry for not posting a support ticket, but it seems to me that the community is a place where others who have the same problem can take advantage of it later, as we have in the generatepress premium forum.

Hi there,

Welcome to the community!

Our Blocks should only load the variants that it detects it needs based on your chosen font weights for that Google font.

Are you saying that all of the variants are loading even though you’re only using one weight on the page? Any chance you can share the page with us?

Hi Tom, I hadn’t answered before since I was working full with generateblocks :wink:

When I load a font Google fonts like Roboto, all the variants are placed in the respective box (automatically), even if I only use as weight for example 300.

I have to delete the other variants and put only 300, and so on with all the fonts I choose on the page, even if I only use Roboto.

If I don’t delete the other variants when I select the weight, it loads them all.

Is that the expected behavior of generateblocks with the font variants?

If so, I was asking you if there was any option to not have to delete all the variants manually and leave only the one that interests you, since many times when I have many blocks it becomes quite heavy.

I leave you screenshots and the link of the page. If you want access, tell me which way I pass them.

Ah, yes - it will automatically add the available variants for that font into the box for you based on what GB knows about the font. Unfortunately, it’s very difficult to only add the necessary ones based on the weight you’ve chosen.

Google Fonts are very difficult to build a nice UI for, unfortunately.

Ok Tom, no problem.