A collection of tools for creating web fonts from SVG images.
bc-build-icons [--rebuild] CONFIG [OUT_PATH]
Create TTF and WOFF2 fonts from SVG icons using the given configuration file and optional output path. It defaults to the directory in which the configuration file is located. A CSS file containing icon classes (with a configurable prefix) is also generated.
When the --rebuild
option is specified, cached SVG images are re-generated even if they already exist.
Currently the tool can import SVG icons from the lucide-static package. It can be used to create a customized version of the static icon fonts which contain only icons which are needed.
The following modules and tools are used:
- oslllo-svg-fixer - to trace input SVG images to single path SVG images suitable for using in fonts
- svgicons2svgfont - to convert individual SVG images to a SVG icon file
- svg2tiff - to convert the SVG icon file to a TTF font
- ttfautohint - to generate automatic hinting for the TTF font
- wawoff2 - to compress the TTF font to WOFF2 format
On Windows, the ttfautohint.exe
binary included in this package is used. On other platforms, ttfautohint
must be installed and available in the PATH
.
Example configuration file:
options:
fontName: lucide
fontHeight: 1000
descent: 150
normalize: true
traceResolution: 800
autohint: true
cssClassPrefix: icon
icons:
- calendar
- file
- list-todo
- users
- ...
The configuration file should use the YAML format. It must contain at least the list of icons to include in the generated fonts. All other parameters are optional.
options
are described in the svgicons2svgfont API documentation; thefontName
is also used as the file name for generated filestraceResolution
is the resolution used for tracing single path SVG imagesautohint
enables or disables automatic hintingcssClassPrefix
is used in the generated CSS file (defaults toicon
)
Portions of this software are copyright (C) 2021 The FreeType Project. All rights reserved.