wp-includes/fonts/class-wp-font-face.php:15Font Face generates and prints @font-face styles for given fonts.
$font_face_property_defaultsstring[]private$valid_font_face_propertiesstring[]private$valid_font_displaystring[]privateclass WP_Font_Face { /** * The font-face property defaults. * * @since 6.4.0 * * @var string[] */ private $font_face_property_defaults = array( 'font-family' => '', 'font-style' => 'normal', 'font-weight' => '400', 'font-display' => 'fallback', ); /** * Valid font-face property names. * * @since 6.4.0 * * @var string[] */ private $valid_font_face_properties = array( 'ascent-override', 'descent-override', 'font-display', 'font-family', 'font-stretch', 'font-style', 'font-weight', 'font-variant', 'font-feature-settings', 'font-variation-settings', 'line-gap-override', 'size-adjust', 'src', 'unicode-range', ); /** * Valid font-display values. * * @since 6.4.0 * * @var string[] */ private $valid_font_display = array( 'auto', 'block', 'fallback', 'swap', 'optional' ); /** * Generates and prints the `@font-face` styles for the given fonts. * * @since 6.4.0 * * @param array[][] $fonts Optional. The font-families and their font variations. * See {@see wp_print_font_faces()} for the supported fields. * Default empty array. */ public function generate_and_print( array $fonts ) { $fonts = $this->validate_fonts( $fonts ); // Bail out if there are no fonts are given to process. if ( empty( $fonts ) ) { return; } $css = $this->get_css( $fonts ); /* * The font-face CSS is contained within <style> tags and can only be interpreted * as CSS in the browser. Using wp_strip_all_tags() is sufficient escaping * to avoid malicious attempts to close </style> and open a <script>. */ $css = wp_strip_all_tags( $css ); // Bail out if there is no CSS to print. if ( empty( $css ) ) { return; }Introduced in 6.4.0. 3 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
__construct() removed.verified against sourceget_style_element() removed.verified against sourcegenerate_style_element_attributes() removed.verified against sourcesrc/wp-includes/fonts/class-wp-font-face.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.