The API docs say that a space should be replaced with a +. See http://code.google.com/apis/webfonts/docs/getting_started.html#Syntax

However this module requests the fonts from google using a URL with an underscore in place of the space, and so they dont work.

Comments

mrfelton’s picture

Status: Active » Needs review
StatusFileSize
new1.15 KB

Attached patch seems to resolve. Note, I also removed the _google_fonts_system_fontname function as it was unused.

- Tom

mrfelton’s picture

Not sure why the previous patch wouldn't apply from a drush make file.

mrfelton’s picture

mrfelton’s picture

Sorry about this, not sure what's going on.

recidive’s picture

Priority: Normal » Critical
Status: Needs review » Needs work

Shouldn't _google_fonts_family_array_key_dencode() be changed as well? Otherwise this is RTBC.

Bumping to critical as this makes half of the fonts unusable.

BarisW’s picture

Thanks, I'll look into it. However, you might want to switch to @font-your-face. As stated on the module page, I've decided to put my efforts in the FYF module instead of the Google Fonts module. The FYF module also supports Google Fonts, as well as many others.

BarisW’s picture

Status: Needs work » Postponed (maintainer needs more info)

Tom,

I checked your patch but this does not seem to be an issue. The module already replaces spaces with a + sign, in <code>_google_fonts_family_pathname(). If you check the call to the CSS file, you'l see that the request points to (example) http://fonts.googleapis.com/css?family=Covered+By+Your+Grace&amp;subset=latin

Does the current code fails in your configuration? Could you please clarify what the URL is of the CSS file that is requested?

sbgoldi’s picture

Version: 7.x-2.x-dev » 6.x-2.0-beta3
Status: Postponed (maintainer needs more info) » Needs work

Change in google_fonts.module

line 153:
function _google_fonts_family_array_key_encode($string) {
return str_replace(' ', '_', $string);
}

to

function _google_fonts_family_array_key_encode($string) {
return str_replace(' ', '+', $string);
}

meladawy’s picture

I got it to work by replacing line 85

 drupal_add_css($protocol . '://fonts.googleapis.com/css?family=' . implode('|', $chunk), array('type' => 'external', 'weight' => CSS_SYSTEM));

with

  drupal_add_css($protocol . '://fonts.googleapis.com/css?family=' . str_replace("_","+",implode('|', $chunk)), array('type' => 'external', 'weight' => CSS_SYSTEM));