The icon_font_generator package provides an easy way to convert SVG icons to OpenType font
and generate Flutter-compatible class that contains identifiers for the icons
(just like CupertinoIcons or Icons classes).
The package is written fully in Dart and doesn't require any external dependency.
Compatible with dart2js and dart2native.
Font generation
Install via dev dependency
$ flutter pub add --dev icon_font_generator
# And it's ready to go:
$ flutter pub run icon_font_generator:generate <input-svg-dir> <output-font-file> [options]
SVG transforms are applied to paths according to specs.
SVG <g> element's children are expanded to the root with transformations applied.
Anything else related to the group is ignored and group referencing is not supported.
When ignoreShapes is set to false,
every SVG shape's (circle, rect, etc.) outline is converted to path.
Note that any attributes like "fill" or "stroke" are ignored and only the outline is used,
so the resulting glyph may look different from SVG icon.
It's recommended to convert every element in SVG to path.
When normalize is set to false, it's recommended that SVG icons have the same height.
Otherwise, final result might not look as expected.
When Flutter class is generated, static variables names derive from SVG file name
converted to pascal case with non-allowed characters removed.
Name is set to 'unnamed', if it's empty.
Suffix '_{i+1}' is added, if name already exists.
Contributing
Any suggestions, issues, pull requests are welcomed.