Archived topic
non google font not working
9 replies · Started by Heinrich on October 24, 2020
hi team,
i have added a local google font - josefin sans - and it`s working fine. in the same way i added a non google font - freehand575bt-regularb - and its not working as expected. any idea?
php i use:
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'Josefin Sans';
$fonts[] = 'freehand575bt regularb';
return $fonts;
} );
css i use:
@font-face {
font-family: 'freehand_575btregular';
src: url('http://haaslm.temp513.kinsta.cloud/wp-content/fonts/freehand575bt-regularb.eot');
src: url('http://haaslm.temp513.kinsta.cloud/wp-content/fonts/freehand575bt-regularb.eot?#iefix') format('embedded-opentype'),
url('http://haaslm.temp513.kinsta.cloud/wp-content/fonts/freehand575bt-regularb.woff2') format('woff2'),
url('http://haaslm.temp513.kinsta.cloud/wp-content/fonts/freehand575bt-regularb.woff') format('woff'),
url('http://haaslm.temp513.kinsta.cloud/wp-content/fonts/freehand575bt-regularb.ttf') format('truetype'),
url('http://haaslm.temp513.kinsta.cloud/wp-content/fonts/freehand575bt-regularb.svg#freehand_575regular') format('svg');
font-weight: normal;
font-style: normal;
Hi there,
in the PHP filter make sure that the font name matches the font-family in your @font-face CSS
Here you have a space:
$fonts[] = ‘freehand575bt regularb’;
Whereas here you do not:
font-family: ‘freehand_575btregular’;
Update the $fonts[] value.
hi david, tks for quick reply. in customizer i can choose, but no impact on frontend...
Hi there,
Did you make the change that David suggested?
If so, can you link us to your website so we can see why it's not working?
Thanks!
hi tom, of course. credentials are in the private box.
Hi,
You can try David's reply AND disable autoptimize plugin to see if it works.
Perhaps this is a simple caching issue.
Let us know how it goes.
hi elvin,
clearing cache is part of the game every minute.....or as your wise man says .-)
same effect without autoptimize and clearing server-side cache and wp--cache....you have the login credentials, would appreciate you`ll have a look?
tks in advance
Try changing:
$fonts[] = ‘freehand575btregularb’;
to
$fonts[] = 'freehand575bt-regularb';
Make sure none of your code has curly quotes ie. ‘ they need to be '
hi david, is working, tks for help
Glad to hear that!