All Projects → westracer → fontify

westracer / fontify

Licence: other
Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to fontify

unison
Unison: Pan-Unicode Bitmap Font From Hell^WScratch
Stars: ✭ 45 (-48.86%)
Mutual labels:  font-generator
bbcode
A BBCode parser and converter written in PHP.
Stars: ✭ 32 (-63.64%)
Mutual labels:  converter
ttconv
Subtitle conversion. Converts STL, SRT, TTML and SCC into TTML, WebVTT and SRT.
Stars: ✭ 88 (+0%)
Mutual labels:  converter
EMBLmyGFF3
An efficient way to convert gff3 annotation files into EMBL format ready to submit.
Stars: ✭ 52 (-40.91%)
Mutual labels:  converter
dalvikgate
Lightweight dex / odex / apk to jar converter
Stars: ✭ 32 (-63.64%)
Mutual labels:  converter
zipreport
Python PDF reporting library
Stars: ✭ 15 (-82.95%)
Mutual labels:  converter
csv2html
Convert CSV files to HTML tables
Stars: ✭ 64 (-27.27%)
Mutual labels:  converter
Gm1KonverterCrossPlatform
A tool to convert strongholds gm1 and tgx files to png.
Stars: ✭ 20 (-77.27%)
Mutual labels:  converter
xToBatConverter
Generate a ms batch file and inject a files inside of it. When the batch is executed, the files are extracted and executed.
Stars: ✭ 17 (-80.68%)
Mutual labels:  converter
ddal
DDAL(Distributed Data Access Layer) is a simple solution to access database shard.
Stars: ✭ 33 (-62.5%)
Mutual labels:  converter
DirectFire Converter
DirectFire Firewall Converter - Network Security, Next-Generation Firewall Configuration Conversion, Firewall Syntax Translation and Firewall Migration Tool - supports Cisco ASA, Fortinet FortiGate (FortiOS), Juniper SRX (JunOS), SSG / Netscreen (ScreenOS) and WatchGuard (support for further devices in development). Similar to FortiConverter, Sm…
Stars: ✭ 34 (-61.36%)
Mutual labels:  converter
fontagon
Fontagon is a great tool that easily converts svg into icon font. Fontagon-cli allows faster conversion to commands.
Stars: ✭ 18 (-79.55%)
Mutual labels:  svgtofont
qTsConverter
A simple tool to convert qt translation file (ts) to other format (xlsx / csv) and vice versa
Stars: ✭ 26 (-70.45%)
Mutual labels:  converter
man-to-md
Converts man pages to Markdown
Stars: ✭ 51 (-42.05%)
Mutual labels:  converter
typeconv
Convert between JSON Schema, TypeScript, GraphQL, Open API and SureType
Stars: ✭ 229 (+160.23%)
Mutual labels:  converter
discoursegraphs
linguistic converter / merging tool for multi-level annotated corpora. graph-based (using Python and NetworkX).
Stars: ✭ 47 (-46.59%)
Mutual labels:  converter
ocr2text
Convert a PDF via OCR to a TXT file in UTF-8 encoding
Stars: ✭ 90 (+2.27%)
Mutual labels:  converter
instagram json viewer
Transforms Instagram's *.json / backup data - that you get via the Data Download Tool - to a readable format!
Stars: ✭ 41 (-53.41%)
Mutual labels:  converter
php-to-zephir
Convert PHP 7 files to Zephir zep files and create a native PHP extension
Stars: ✭ 25 (-71.59%)
Mutual labels:  converter
FileRenameBot
A Telegram File Renamer Bot With Permanent Thumbnail Support Also It Can Convert Files Into Video!!
Stars: ✭ 369 (+319.32%)
Mutual labels:  converter

Fontify

pub package

The Fontify 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.

Using CLI tool

Globally activate the package:

$ pub global activate fontify

And it's ready to go:

$ fontify <input-svg-dir> <output-font-file> [options]

Required positional arguments:

  • <input-svg-dir> Path to the input directory that contains .svg files.
  • <output-font-file> Path to the output font file. Should have .otf extension.

Flutter class options:

  • -o or --output-class-file=<path> Output path for Flutter-compatible class that contains identifiers for the icons.
  • -i or --indent=<indent> Number of spaces in leading indentation for Flutter class file. (defaults to "2")
  • -c or --class-name=<name> Name for a generated class.
  • -p or --package=<name> Name of a package that provides a font. Used to provide a font through package dependency.

Font options:

  • -f or --font-name=<name> Name for a generated font.
  • --[no-]normalize Enables glyph normalization for the font. Disable this if every icon has the same size and positioning. (defaults to on)
  • --[no-]ignore-shapes Disables SVG shape-to-path conversion (circle, rect, etc.). (defaults to on)

Other options:

  • -z or --config-file=<path> Path to Fontify yaml configuration file. pubspec.yaml and fontify.yaml files are used by default.
  • -r or --recursive Recursively look for .svg files.
  • -v or --verbose Display every logging message.
  • -h or --help Shows usage information.

Usage example:

$ fontify assets/svg/ fonts/my_icons_font.otf --output-class-file=lib/my_icons.dart --indent=4 -r

Updated Flutter project's pubspec.yaml:

...

flutter:
  fonts:
    - family: Fontify Icons
      fonts:
        - asset: fonts/my_icons_font.otf

CLI tool config file

Fontify's configuration can also be placed in yaml file. Add fontify section to either pubspec.yaml or fontify.yaml file:

fontify:
  input_svg_dir: "assets/svg/"
  output_font_file: "fonts/my_icons_font.otf"
  
  output_class_file: "lib/my_icons.dart"
  class_name: "MyIcons"
  indent: 4
  package: my_font_package

  font_name: "My Icons"
  normalize: true
  ignore_shapes: true

  recursive: true
  verbose: false

input_svg_dir and output_font_file keys are required. It's possible to specify any other config file by using --config-file option.

Using API

svgToOtf and generateFlutterClass functions can be used for generating font and Flutter class.

The example of API usage is located in example folder.

Notes

  • Generated OpenType font is using CFF table.
  • Generated font is using PostScript Table (post) of version 3.0, i.e., it doesn't contain glyph names.
  • Supported SVG elements: path, g, circle, rect, polyline, polygon, line.
  • 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.
  • Consider using Non-zero fill rule.
  • 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.

Planned

  • Support svg-to-ttf conversion (cubic-to-quad curves approximation needs to be done).
  • Support ligatures.
  • Support font variations.

Contributing

Any suggestions, issues, pull requests are welcomed.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].