Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (14 sloc) 1.02 KB

Introduction

The GoogleFontExtractor Gem will crawl the Google Webfonts directory on your command and return an array of Struct instances with details of fonts available in the Google Fonts directory.

PLEASE Note: this does NOT download the font files themselves, although it does return the download url if you wanted to automate obtaining the .ttf file for each font.

Let's get started.

1. In your Gemfile

gem "google_font_extractor"

2. Bundle Install

3. rails console example

ruby-1.9.2> fonts = GoogleFontExtractor.fonts
ruby-1.9.2> fonts.first
=> #<struct designer="Steve Matteson", name="Droid Serif", charsets=["latin"], weights_count="4", weights=["regular", "italic", "bold", "bolditalic"], families_count=nil, category="serif", download_url="http://www.google.com/webfonts/download?kit=JHlfjS1nNpVY2eojiON_TqCzlCNBPNJyfLyExqzYYTM">
ruby-1.9.2>

Additional notes

If you want to do anything real with this, you should save the results of the extract method to a YAML file or database table.

Jump to Line
Something went wrong with that request. Please try again.