Hi,
I think it’s necessary that sometimes we need to have the same font-family
, but just different font files for different font styles.
Understood we could have separated the normal and italic font styles to two distinct fonts via Custom Fonts plugin, and subsequently tag each font to different set of selectors. For example normal style for <body/>
and italic for <em/>
respectively. But this might not work for elements with CSS rule of font-style: italic;
, especially when we use third party widgets which we have no control over their implementation at all.
Technically, you are right, it’s not an issue. But in reality, this might not be an ideal solution. May I propose a solution by adding the following line of code to function bcf_prepare_lfont_face_css
under file helper-functions.php
$font_face .= ! empty( $variation_data['font_style'] ) ? "\tfont-style: " . $variation_data['font_style'] . ';' . PHP_EOL : '';
The chunk of code should look similar to
$src = array();
$font_face = '@font-face {' . PHP_EOL;
$font_face .= "\tfont-family: '" . $font_family . "';" . PHP_EOL;
$font_face .= ! empty( $variation_data['font_style'] ) ? "\tfont-style: " . $variation_data['font_style'] . ';' . PHP_EOL : '';
$font_face .= ! empty( $variation_data['font_weight'] ) ? "\tfont-weight: " . $variation_data['font_weight'] . ';' . PHP_EOL : '';
$font_face .= ! empty( $font_data['font_display'] ) ? "\tfont-display: " . $font_data['font_display'] . ';' . PHP_EOL : '';
$font_face .= ! empty( $font_data['font_fallback'] ) ? "\tfont-fallback: " . $font_data['font_fallback'] . ';' . PHP_EOL : '';
Please consider this code change and hope it helps.