You are here: Type
Design > Resources
Short URL: http://scripts.sil.org/fontutils
FontUtils
Toolkit for font developers
Martin Hosken, Bob Hallissy, Alan Ward, David Raymond, 2012-08-29; 25435
reads
Updated 2012-08-29, version 1.00
Ten new utilities (identified in italics in the table below); bug fixes and
enhancements throughout the package.
Previous updates
2009-04-17 - New utility (ttfdeflang); new options (ttftable).
2008-06-11 - New utility (add_classes); new options (make_gdl, make_volt, volt2ttf); improvements to
volt2ttf.
2007-11-16 - New utilities (volt2ttf, ttf2volt, ttfbboxfix, ttftable, sfd2ap, volt2ap); ttfname
improvements.
2006-06-24 - New versions all round, added bundle package
2006-04-20 - Improved make_gdl, make_volt. Supports OS/2 version 3.
2005-06-09 - Addition of voltFixup, voltImportAnchors and voltExportAnchors.
Introduction
The utilities
Obsolete or outdated utilities
Usage
Download and Installation
Windows binary installer
Older versions
Perl source
CPAN source
SVN Repository
Perl module installation
Changes
Summary of changes in FontUtils v 1.00
Support
Introduction
SIL FontUtils collection provides command line tools for manipulating TrueType fonts. These tools are
cross-platform and work on Windows, Mac, and Linux.
Written in pure Perl, the source modules (Font::TTF::Scripts and the supporting library package Font::TTF)
have been available for a number of years and are an essential tool of NRSI's font development processes. For
Perl users the most up-to-date sources can be retrieved from our Subversion repositories.
These scripts are also packaged as standalone Windows executables, making them usable by those who do not
have Perl.
The utilities
(Utilities new to this release are shown in italics)
| General font hacking and
repairing: |
| hackos2 |
HACKOS2 [-c hex] [-d directory] [-f fsSelection] [-p hex] [-q] [-t num] [-u hex] [-w
width] Hacks various fields in the OS/2 table of a ttf file, including: fsType, panose,
ulUnicodeRange, achVendID, fsSelection, usFirstCharIndex, usLastCharIndex and ulCodePageRange
|
| psfix |
PSFIX infile outfile Updates Postscript table to account for Postscript Unicode conventions.
|
| ttf2woff |
ttf2woff [-m metadatafile] [-p privatefile] infile.ttf outfile.woff Converts a TTF file into
a WOFF file appending optional metadata and private data.
|
| ttfascent |
ttfascent [-a num] [-d num] [-l num] infile [outfile] Opens infile (a .ttf file) changes the
ascent and descent values in the Hhea and OS/2 table and then writes the resulting file to outfile
if specified.
|
| ttfeval |
tteval [options] infont.ttf ... ttfeval is a wrapper for those one- or two-line font hacks.
It does the work of including the Font:TTF module, opening the input font file, and optionally
writing the output font file. You just supply the code in the middle.
|
| ttffeatparms |
ttffeatparms [-d] [-c control.xml] infile.ttf outfile.ttf Adds feature parameters to Opentype
stylistic set or character variants features
|
| ttfbboxfix |
ttfbboxfix [-v] in.ttf [out.ttf] Reports bounding box errors in a font. If out.ttf is
provided, rewrite corrected font.
|
| ttfdeflang |
ttfdeflang -d lang infile.ttf outfile.ttf Creates a font with the given language id as being
default.
|
| ttfname |
ttfname [-f "new_full_name"] -n "new_name" [-t num] [-q] in.ttf out.ttf Renames the TTF with
the given name and outputs the newly named font.
|
| ttfremap |
TTFRemap -c file [-r] [-s | -u] Remaps the MS cmap of a font without removing any glyphs.
Updates the OS/2 table according to first and last char of new cmap.
|
| ttfsetver |
ttfsetver [-d "description"] version infile outfile Sets font version (in both head and name
tables).
|
| ttfsubset |
ttfsubset [options] infont outfont Opens infont (a .ttf file), subsets it according to the
supplied options, then writes the resulting file to outfont.
|
| ttftable |
ttftable [options] in.ttf [out.ttf] Opens in.ttf for reading, optionally imports, exports,
and/or deletes tables from the font, then writes the modified font to out.ttf if provided.
|
| TTFBuilder / Attachment Point
related: |
| add_classes |
add_classes -c classes.xml infile.xml Adds class information to an attachment point database.
|
| check_attach |
check_attach [-z outfile.xml] infile.xml infile.ttf Checks an attachment point database
against a font, checking that any contours are single point and any locations tie up with their
corresponding contour, or that there exists a single point contour at a given location. This
program can also generate missing information and write it to a new attachment point database.
|
| make_gdl |
make_gdl [-a attach.xml] [-i file] [-l type [-s num]] [-n num] [-z bitfield] infont.ttf
outGDL.txt Analyse the input font and attachment point database to generate gdl code including
classes for related glyphs and adding attachment point information.
|
| make_volt |
make_volt [-t] [-a attach.xml] [-l ligtype] [-i file] [-n] infont.ttf outfile Analyse the
input font and attachment point database to generate VOLT project code including classes for
related glyphs and anchor point information. Can also merge existing volt code.
|
| sfd2ap |
sfd2ap infile.sfd [outfile.xml] Reads a FontForge font file and extracts anchor point
information into an XML attachment point database.
|
| ttfbuilder |
ttfbuilder [-a] [-h] -c config.xml [-x attach.xml] [-z out.xml] infile.ttf outfile.ttf Builds
outfile.ttf from infile.ttf according to config.xml.
|
| volt2ap |
volt2ap [-t voltdat.txt] infile.ttf > outfile.xml Export glyph data, including anchors, to
XML attachment point database
|
| VOLT related: |
| ttf2volt |
ttf2volt [options] infontfile [outfontfile] Attempts to create a VOLT project from an
existing OpenType font by reading and interpreting the existing GDEF, GPOS, and GSUB tables. Not
every OpenType rule can be mimiced in VOLT; warnings are issued when ttf2volt cannot handle
something.
|
| volt2ttf |
volt2ttf [-a attach.xml] [-t volt.txt] infile.ttf outfile.ttf Compiles volt source into OT
tables in the font. Think of this as a 3rd party command-line version of MS VOLT.
|
| TypeTuner related:
(see http://scripts.sil.org/typetuner) |
| ttflang2tuner |
ttflang2tuner [-c] [-v] infile.ttf ... Builds TypeTuner features configuration file(s) from
the script and language tags contained in the GPOS and GSUB tables of OpenType font(s).
|
| typetuner |
TypeTuner -x <xml> <ttf> (create settings xml file from ttf)
TypeTuner <xml> <ttf> (apply edited settings xml file to ttf)
TypeTuner [<switches>] <command> [files, ...] Enables developers to create fonts
which users can then alter (also using TypeTuner) to change default glyphs and behaviors.
|
| Fontforge related: |
| sfdmeld |
sfdmeld [-a ap.xml] [-p] structure.sfd design.sfd output.sfd Merges two FontForge font files
such that the lookups and behaviour in the second (design) file is overridden by that in the first
file.
|
| sfdmerge |
sfdmerge [-r winner] base local other Does a 3 way ancestral merge of sfd files.
|
| Miscellaneous: |
| addfont |
addfont [-r] [-f] *.ttf Installs or uninstalls a font in Windows without copying it. Can
include wildcards.
|
| dumpfont |
dumpfont [-t taglist] [-a attach.xml] font.ttf Dump font table structures. "taglist" is a
comma-or space-separated list of tags specifying which tables to dump.
|
| fret |
FRET [-f] [-g] [-r] [-s size] [-p package] [-q] font_file [out_file] Generates nice PDF
reports on a font.
|
Utilities arranged by category
Obsolete or outdated utilities
A number of utilities formerly installed with this package have been obsoleted by alternative tools or
deemed to be low usage and so are no longer installed as executables by the standard installers (binary or
source). However, the source bundle includes all of these in the Examples folder.
| eurofix |
Update legacy fonts for the Win98 change in codepage 1252 |
|
| thai2gdl |
Creates GDL for a Thai font |
|
| thai2OT |
Creates OpenType tables for Thai font |
|
| thai2volt |
Creates VOLT for a Thai font |
|
| ttfenc |
Creates a Postscript mapping file for the given font |
|
| VoltFixup |
"Smart" import of a VOLT project to a new font. |
make_volt |
| VoltImportAnchors |
Imports anchor definitions from XML |
make_volt |
| VoltExportAnchors |
Exports VOLT anchor definitions to XML |
volt2ap |
Obsolete / outdated utilities
Usage
All of the tools are commandline, so you will typically launch them by typing the command name and
parameters into a CMD window.
Most tools provides their own "usage" message explaining the parameters. To get the usage message, execute
the command with no parameters. For example:
C:>ttfname
Usage:
ttfname [-f "full_name"] -n "name" [-t num] [-q] infile.ttf outfile.ttf
Renames the TTF with the given name and outputs the newly named font to out.ttf.
Options:
-f "name" specifies new full name (optional) as opposed to the
default calculated form.
-l lang language number to use (default all langs)
if specified name entries will be added for all platforms and
encodings covered by the cmap if not already there
-n "name" specifies new font family name (not optional)
-p Don't update postscript font name
-q disable signon message
-r num Removes all strings of the given id
-s filename overrides -n and gets string from file. Useful for -t
-t num overrides the normal naming areas to change another
string -f becomes inactive. Use -l as well to create entry.
-w "name" overrides subfamily in the font (think weight). So a full name
may be made from -n and -w together.
Note also that many of the commands now support a -h option for more complete help.
Download and Installation
Windows binary installer
The installer should be downloaded to a temporary folder and then launched. This will install the package.
By default the installer adds the installation folder to your PATH.
As an alternate installation: turn off the option to modify your PATH variable during installation. When
the installer has finished, copy all the .BAT files from the install directory (typically C:/Program Files/SIL/FontUtils to a folder that is already on your PATH.
Older versions
Perl source
The source is organized into two separate packages:
| Font::TTF |
This is the underlying object library that implements an
in-memory structure representing an OpenType font. There are no ready-to-run commands included with
this package — just the support library. |
| Font::TTF::Scripts |
This is a collection of command-line programs and further
utility libraries, built on top of Font::TTF, that provide the
command-line functionality. All of the commands mentioned above plus other example programs, some
useful in their own right, are included. |
Perl 5.8 or newer is required.
These two packages are available in several ways:
CPAN source
Snapshots of the source packages are available on
CPAN. The links for the latest such snapshot
are
Font-TTF and
Font-TTF-Scripts.
SVN Repository
You may browse or obtain updated sources directly from our public
Subversion repository. Two methods of
access are available: from your SVN client, or using a web browser:
Perl module installation
Windows users please note
Installing perl modules requires that you have a make utility of some sort,
and such isn't built into Windows. On its website Microsoft provides the free nmake, but unfortunately some versions of nmake are not capable of installing Font:TTF. If
you are using ActiveState
ActivePerl, the recommended program is dmake available from
cpan.
Note also: If you have both nmake and dmake on your system, ActivePerl prefers nmake unless dmake
appears first on the PATH. To find out which version of make Perl is using,
issue the command perl -V:make. You can instruct ActivePerl to prefer dmake by
setting the environment variable ACTIVEPERL_CONFIG_MAKE=dmake.
Once you have an appropriate make program, the easiest way to get and obtain
the modules is using the cpan program that is likely to be part of your Perl
installation. Simply execute:
cpan -i Font::TTF
cpan -i Font::TTF::Scripts
If you don't have cpan, or it doesn't work, download and unpack the source
archives from the links above. Then, first for Font:TTF and then Font:TTF:Scripts, locate the folder
containing the file Makefile.pl. From a command prompt in that folder, give the
standard Perl module install incantation of:
perl Makefile.pl
make
make test
make install
(substituting dmake for make if on
Windows).
Changes
Each of the constituent source packages contain a Changes file that
summarizes the changes made in recent revisions. To view these files directly with a web browser click
Font:TTF Changes
and Font:TTF:Scripts
Changes.
Summary of changes in FontUtils v 1.00
Version 1.00 of the FontUtils package contains major
enhancements over previously released packages. Many of the improvements are due to enhancements to the
underlying Font:TTF package (upated to version 0.49), including:
- Ability to read fonts packaged using the Web Open Font Format
WOFF format
- Support for newer versions of the OS/2, kern, and GDEF tables
- Automatic sorting of coverage tables (per the OpenType Spec)
- Support for OpenType FeatureParam definitions for cvxx, size, and ssxx features
Between version 0.13 and 1.00, nine new utilities have been added and a tenth, TypeTuner, has been
incorporated into the package:
- dumpfont - Dump font table structures
- ttf2woff - Converts a TTF file into a WOFF file appending optional metadata and private data
- ttfascent - Change the ascent and descent values in a font
- ttffeatparams - Adds feature parameters to Opentype Stylistic Set, Character Variants or Size
features
- ttflang2tuner - Builds TypeTuner features configuration file(s) from the script and language tags
contained in the GPOS and GSUB
- ttfsubset - Subsets a font
- TypeTuner - Makes it possible to change the default glyphs and behaviors in certain fonts if the
current defaults don't fit your needs
- sfdmerge - Does a 3 way ancestral merge of sfd files
- sfdmeld - Merges two FontForge font
- ttfeval - a wrapper for those one- or two-line font hacks
Support
A public mailing list is available for users and developers of the Font::TTF and Font::TTF::Scripts
packages. Visit
the Font-TTF list to view the content online or to subscribe
with your GoogleGroups login. If you don't have a GoogleGroups login, simply send a subscription request to
Font-TTF
googlegroups.com.
Please recognize, however, that the existence of this group does not change the fact these utilities and
libraries are essentially unsupported. If you find and report a bug, we'll try to find time to fix it. If you
find a bug and suggest a patch, we'll get around to reviewing the suggestion as soon as we can. But no
guarantees on time-frames.
Copyright notice
Copyright (c) 1997-2012 SIL International
© 2003-2013 SIL International, all rights
reserved, unless otherwise noted elsewhere on this page.
Provided by SIL's Non-Roman Script Initiative. Contact us at .