This is an archive of the original scripts.sil.org site, preserved as a historical reference. Some of the content is outdated. Please consult our other sites for more current information: software.sil.org, ScriptSource, FDBP, and silfontdev



Home

Contact Us

General

Initiative B@bel

WSI Guidelines

Encoding

Principles

Unicode

Training

Tutorials

PUA

Conversion

Resources

Utilities

TECkit

Maps

Resources

Input

Principles

Utilities

Tutorials

Resources

Type Design

Principles

Design Tools

Formats

Resources

Font Downloads

Gentium

Doulos

IPA

Rendering

Principles

Technologies

OpenType

Graphite

Resources

Font FAQ

Links

Glossary


Computers & Writing Systems

SIL HOME | SIL SOFTWARE | SUPPORT | DONATE | PRIVACY POLICY

You are here: Type Design > Resources
Short URL: https://scripts.sil.org/fontutils

FontUtils

Toolkit for font developers

Martin Hosken, Bob Hallissy, Alan Ward, David Raymond, 2016-09-08

Updated 2016-09-08, version 1.06

Many new features and bug fixes. For details please see:

Previous updates

2015-01-26 - Added GSUB Type 8 Reverse-chaining substitution, make_fea; bugfixes to ttfsubset, hackos2, ttf2woff, others.

2015-08-04 - Source repositories moved to Github:  font-ttf and  font-ttf-scripts.

2014-01-14 - Improvements to ttfbuilder, ttfsubset, volt2ttf, dumpfont, ttf2woff, psfix and others; bug fixes throughout; clarified license.

2012-08-29 - Ten new utilities; bug fixes and enhancements throughout.

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

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

CommandSynopsis
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_fea

make_fea [-a attach.xml] [-i file] [-l type [-s num]] [-n num] infile outfile

Analyse the input font and attachment point database to generate Adobe Font Development Kit (AFDKO) Feature files, including classes for related glyphs and adding attachment point information.
make_gdl

make_gdl [-a attach.xml] [-i file] [-l type [-s num]] [-n num] 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 https://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.

namepurposereplaced by
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.

FontUtils 1.06 Installer
Martin Hosken, Bob Hallissy, 2016-09-08
Download "TTFontUtils_1_06_02.exe", Windows application, 4MB [4764 downloads]

Older versions

FontUtils 1.05 Installer
Martin Hosken, Bob Hallissy, 2015-01-26
Download "TTFontUtils_1_05.exe", Windows application, 3MB [3131 downloads]
FontUtils 1.04.1 Installer
Martin Hosken, Bob Hallissy, 2014-01-14
Download "TTFontUtils_1_04_1.exe", Windows application, 3MB [3276 downloads]
FontUtils 1.00 Installer
Martin Hosken, Bob Hallissy, 2012-08-29
Download "TTFontUtils_1_00.exe", Windows application, 3MB [3964 downloads]
FontUtils 0.13 Installer
Martin Hosken, Bob Hallissy, 2009-04-09
Download "TTFontUtils_0_13.exe", Windows application, 2MB [3979 downloads]
FontUtils 0.11 Installer
Martin Hosken, Bob Hallissy, 2008-06-11
Download "TTFontUtils_0_11.exe", Windows application, 2MB [3557 downloads]
FontUtils 0.10 Installer
Martin Hosken, 2007-11-16
Download "TTFontUtils_0_10.exe", Windows application, 2MB [4330 downloads]

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. Two dependencies you will also need are  Text-PDF and  Text-Unicode-Equivalents

Public GitHub Repository

You may browse or obtain updated sources directly from our public  GitHub repository. From this repository you will need four packages:

Perl module installation

Windows users please note

The first requirement is to have Perl on your computer.  Strawberry Perl is our current favorite; you can also use ActiveState  ActivePerl.

Installing perl modules requires that you have a make utility of some sort, and such isn't built into Windows. Strawberry Perl comes with dmake, but ActivePerl does not include any make utility. On its website Microsoft used to freely provide nmake, but unfortunately some versions of nmake are not capable of installing Font:TTF so if you are using ActivePerl the recommended dmake is available from  cpan.

Note also: If you have more than one make-like program you can find out which one Perl is using by inspecting the output of 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 library modules (Font:TTF, Text:PDF, Text:Unicode:Equivalents) and finally for 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

Both of the two constituent source packages contain a Changes file that identify 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 significant changes in FontUtils v 1.06

Bug fixes and/or new capabilities:

  • make_gdl
    • new options: -o, --package, --classwarn
    • improved attachment processing
    • doesn't crash if the matching "moving APs" (e.g., "_above") don't exist.
    • removed non-functioning -d option; use --autodefines instead
  • make_fea
    • new options: --markattach, --preinclude, --package, --classwarn
    • many bugfixes and improvements in generated code
  • make volt — new options: --package, --classwarn
  • ttftable — new option: -s
  • ttfname — -t 0 now works
  • ttfsubset — fix graphite generation
  • fret
    • now handles glyphs that reference empty glyphs
    • better PDF generation for embedded fonts
  • dumpfont
    • new option: -d
    • now supports dumping woff metadata

General bug fixes include:

  • Mark-to-ligature and extension lookup processing
  • Silf table processing
  • Documentation corrections

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-TTFgooglegroups.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-2016 SIL International


© 2003-2024 SIL International, all rights reserved, unless otherwise noted elsewhere on this page.
Provided by SIL's Writing Systems Technology team (formerly known as NRSI). Read our Privacy Policy. Contact us here.