
Turn an icon font into an SVG sprite
Convert every mapped glyph in an icon font (Font Awesome, Material Icons, ...) into one SVG sprite of `<symbol id="uXXXX">` elements, so a page can `<use href="#u...">` an icon without loading the font at all. Capped at 2000 glyphs.
Turn an icon font into an SVG sprite converts every mapped glyph into one SVG file of symbol elements. A page can then reference an icon with that sprite, without loading the font itself. Control characters and space are skipped, since they carry no outline. Conversion stops after 2000 glyphs, with the true total still reported.
Questions
What counts as a glyph worth including?
Any Unicode code point above the space character and not equal to the delete character 0x7F that the font's cmap table maps to a glyph; C0 and C1 control codes and the space itself are excluded, since icon fonts sometimes map them but they carry no useful outline.
What is the 2000-glyph cap about?
Once a font maps more than 2000 code points, only the first 2000 in code-point order are turned into symbols; the summary line still reports the true total alongside the capped count so you know some were left out.
What does the output sprite file contain?
One SVG with display:none containing a symbol element per glyph, each with its own id in the form uXXXX and its own viewBox; a page later renders one with a use element pointing at that id, so the original font file never has to load.
What if the font has no Unicode-mapped glyphs at all?
The tool refuses, saying the font has no Unicode-mapped glyphs to build symbols from, since there is nothing in the cmap table to enumerate.
Does it work on any font, or only icon fonts?
It works on any font with a cmap table, but it is built for icon fonts like Font Awesome and Material Icons, where every mapped code point is a meaningful icon rather than a normal letter someone would type.
Compare
| Tool | Runs on the CLI | Live as you type |
|---|---|---|
| Turn an icon font into an SVG sprite | Yes | No |
| Convert a font to OTF | Yes | No |
| Subset a font to specific characters | Yes | No |
| Render a font specimen sheet | Yes | No |
| Export font glyphs as SVG | Yes | No |
| Convert text to an SVG path | Yes | No |
| Embed a font as a CSS data URI | Yes | No |