You are here: Type Design > Resources
Short URL: http://scripts.sil.org/fontutils
FontUtils
Toolkit for font developers
Martin Hosken, Bob Hallissy, 2009-04-17; 18412 reads
Updated 2009-04-17, version 0.13
New utility: ttfdeflang - creates a font with the given language id as being default.
New options: -update and -list options for ttftable
Previous updates
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
Support
Introduction
The Font::TTF::Scripts Perl module provides a number of command line tools for manipulating TrueType fonts. The tools (and the supporting library package Font::TTF) have been available to Perl users for a number of years, and they 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.
Now these scripts have been packaged as standalone Windows executables, making them usable by those who do not have Perl.
The utilities
This package includes, among other utilities:
| General font hacking |
| add_classes |
add_classes -c classes.xml infile.xml
Adds class information to an attachment point database. |
| addfont |
addfont [-r]
Installs or uninstalls a font in Windows without copying it. can
include wildcards. Much less hassle than opening the Windows/Fonts directory. |
| eurofix |
EUROFIX [-m num] infile outfile
Edits a font to account for the change in codepage 1252 definition in Win98,
NT5 and all things new then. -m specifies that the Mac hack should also be
done. |
| fret |
FRET [-f] [-g] [-r] [-s size] [-p package] [-q] font_file [out_file]
Generates nice PDF reports on a font. |
| 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 |
| 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. |
| psfix |
PSFIX infile outfile
Updates Postscript table to account for Postscript Unicode conventions. |
| 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). |
| 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 related |
| 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. |
| 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. |
| 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. |
| volt2ap |
volt2ap [-t voltdat.txt] infile.ttf > outfile.xml
Export glyph data, including anchors, to XML attachment point database |
| 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. |
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.
| 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:> eurofix.bat
EUROFIX [-m num] infile outfile
Edits a font to account for the change in codepage 1252 definition in Win98,
NT5 and all things new then. -m specifies that the Mac hack should also be
done.
The following changes are made to ensure that the glyphs at the two positions
are the same, if possible:
U+0080 and U+20AC Euro sign
U+008E and U+017D Z caron
U+009E and U+017E z caron
U+00B7 and U+2219 Middle dot
For more details of which glyph is used where in Windows, see the POD which
accompanies this program.
For the Mac table
glyph at U+0080 (in MS table) copied to num Euro sign
(-m may be for 240 or 211 depending on Apple or MS)
Copies are only made if there is no glyph there already.Note also that many of the commands now support a -h option for fuller 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 FilesSILFontUtils to a folder that is already on your PATH.
Older versions
Perl source
The source is packaged in two separate modules:
| 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 give 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 modules 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.
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 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).
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-2009 SIL International
© 2003-2012 SIL International, all rights reserved, unless otherwise noted elsewhere on this page.
Provided by SIL's Non-Roman Script Initiative. Contact us at .