wppaste
WordPress

WP_Font_Face

Since
6.4.0
Source
wp-includes/fonts/class-wp-font-face.php:15
Font Face generates and prints @font-face styles for given fonts.

Compatibility

WordPress
since 6.4.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 4

$font_face_property_defaultsstring[]private
The font-face property defaults.
$valid_font_face_propertiesstring[]private
Valid font-face property names.
$valid_font_displaystring[]private
Valid font-display values.
$style_tag_attrsstring[]private
Array of font-face style tag's attribute(s) where the key is the attribute name and the value is its value.

Methods · 11

Source code

class 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' ); 	/**	 * Array of font-face style tag's attribute(s)	 * where the key is the attribute name and the	 * value is its value.	 *	 * @since 6.4.0	 *	 * @var string[]	 */	private $style_tag_attrs = array(); 	/**	 * Creates and initializes an instance of WP_Font_Face.	 *	 * @since 6.4.0	 */	public function __construct() {		if (			function_exists( 'is_admin' ) && ! is_admin()			&&			function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'style' )		) {			$this->style_tag_attrs = array( 'type' => 'text/css' );		}	} 	/**	 * Generates and prints the `@font-face` styles for the given fonts.	 *	 * @since 6.4.0	 *

Changelog

Introduced in 6.4.0. 3 changes between 6.7.7 and 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

7.0.4
Method __construct() removed.verified against source
7.0.4
Method get_style_element() removed.verified against source
7.0.4
Method generate_style_element_attributes() removed.verified against source
6.4.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/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.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.