Hieroglyph 0.1.4

Icon fonts are a great way to add sharp, flexible icons to your website using @font-face. Chris Coyier thinks they're a good idea, and you should too.

Hieroglyph lets you turn a directory of SVG icons into an SVG font, all simple-like. To produce the remaining web filetypes (eot, ttf, woff) run the font file through Fontsquirrel's generator.

If ImageMagick is installed (optional), hieroglyph will also draw a character sheet PNG for you.

Installation

To install the current version from RubyGems:

gem install hieroglyph

To install the most recent version, from GitHub:

git clone [email protected]:averyvery/hieroglyph.git && \
cd hieroglyph && \
gem build hieroglyph.gemspec && \
gem install hieroglyph

To do a quick test run, just generate some example glyphs and create a MyFont font like so:

hieroglyph -e && hieroglyph

Usage

Create a directory full of SVG glyphs, and run:

hieroglyph -n FontName -g path/to/glyphs -o destination/path

Font creation arguments:

-n, --name NAME               name of the font you want generated (defaults to MyFont)
-o, --output OUTPUT_FOLDER    where to output the generated font (defaults to current folder)
-g, --glyphs GLYPH_FOLDER     where to find glyphs to generate from (defaults to "glyphs")

Misc (using these arguments will not produce a font:

-e, --example                 creats set of example glyphs, including two "bad" SVGs for reference
-v, --version                 display Hieroglyph version
-h, --help                    display all commands

Converting

Because hieroglyph only generates SVGs, you'll need to convert the resulting file to other formats yourself. The Font Squirrel Generator is usually the best tool for this, but as of May 2012 it was having trouble uploading/reading SVGs. If you run into this problem, try converting your font to a TTF first with Free Font Converter.

Making Glyphs

  • In a vector editor (Illustrator, Inkscape), create a 1000pt x 1000pt canvas
  • Draw/merge your icon into a single compound path (this is important!)
  • Center it horizontally
  • Vertically, fit it between cap height of 250pt the baseline of 1000pt
  • Save as a-[iconname].svg in your glyphs folder, 'a' being the letter you want to map to. You can also use something like -[iconname].svg to map to a unicode character.

Private Unicode Symbols

Mapping your icons to private-use unicode characters is an extra measure to prevent screenreaders from seeing them. You can see an example of this by running hieroglyph -e, it just involves naming your glyph with a unicode characted before the dash.

The basic range of valid names runs from  to .

To create a full font using FontSquirrel, you'll need to use Expert mode and subset your font with the unicode characters.

Read more: Dan Scotton's tweet, Wikipedia

Known Issues

  • If ImageMagick is installed without Ghostscript fonts, the character sheet process will throw an error. The font is still generated correctly, though.

Contribute

If you want to help out, great! As an inexperienced dev, I'd appreciate any help I can get — but I would most appreciate it in the form of suggestions, education, and well-justified changes. If you have a specific bug or feature you'd like to pull request for, please let me know about it so we're on the same page.

Testing

bundle install
rake install
bundle exec rake

Thanks

Version notes

0.1.4
Output is less verbose, more colorful

0.1.3
Fix applied for older versions of ruby

0.1.2
Better logging, more characters supported

0.1.1
Officially a ruby gem, character sheet added

0.1
Just a .rb script for converting simple SVGs to a font