Why are my Google fonts not working? - google-font-api

It looks like my Google fonts are not working properly. My wordpress theme comes with a customized Googlefonts.php that uses this code to request the fonts:
foreach($googlefonts as $getfonts) {
if(!in_array($getfonts, $default)) {
$customfont = str_replace(' ', '+', $getfonts). ':400,400italic,700,700italic|' . $customfont;
}
}
if($customfont != ''){
echo "<link href='http://fonts.googleapis.com/css?family=" . substr_replace($customfont ,"",-1) . "&subset=latin,latin-ext,cyrillic,cyrillic-ext,greek-ext,greek,vietnamese' rel='stylesheet' type='text/css'>";
}
I do not understand how the Google fonts api works, I never used it in this way.
According to Firebug my call to the api returns a bad request. This is the URL that the above piece of code sends to Google right now:
http://fonts.googleapis.com/css?family=Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic|Trebuchet+MS:400,400italic,700,700italic&subset=latin,latin-ext,cyrillic,cyrillic-ext,greek-ext,greek,vietnamese
Can someone explain to me why this is not working?
PS: Someone may think why are you requesting the same font so many times. This is because my theme has options to get different fonts for H1, H2, normal text, the menu, etc.

The URL itself explains why it's not working - Google do not have a Trebuchet MS font.

Related

Adding fonts for Joomla menu from google API

I use Joomla v3.9.8 stable on my website with a template named AS002066 and i want to use some additional fonts provided by the google API.
I found some code in a file from my template called 'fonts.php' and added there code as it is written for other fonts from google too.
I also added the needed code in 'mod_as_menu.xml' but nothing does work.
May i missed some thing?
This is what i added to my fonts.php. It's the same sheme like the entrys brought by the template:
case 'UnifrakturCook':
$font_arr['fontlink'] = "<link href='https://fonts.googleapis.com/css?family=UnifrakturCook&subset=latin,cyrillic,greek' rel='stylesheet' type='text/css'>";
$font_arr['fontfamily'] = "font-family: 'UnifrakturCook', Arial, serif !important;";
break;
And here what i added to my mod_as_menu.xml:
<option value="UnifrakturCook">Google:UnifrakturCook</option>
But it doesn't matter what i choose. It will not change any font.
I hope someone can help me with this.

User reporting seeing old website, when new one has gone live

I've recently put a new style live on: summerboardingcourses.co.uk
I've had report from one user that they are seeing the old website (with broken styles) on iPhone Safari browser from Poland (I am based in the UK). I can't replicate the issue, every VPN I use, or GeoLocation Screenshot tool I've used (e.g. localbrowser.com) the site is viewing correctly.
Has anyone ever had an issue like this before? I can't understand why they would be seeing the old site.
Any advice at all would be fantastic.
Thanks,
Meg
/* Return Last modified date or current date*/
function get_mod_time($file) {
if (file_exists($file)) {
return date("y.m.d-H", filemtime($file));
}
else {
return date('y.m.d-H');
}
}
/* Include style */
$css_file = get_template_directory_uri() . '/assets/css/style.css';
wp_enqueue_style( 'site-css', $css_file, array(), get_mod_time($css_file), 'all' );
Same think you can do for your custom JS files, you get last modified date as version name, that forces clear cache if file on server updated

How to close google-font reference in wordpress?

I'm a Chinese user, using WordPress(3.9.1) to built several websites.
But current days the website (both the frontend pages and the wordpress admin pages) goes extremely slow.
After checking the requests, I found the requests to the google-font link always fail. Maybe caused by the Chinese GFW.
The google-font API requests follows:
http://fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.9.1
But fails, the delay may cause the entire page cannot finish loading!
And this was automatically injected to both the admin html and client theme html. How to close that entirely? Or at least prevent the delay for such a long time.
My solution is simply install the plugin:
http://wordpress.org/plugins/disable-google-fonts/
Use this wordpress plugin: https://wordpress.org/plugins/remove-google-fonts-references/
This plugin disable all google font.
Look for this in your stylesheet:
#import url(http://fonts.googleapis.com/css?family=Open+Sans);
If you find that, you can delete it. But you will want to replace font-family:'Open Sans' with the simpler font-family:sans-serif elsewhere in your stylesheet.
If you do not find the #import line, someone may have buried this one in your theme's header:
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
If so, same drill -- you may remove it, but you'll want to also remove references to 'Open Sans' in your stylesheet.

How to install a google font on Drupal 7

I added the stylesheet in the .info file and pasted in the url for the google font but in firebug it just shows the entire page indicating that it is not linked correctly. How are google font linked in drupal 7?
Add this in your template.php file (located in theme folder) :
function YOURTHEMENAME_preprocess_html(&$variables) {
drupal_add_css('http://fonts.googleapis.com/css?family=Raleway:400,100,700', array('type' => 'external'));
}
(replace YOURTHEMENAME with the real name of your theme).
And then the correct css code in your css file.
Something like :
body {
font-family: 'Raleway', sans-serif;
}
You could make you life a lot easier by just using the contributed Google Fonts module...it does everything for you and has been proven to work many times.

Google Web Fonts not working after Firefox 7 upgrade

I have no idea why this is happening. I am following the standard tried and tested method of using google web fonts
<link href='http://fonts.googleapis.com/css?family=Sunshiney' rel='stylesheet' type='text/css'>
<style>
h1{ font-family: 'Sunshiney', cursive; }
</style>
<h1>Hi there</h1>
This works in Safari, Chrome and IE but not FF7.
Has anyone come across this. I've also tried using the JS integration and the #import syntax and it is the same. I'm really stuck.
This is a known issue with Google Web Fonts. An internal configuration change broke serving of one of the headers needed for reliable operation in Firefox and IE9+. The fix is propagating now and it should be working soon.
Thanks for reporting the issue!
(I'm an engineer on the Google Web Fonts team, found this in a twitter search trying to investigate how deep the breakage went)
I think its problem with google
On my browser FF 7.01 is show Comics Sans
http://fonts.googleapis.com/css?family=Sunshiney => redirect to
themes.googleusercontent.com/static/fonts/sunshiney/[...]3HZu7kw.woff
And response with no font data
but when type this adress in url bar i can save this font
so.
Just download this font and simple embennded to webpage
Will be faster
eq
====> 0,20second to download family=Sunshiney
=====> 0,30 to download woff font
There is currently an issue on Google's end with the Webfonts. It's odd because they were working just a few days ago, and I've seen them load up once or twice, but otherwise it's reverting to the fallback font.
Your best option is to download the file and manually embed it into your webpage using #font-face. There's a good article on that at Six Revisions.
I hope Google gets it sorted soon.
Just in case it helps someone, I just had a problem with Google Web Fonts not rendering on a colleague's Mac, but working on other (similarly configured) Macs. It was obviously something client side, and turned out to be the browser.display.use_document_fonts setting (see here).
To stop it happening, it's a case of going to Preferences .. Content .. Fonts & Colors .. Advanced and making sure "Allow pages to chose their own fonts, instead of my selections above" is checked.

Resources