This package provides a template for creating font icon packs for Flutter from SVG source.
- Click "Use this template"
- Change the package details in
pubspec.yaml
: name, author, description, homepage - Replace
assets/fonts/CustomFont.svg
with your own SVG font, e.g.MyFont.svg
- You will want the name to be in PascalCase
- You can use Inkscape to create SVG fonts:
- Create a new file from the Typography Canvas template
- Place your glyphs on layers created with Extensions > Typography > Add Glyph Layer
- Do Extensions > Typography > Convert Glyph Layers to SVG Font
- Replace
assets/fonts/CustomFont.yaml
with e.g.MyFont.yaml
, a map giving human-readable names to the codepoints covered by your font. Names must be valid Dart identifiers. - Run
make
from the root to generate the TTFs and icon data classesnpm
must be installed in order to generate the TTFs
- Edit the
fonts:
section inpubspec.yaml
to replaceCustomFont
with your font - Add the package as a dependency to your consuming project
You can then create icons like Icon(MyFontIcons.foo)
.
The example app serves as a performance comparison between icon fonts and SVG icons. In my testing, the icon font performs much better than SVG in debug builds, but in release builds the difference is not noticeable.
The sample font uses a glyph from Evil Icons; see LICENSE.