WP_Font_Face::get_css( array $font_faces ): string

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Gets the @font-face CSS styles for locally-hosted font files.

Description

This method does the following processing tasks:

  1. Orchestrates an optimized src (with format) for browser support.
  2. Generates the @font-face for all its fonts.

Parameters

$font_facesarrayrequired
The font-faces to generate @font-face CSS styles.

Return

string The @font-face CSS styles.

Source

private function get_css( $font_faces ) {
	$css = '';

	foreach ( $font_faces as $font_face ) {
			// Order the font's `src` items to optimize for browser support.
			$font_face = $this->order_src( $font_face );

			// Build the @font-face CSS for this font.
			$css .= '@font-face{' . $this->build_font_face_css( $font_face ) . '}' . "\n";
	}

	// Don't print the last newline character.
	return rtrim( $css, "\n" );
}

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.