Skip to main content

Tools for making OpenType-SVG fonts

Project description

PyPI Status Codecov

Tools for making OpenType-SVG fonts

  • addsvg adds an SVG table to a font, using SVG files provided. The font's format can be either OpenType or TrueType.

  • dumpsvg saves the contents of a font's SVG table as individual SVG files. The font's format can be either OpenType, TrueType, WOFF, or WOFF2.

  • fonts2svg generates a set of SVG glyph files from one or more fonts and hex colors for each of them. The fonts' format can be either OpenType, TrueType, WOFF, or WOFF2.

Dependencies

  • Python 3.6 or higher

  • FontTools 3.1.0 or higher

Installation instructions

  • Make sure you have Python 3.6 (or higher) installed:

      python --version
    
  • Setup a virtual environment:

      python -m venv ot-svg
    
  • Activate the environment:

      source ot-svg/bin/activate
    
  • Update pip:

      pip install -U pip
    
  • Install opentypesvg:

      pip install opentypesvg
    

How to make OpenType-SVG fonts?

Step 1

Generate a set of SVG files from a series of fonts and color values.

step1

fonts2svg -c 99ccff,ff0066,cc0066 fonts/Zebrawood-Shadow.otf fonts/Zebrawood-Fill.otf fonts/Zebrawood-Dots.otf

Step 2

Add a set of SVG files to an existing OpenType (or TrueType) font.

step2

addsvg fonts/SVGs fonts/Zebrawood.otf

You can use Step 2 without doing Step 1, but there are a few things you need to be aware of when using the addsvg tool:

  • After the SVG files are saved with the authoring application (e.g. Adobe Illustrator, CorelDRAW!, Inkscape) they should be put thru a process that optimizes and cleans up the SVG code; this will slim down the file size while keeping the resulting artwork the same. For this step you can use one of these tools:

  • addsvg requires the SVG files to be named according to the glyphs which they are meant to be associated with. For example, if the glyph in the font is named ampersand, the SVG file must be named ampersand.svg.

  • addsvg expects the color artwork to have been designed at the same size as the glyphs in the font, usually 1000 or 2048 UPM. This means 1 point (pt) in the authoring app equals 1 unit in font coordinates. If the artwork's canvas size is not the same as the font's UPM value, use the -k option to prevent the tool from removing the SVG's viewBox parameter. Retaining the viewBox parameter will enable the artwork to be scaled to the full extent of the viewport (i.e. the font's UPM).

  • If the artwork's <svg> element contains height and/or width parameters, remove them, otherwise the artwork will have a fixed size and won't be allowed to scale to the full extent of the viewport.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentypesvg-1.1.3.tar.gz (144.4 kB view details)

Uploaded Source

Built Distribution

opentypesvg-1.1.3-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file opentypesvg-1.1.3.tar.gz.

File metadata

  • Download URL: opentypesvg-1.1.3.tar.gz
  • Upload date:
  • Size: 144.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for opentypesvg-1.1.3.tar.gz
Algorithm Hash digest
SHA256 af4fc9e3b045ee68e25999a87d9627a9978d30f621d39a1051c93c0880297a37
MD5 2a792dd0e54d457bbd4a105722ef2a44
BLAKE2b-256 a25dea3b923e054af87e9520600136707bb06dc467f3f7de00616212d1b36db7

See more details on using hashes here.

File details

Details for the file opentypesvg-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: opentypesvg-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for opentypesvg-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9cf82ed20cc3e3a7dcb7d6c3a9663bb5cae9deb7ba3ec47ac5948b26c0e31ed5
MD5 9efcbcbea2995ce872bfbbae2a3d17fa
BLAKE2b-256 10444be1d7a060ca030dd006c8306883a4c4af174eae23669e9a2021c3ef1181

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page