Generates and prints font-face styles for given fonts or theme.json fonts.
Parameters
$fontsarray[][]optional- The font-families and their font faces.
...$0arrayAn indexed or associative (keyed by font-family) array of font variations for this font-family.
Each font face has the following structure....$0arrayThe font face properties.font-familystringThe font-family property.srcstring|string[]The URL(s) to each resource containing the font data.font-stylestringOptional. The font-style property. Default'normal'.font-weightstringOptional. The font-weight property. Default'400'.font-displaystringOptional. The font-display property. Default'fallback'.ascent-overridestringOptional. The ascent-override property.descent-overridestringOptional. The descent-override property.font-stretchstringOptional. The font-stretch property.font-variantstringOptional. The font-variant property.font-feature-settingsstringOptional. The font-feature-settings property.font-variation-settingsstringOptional. The font-variation-settings property.line-gap-overridestringOptional. The line-gap-override property.size-adjuststringOptional. The size-adjust property.unicode-rangestringOptional. 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