[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/fonts/ -> class-wp-font-face-resolver.php (summary)

WP_Font_Face_Resolver class.

File Size: 173 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Font_Face_Resolver:: (6 methods):
  get_fonts_from_theme_json()
  parse_settings()
  maybe_parse_name_from_comma_separated_list()
  convert_font_face_properties()
  to_theme_file_uri()
  to_kebab_case()


Class: WP_Font_Face_Resolver  - X-Ref

The Font Face Resolver abstracts the processing of different data sources
(such as theme.json) for processing within the Font Face.

This class is for internal core usage and is not supposed to be used by
extenders (plugins and/or themes).

get_fonts_from_theme_json()   X-Ref
Gets fonts defined in theme.json.

return: array Returns the font-families, each with their font-face variations.

parse_settings( array $settings )   X-Ref
Parse theme.json settings to extract font definitions with variations grouped by font-family.

return: array Returns an array of fonts, grouped by font-family.
param: array $settings Font settings to parse.

maybe_parse_name_from_comma_separated_list( $font_family )   X-Ref
Parse font-family name from comma-separated lists.

If the given `fontFamily` is a comma-separated lists (example: "Inter, sans-serif" ),
parse and return the fist font from the list.

return: string Font-family name.
param: string $font_family Font family `fontFamily' to parse.

convert_font_face_properties( array $font_face_definition, $font_family_property )   X-Ref
Converts font-face properties from theme.json format.

return: array Converted font-face properties.
param: array  $font_face_definition The font-face definitions to convert.
param: string $font_family_property The value to store in the font-face font-family property.

to_theme_file_uri( array $src )   X-Ref
Converts each 'file:./' placeholder into a URI to the font file in the theme.

The 'file:./' is specified in the theme's `theme.json` as a placeholder to be
replaced with the URI to the font file's location in the theme. When a "src"
beings with this placeholder, it is replaced, converting the src into a URI.

return: array An array of font file src URI(s).
param: array $src An array of font file sources to process.

to_kebab_case( array $data )   X-Ref
Converts all first dimension keys into kebab-case.

return: array Data with first dimension keys converted into kebab-case.
param: array $data The array to process.



Generated : Sun Apr 28 08:20:02 2024 Cross-referenced by PHPXref