jrnewell / goog-webfont-dl

A utility to download google webfonts to your local machine
MIT License
75 stars 17 forks source link

Support for Google Fonts where the font name has a space between words #4

Closed eobeda closed 9 years ago

eobeda commented 9 years ago

I was hoping that you might have found an elegant work around for the various font names with spaces. Examples include Open Sans or Roboto Condensed.

Google appears to have decided to encode the font names that include spaces with a plus sign (+). As shown here:

link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css' link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'

I've tried spaces, plus signs(+) and a few others, but they all come back from "querystring.escape" in an encoding that produces an incorrect url for the Google Font.

var url = "http://fonts.googleapis.com/css?family=" + querystring.escape(commander.font) + ":" + commander.styles;

Any ideas on a way to download these ? Thanks for your insights Ed

jrnewell commented 9 years ago

Does putting the name in quotes work for you?

goog-webfont-dl -a -f "Open Sans"