WP_Font_Face_Resolver::convert_font_face_properties( array $font_face_definition, string $font_family_property ): array

In this article

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.

Converts font-face properties from theme.json format.

Parameters

$font_face_definitionarrayrequired
The font-face definitions to convert.
$font_family_propertystringrequired
The value to store in the font-face font-family property.

Return

array Converted font-face properties.

Source

private static function convert_font_face_properties( array $font_face_definition, $font_family_property ) {
	$converted_font_faces = array();

	foreach ( $font_face_definition as $font_face ) {
		// Add the font-family property to the font-face.
		$font_face['font-family'] = $font_family_property;

		// Converts the "file:./" src placeholder into a theme font file URI.
		if ( ! empty( $font_face['src'] ) ) {
			$font_face['src'] = static::to_theme_file_uri( (array) $font_face['src'] );
		}

		// Convert camelCase properties into kebab-case.
		$font_face = static::to_kebab_case( $font_face );

		$converted_font_faces[] = $font_face;
	}

	return $converted_font_faces;
}

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

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