سؤال

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) . "&amp;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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top