Automattic\WooCommerce\EmailEditor\Engine

Site_Style_Sync_Controller::convert_typography_stylesprivateWC 1.0

Convert site typography styles to email format

Method of the class: Site_Style_Sync_Controller{}

No Hooks.

Returns

Array. Email-compatible typography styles.

Usage

// private - for code of main (parent) class only
$result = $this->convert_typography_styles( $typography_styles ): array;
$typography_styles(array) (required)
Site typography styles.

Site_Style_Sync_Controller::convert_typography_styles() code WC 10.5.0

private function convert_typography_styles( array $typography_styles ): array {
	$email_typography = array();

	// Handle special cases with processors.
	$this->resolve_and_assign( $typography_styles, 'fontFamily', $email_typography, array( $this, 'convert_to_email_safe_font' ) );
	$this->resolve_and_assign( $typography_styles, 'fontSize', $email_typography, array( $this, 'convert_to_px_size' ) );

	// Handle compatible properties without processing.
	$compatible_props = array( 'fontWeight', 'fontStyle', 'lineHeight', 'letterSpacing', 'textTransform', 'textDecoration' );
	foreach ( $compatible_props as $prop ) {
		$this->resolve_and_assign( $typography_styles, $prop, $email_typography );
	}

	return $email_typography;
}