/svg-to-ttf

(Forked and modified) Docker image to generate TTF fonts from SVG glyphs

Primary LanguageShellMIT LicenseMIT

svg-to-ttf

A alpine based image to convert svg glyphs and generate TTF font using fontcustom.

This image includes:

Volumes

This image defines a single volume:

  • /fonts - Base directory where all works run

Process

This image will copy all svg glyphs from /fonts/INPUT_FOLDER to a temporary directory.

After that, if choose, all glyphs will be converted from stroke to path. Some fonts need this step, like Feather.

Finally, Fontcustom is used to generate desired TTF font.

Use

Help message :

docker run --rm -v WORK_DIRECTORY:/fonts lu0alv/svg-to-ttf-charmap -h
Usage: docker run --rm -v "${PWD}":/fonts lu0alv/svg-to-ttf-charmap [OPTIONS]
  -g, --gid [GID]               GroupId owner of the destination folder; default is equal to uid
  -i, --input [FOLDER]          Folder where svg glyphs lives; default is ./input
  -n, --name FONT_NAME          Name of the generated font
  -c, --codepoint [CODEPOINT]   Starting point for the character map, hexadecimal."
  -o, --output [FOLDER]         Destination folder for generated fonts; default is ./FONT_NAME
  -s, --skip_conversion         Skip the conversion from stroke to path
  -u, --uid [UID]               UserId owner of the destination folder; default is 0 (root)
  -h, --help                    Show this help message

Simple font generation:

docker run --rm -v WORK_DIRECTORY:/fonts lu0alv/svg-to-ttf-charmap -n FONT_NAME

This command will read all svg glyphs from WORK_DIRECTORY/input and create a folder named FONT_NAME with generated TTF font into.

If you want to define another output folder:

docker run --rm -v WORK_DIRECTORY:/fonts lu0alv/svg-to-ttf-charmap -n FONT_NAME -o OUTPUT_FOLDER

If you want that the result of build respect your user:

docker run --rm -v WORK_DIRECTORY:/fonts lu0alv/svg-to-ttf-charmap -n FONT_NAME -u $(id -u)

(GID is optional)

If you dont need to convert stroke to path:

docker run --rm -v WORK_DIRECTORY:/fonts lu0alv/svg-to-ttf-charmap -n FONT_NAME -s

If you want to specify the starting point of the character map:

docker run --rm -v WORK_DIRECTORY:/fonts lu0alv/svg-to-ttf-charmap -n FONT_NAME -c e916

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Thanks

Donate

If you want to buy me a 🍺 :)

Fork notes:

This is a fork of rfbezerra's svg-to-ttf repo I modified to have the ability to specify the starting point of the charmap using a new option -c or --codepoint.