Site logo

Archived topic

Full library Google Fonts is not loaded

5 replies · Started by Felipe on April 25, 2018

Viewing posts 1–6 of 6

I am trying to insert a specific font (IBM Plex Serif), but for some reason it is not loaded correctly.

I inserted this action into the child theme's functions.php, but the variants were not loaded on the front end.

add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
	$fonts[ 'plex_serif' ] = array( 
		'name' => 'IBM Plex Serif',
		'variants' => array( '200', '200i', '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
		'category' => 'serif'
	);
	
	return $fonts;
}

And when you enter the action that supposedly lists the entire library, this font still does not appear.

add_filter( 'generate_number_of_fonts','tu_show_all_available_google_fonts' );
function tu_show_all_available_google_fonts() {
	return 'all';
}

ibm

What could be happening?

When you add this function:

add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
	$fonts[ 'plex_serif' ] = array( 
		'name' => 'IBM Plex Serif',
		'variants' => array( '200', '200i', '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
		'category' => 'serif'
	);
	
	return $fonts;
}

Can you not select the font and variants within the Customizer?

I replaced the action that loads the entire library, to the above code.
The font appears in the list, but the variations are not loaded. It is only loaded with normal variation, or 400.

If in font weight I select bold, it is not changed to weight 600, but rather forced bold. The same thing happens with italics. It can be perceived by the letter A. The italic style has another design and not just slope.

Try this:

add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
	$fonts[ 'ibm_plex_serif' ] = array(
		'name' => 'IBM Plex Serif',
		'variants' => array( '200', '200i', '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
		'category' => 'serif'
	);

	return $fonts;
}

Worked perfectly!
Thank you :D

You're welcome :)

This archived topic is closed to new replies.