• Stars
    star
    210
  • Rank 187,539 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 8 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tools and sample files for making OpenType-SVG fonts

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.

More Repositories

1

afdko

Adobe Font Development Kit for OpenType
C
1,043
star
2

cmap-resources

CMap Resources
Makefile
243
star
3

box-drawing

Python script to draw all the box drawing characters and block elements based on parameters.
Python
143
star
4

agl-aglfn

AGL & AGLFN
92
star
5

Adobe-Japan1

The Adobe-Japan1-7 Character Collection
69
star
6

agl-specification

Adobe Glyph List Specification
63
star
7

kern-dump

Scripts for working with and analyzing kerning information
Python
60
star
8

keyboard-layouts

Keyboard layout conversion from XML-based .keylayout to Windows-compatible .klc
Python
56
star
9

fontlab-scripts

Python scripts for FontLab
Python
55
star
10

aots

Annotated OpenType Specification
XSLT
45
star
11

psautohint

A standalone version of AFDKO’s autohinter
C
43
star
12

adobe-latin-charsets

Adobe Latin Character Sets
HTML
40
star
13

python-scripts

Command line Python scripts
Python
35
star
14

drawBotProofing

Python
31
star
15

python-modules

Python modules
Python
29
star
16

mapping-resources-pdf

Mapping Resources for PDF
Makefile
27
star
17

Adobe-KR

The Adobe-KR-9 Character Collection
25
star
18

Adobe-GB1

The Adobe-GB1-6 Character Collection
24
star
19

kernalytics-rf-ext

Robofont Extension for editing kerning in multiple UFOs
Python
24
star
20

perl-scripts

Command-line Perl Scripts
Perl
22
star
21

pancjkv-ivd-collection

PanCJKV IVD Collection (UNREGISTERED)
Perl
22
star
22

adjust-anchors-rf-ext

Python
19
star
23

font-tech-notes

Font Tech Notes ported from Adobe's DevNet site.
16
star
24

otf-making-benchmark

Compare makeotf with fontmake output
Python
15
star
25

robofont-scripts

Python scripts for RoboFont
Python
14
star
26

adobe-cyrillic-charsets

Adobe Cyrillic Character Sets
HTML
13
star
27

Adobe-CNS1

The Adobe-CNS1-7 Character Collection
12
star
28

pyots

Python bindings for OpenType Sanitizer via Python C Extension
Python
11
star
29

adobe-greek-charsets

Adobe Greek Character Sets
HTML
10
star
30

cffsubr

Standalone CFF subroutinizer based on AFDKO tx
Python
8
star
31

Adobe-Manga1

The Adobe-Manga1-0 Character Collection
6
star
32

shell-scripts

Scripts to run in the Terminal
Shell
4
star
33

ehandler.ps

PostScript error handler
PostScript
4
star
34

krname-ivd-collection

KRName IVD Collection
PostScript
3
star
35

psautohint-testdata

PostScript
1
star