Generates and prints font-face styles for given fonts or theme.json fonts.
Parameters
$fonts
array[][]optional- The font-families and their font faces.
...$0
arrayAn indexed or associative (keyed by font-family) array of font variations for this font-family.
Each font face has the following structure....$0
arrayThe font face properties.font-family
stringThe font-family property.src
string|string[]The URL(s) to each resource containing the font data.font-style
stringOptional. The font-style property. Default'normal'
.font-weight
stringOptional. The font-weight property. Default'400'
.font-display
stringOptional. The font-display property. Default'fallback'
.ascent-override
stringOptional. The ascent-override property.descent-override
stringOptional. The descent-override property.font-stretch
stringOptional. The font-stretch property.font-variant
stringOptional. The font-variant property.font-feature-settings
stringOptional. The font-feature-settings property.font-variation-settings
stringOptional. The font-variation-settings property.line-gap-override
stringOptional. The line-gap-override property.size-adjust
stringOptional. The size-adjust property.unicode-range
stringOptional. The unicode-range property.
}
Default:
array()
Source
function wp_print_font_faces( $fonts = array() ) { if ( empty( $fonts ) ) { $fonts = WP_Font_Face_Resolver::get_fonts_from_theme_json(); } if ( empty( $fonts ) ) { return; } $wp_font_face = new WP_Font_Face(); $wp_font_face->generate_and_print( $fonts ); }
Changelog
Version Description 6.4.0 Introduced.
You must log in before being able to contribute a note or feedback.
User Contributed Notes