Package: icon_font_to_png
Python script (and library) for easy and simple export of icons from web
icon fonts (e.g. Font Awesome, Octicons) as PNG images. The best part is
the provided shell script, but you can also use it’s functionality
directly in your (probably awesome) Python project.There’s alsofont-awesome-to-pngscript for backwards compatibility
with thefirstiteration of the concept.InstallationMake sure you have required packages forPillow
installation.>From PyPI (recommended):$ pip install icon_font_to_pngWithgit clone:$gitclonehttps://github.com/Pythonity/icon-font-to-png$pipinstall-ricon-font-to-png/requirements.txt$cdicon-font-to-png/binOS XAs reportedhere,
to install it on OS X:$ pip install icon_font_to_png --ignore-installed sixUsageusage: icon-font-to-png [-h] [--list] [--download {font-awesome,octicons}]
                        [--ttf TTF-FILE] [--css CSS-FILE] [--size SIZE]
                        [--scale SCALE] [--color COLOR] [--filename FILENAME]
                        [--keep_prefix]
                        [icons [icons ...]]

Exports font icons as PNG images.

optional arguments:
  -h, --help            show this help message and exit
  --list                list all available icon names and exit
  --download {font-awesome,octicons}
                        download latest icon font and exit

required arguments:
  --ttf TTF-FILE        path to TTF file
  --css CSS-FILE        path to CSS file

exporting icons:
  icons                 names of the icons to export (or 'ALL' for all icons)
  --size SIZE           icon size in pixels (default: 16)
  --scale SCALE         scaling factor between 0 and 1, or 'auto' for
                        automatic scaling (default: auto); be careful, as
                        setting it may lead to icons being cropped
  --color COLOR         color name or hex value (default: black)
  --filename FILENAME   name of the output file (without '.png' extension);
                        it's used as a prefix if multiple icons are exported
  --keep_prefix         do not remove common icon prefix (i.e. 'fa-arrow-
                        right' instead of 'arrow-right')ExamplesDownload latest Font Awesome:$ icon-font-to-png --download font-awesomeList all available icons:$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --listExport ‘play’ and ‘stop’ icons, size 64x64:$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --size 64 play stopExport all icons in blue:$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --color blue ALLExport all icons in blue, but using it’s hex value:$ icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --color '#0000ff' ALLOr you can usefont-awesome-to-png, without css and ttf arguments:$ font-awesome-to-png ALLAPIYou can useIconFont(andIconFontDownloaderfor that matter)
directly inside your Python project. There’s no proper documentation as
of now, but the code is commented andshouldbe pretty straightforward
to use.That said - feel free to ask me viaemailor [GitHub issues][github add
issue] if anything is unclear.TestsPackage was tested with the help ofpy.testandtoxon Python
2.7, 3.4, 3.5 and 3.6 (seetox.ini).Code coverage is available atCoveralls.To run tests yourself you need to runtoxinside the repository:$pipinstall-rrequirements/dev.txt$toxContributionsPackage source code is available atGitHub.Feel free to use, ask, fork, star, report bugs, fix them, suggest
enhancements, add functionality and point out any mistakes. Thanks!AuthorsDeveloped and maintained byPythonity.Original version byMichał
Wojciechowski, refactored byPaweł
Adamczak.