Fontsquirrel::Download

Download and extract font-kits from fontsquirrel easily with a rake tasks.

Installation

Add this line to your application's Gemfile:

gem 'fontsquirrel-download', group: "development"

And then execute:

$ bundle

Add to your application.css/application.css.scss:

//= require fonts

Because the download will append the necessary changes to app/assets/stylesheets/_fonts.css.sass.

Usage

Use Rake task, specify the Font name as written in the URL from font-squirrel, e.g. the well-known LaTeX-Font:

rake font:kit NAME=TeX-Gyre-Bonum

This will download the fonts to app/assets/fonts and append the style rules to app/assets/stylesheets/_fonts.css.sass.

After that, you can use that style definition in your css rules, like:

body {
  font-family: "TeXGyreBonumRegular", serif;
}

The names always vary a little, just look them up in the _fonts.css.sass

Potential ToDo

  • Until know, it will download the normal subset of the font. Some fonts have no special chars (like German Umlauts) at all, some have them in a subset. Maybe specifying the subset comes in handy.
  • Downloading not only font-kits but all the other fonts...