astra_get_font_array_css( string $font_family, string $font_weight, array $font_size, string $font_extras, string $color = '' )

Function which will return CSS array for font specific props for further parsing CSS.


Description

It includes – font-family, font-weight, font-size, line-height, text-transform, letter-spacing, text-decoration, color (optional).


Parameters

$font_family

(string) (Required) Font family.

$font_weight

(string) (Required) Font weight.

$font_size

(array) (Required) Font size.

$font_extras

(string) (Required) contains all font controls.

$color

(string) (Optional) In most of cases color is also added, so included optional param here.

Default value: ''


Return

(array) array of build CSS font settings.


Source

File: inc/extras.php

function astra_get_font_array_css( $font_family, $font_weight, $font_size, $font_extras, $color = '' ) {
	$font_extras_ast_option = astra_get_option(
		$font_extras,
		array(
			'line-height'         => '',
			'line-height-unit'    => 'em',
			'letter-spacing'      => '',
			'letter-spacing-unit' => 'px',
			'text-transform'      => '',
			'text-decoration'     => '',
		) 
	);
	return array(
		'color'           => esc_attr( $color ),
		'font-family'     => astra_get_css_value( $font_family, 'font' ),
		'font-weight'     => astra_get_css_value( $font_weight, 'font' ),
		'font-size'       => ! empty( $font_size ) ? astra_responsive_font( $font_size, 'desktop' ) : '',
		'line-height'     => astra_get_font_extras( $font_extras_ast_option, 'line-height', 'line-height-unit' ),
		'text-transform'  => astra_get_font_extras( $font_extras_ast_option, 'text-transform' ),
		'letter-spacing'  => astra_get_font_extras( $font_extras_ast_option, 'letter-spacing', 'letter-spacing-unit' ),
		'text-decoration' => astra_get_font_extras( $font_extras_ast_option, 'text-decoration' ),
	);
}

Changelog

Changelog
Version Description
4.0.0 Introduced.


User Contributed Notes

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