Tagged: font weight
-
AuthorPosts
-
September 2, 2021 at 6:57 pm #1319543
I am having an issue with Work Sans. I want to use the 200 and the 300 but I seem to only be getting the 100 and the 400. I uploaded the Google font for the 300. I also tried the 2 additions to the CSS detailed in this thread:
@import url(‘https://fonts.googleapis.com/css2?family=Work+Sans:wght@300&display=swap’);
add_filter( ‘avf_google_heading_font’, ‘avia_add_content_font’);
add_filter( ‘avf_google_content_font’, ‘avia_add_content_font’);
function avia_add_content_font($fonts)
{
$fonts[‘Work Sans’] = ‘Open Sans:200,300, 400’;
$fonts[‘Work Sans’] = ‘Open Sans:200,300, 400’;
return $fonts;
}Right now I have selected Work Sans as the heading and body font in General Styling and used Advanced Styling to select the 300 version but I am getting the 100.
Thanks in advance for the guidance.
- This topic was modified 3 years, 3 months ago by tiffanytnttobol.
September 6, 2021 at 4:07 am #1319815Hey tiffanytnttobol,
Thank you for the inquiry.
The code above is actually assigning the Open Sans font and its variation to the Work Sans option in the backend. You have to adjust the code a bit.
function avia_font_mod($fonts){ $fonts['Work Sans New'] = 'Work Sans:100,200,300,400,600,700'; return $fonts; } add_filter( 'avf_google_heading_font', 'avia_font_mod'); add_filter( 'avf_google_content_font', 'avia_font_mod');
Make sure to select Work Sans New in the font drop down.
Best regards,
IsmaelSeptember 7, 2021 at 12:09 am #1319917by the way : Work Sans is one of those nice variable fonts offered by Google.
i do always tranform those ttf to woff2 fonts. See here some infos: https://web.dev/variable-fonts/September 8, 2021 at 7:57 am #1320060Hi,
Thanks for sharing @guenni007 :-)
Best regards,
Rikard- This reply was modified 3 years, 3 months ago by Rikard.
September 15, 2021 at 7:49 pm #1321103Thank you for your help. I added that code to the CSS box under General Styling and I am not getting an option in the font dropdown for Work Sans New.
September 16, 2021 at 10:47 pm #1321286first – the new added fonts are on the bottom of the list – not in alphabetical order!
Now – i guess the filter for the content font is now: avf_available_google_fonts ( since Enfold 4.3 )
btw : i do see on Google now the variable font onlySeptember 17, 2021 at 7:08 am #1321329Hi,
@tiffanytnttobo: You have to add the code in the functions.php file.
@Guenni007: In the filter above, we are actually appending or pushing the new font in the end of the array, which is why the new font is located at the bottom of the list. We might be able to adjust the order of the fonts by re-sorting the $fonts array.Best regards,
IsmaelSeptember 17, 2021 at 9:47 am #1321346It was just my intention to mention this here – because many participants say it’s not there because they don’t scroll to the bottom of the dropdown list.
PS : does the old filter still work? have you changed the backward compatible?
that new filters seems to work for both lists ( heading and content)September 20, 2021 at 7:06 am #1321571Hi,
Yes, looks like the old filter is still in place within the enfold/framework/php/font-management/class-avia-type-fonts.php file.
/** * Kept for backwards compatibility - will be replaced by next filter */ $fonts = apply_filters('avf_google_heading_font', $fonts ); /** * @since 4.3 * @return array */ $fonts = apply_filters('avf_available_google_fonts', $fonts );
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.