Have you ever thought of automating the process of converting regular fonts to webfonts?

Just for you I build a simple command line client for the popular Font Squirrel font-face generator. I called it Marmot, and here’s what it can do:

marmot Averia-Regular.ttf     # ls .   =>   webfontkit.zip

Marmot takes any font, uploads it to Font Squirrel and downloads a zip file with woff, ttf, eot and svg versions of the font. By default, Marmot uses default settings for the generator. But usually, when you download a fontface kit from Font Squirrel there’s a file called generator-config.txt, and the cool thing is, Marmot can read it:

marmot  -c generator-config.txt  font.otf

Wow, that’s awesome, how do I install it?

Marmot is written in ruby, it’s a simple gem:

gem install marmot

How do I configure this thing?

You can either use config files I was telling you before:

{
  "formats":["ttf", "woff", "svg"],
  "fallback":"none",
  "subset_custom_range":"E000-F8FF",
  "emsquare":"1000"
}

Or you can pass parameters as arguments:

marmot  --no-add-hyphens  --formats=ttf,woff  font.otf

There are lots of parameters, and their names are somewhat confusing. To make it a bit easier, here is what you can do: go to the generator page, open the console and run this code:

$("input[value='expert'], input[value='advanced']").click();
$("table input").each(function(){
  $(this).after($("<div style='color:red;'>"+$(this).attr("name")+" : "+$(this).attr("value")+"</div>"));
});

Here’s what you gonna get:

screenshot

So, I hope you like it. Go star Marmot on Github.