[ 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: 205 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Font_Face_Resolver:: (7 methods):
  get_fonts_from_theme_json()
  get_fonts_from_style_variations()
  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.

get_fonts_from_style_variations()   X-Ref
Gets fonts defined in style variations.

return: array Returns an array of font-families.

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

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

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.

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

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

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.
return: array Converted font-face properties.

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.

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

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

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



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref