- This topic has 21 replies, 4 voices, and was last updated 3 years, 2 months ago by
Fernando.
-
AuthorPosts
-
May 30, 2020 at 10:27 am #1307912
Tom
Lead DeveloperLead DeveloperNo problem!
July 1, 2021 at 7:43 am #1841029Sascha
Hi,
we are building a site using a locally embedded font “National Regular”. How can I se “System Default, Ubuntu, Helvetica” as fallback-fonts?
Thank you in advance and kind regards,
SaschaJuly 1, 2021 at 9:03 am #1841300David
StaffCustomer SupportHi there,
with the current typography system you would need to use the PHP Snippet Tom provides here:
This will allow you to add your Local font, as the System Stack with the fallback fonts you require.
Then in the Customizer you would select the System font instead of your local font.July 2, 2021 at 1:15 am #1841832Sascha
Hi David,
thanks, but I have trouble understanding how to apply this correctly.
We use a local font called “Natural Regular” and for some headlines “Natural Extrabold” on our site, and we want “System Stack” to be the fallback. This is the complete stack:
National Regular, Calibri, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif
So when checking the filter/snippet that Tom has provided, does this mean I need to add the following code to the functions.php?
add_filter( 'generate_typography_system_stack', function() { return 'National Regular, Calibri, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif'; } );Thank you in advance and kind regards,
SaschaJuly 2, 2021 at 3:37 am #1841937David
StaffCustomer SupportThats correct, but you should include the additional quotes around your local font:
add_filter( 'generate_typography_system_stack', function() { return '"National Regular", Calibri, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif'; } );But with the current system you can only set the System stack for the one font – so the other snippet will apply to just
National Regular.We’re very close to releasing the alpha version of GP3.1 and GPP2.1 that will allow you to create your own fallbacks for any fonts.
January 19, 2023 at 2:11 pm #2502112Stephane Bergeron
Hello,
Is Tom’s method from 2019 the one applicable now for locally loaded fonts? I would like to give “Open Sans” a fall back of Verdana then the last resort sans-serif.
Thanks!
January 19, 2023 at 7:24 pm #2502269Fernando Customer Support
Hi Stephane,
You should now be able to stack fonts in Appearance > Customize > Typography.
Example: https://share.getcloudapp.com/04uydq51
In this example,
test-fontis the primary font, andimpactis the fallback. -
AuthorPosts
- You must be logged in to reply to this topic.