Installing and invoking Xgridfit
Installation
At the moment there is no installer for any system other than Linux. On a Linux system, open a shell, change to the xgridfit directory, become root, and type
make install
If you want to install the documentation as well, instead type
make install-all
Running
Open your Xgridfit program file and make sure it contains an <infile> element containing the name of the FontForge source file (.sfd) or TrueType file (.ttf) to which instructions are to be added. If you want your output file to be saved under a different name, make sure your program contains an <outfile> element containing the name of the file (.sfd or .ttf) to be output. Now invoking Xgridfit is simply a matter of typing xgridfit on the command line, with the name of the program file (the extension should be .xgf or .xml) as a parameter, e.g.
$ xgridfit Junicode-Bold.xgf
If all goes well, Xgridfit will produce a script named Junicode-Bold.pe. If the file named in the <infile> element is present, you may simply run your script in FontForge:
$ fontforge -script Junicode-Bold.pe
The script produced by Xgridfit will open the .sfd or .ttf file, add cvt, fpgm and prep tables, add instructions to each glyph, and either save an .sfd file or generate a TrueType (.ttf) font.
The xgridfit script for Linux takes several command-line parameters:
- -a value
- Size of TrueType stack (default is 128).
- -b value
- Delta Break value: maximum number of delta pairs that can be placed on the stack with a single push instruction.
- -d
- Run in debug mode. Output is file.debug rather than file.pe.
- -g glyph
- Compile only the specified glyphs and skip all others. If more than one ps-name is given, they must be separated by "+" signs. No spaces permitted. See also the <glyph-select> element.
- -i file
- File to be input by generated script. Must have extension .sfd or .ttf.
- -o file
- File to be output by generated script. Must have extension .sfd or .ttf.
- -q
- Run in quiet mode. Routine messages are suppressed, but warnings and error messages are displayed.
- -s value
- Maximum places in TrueType storage area. This area of memory is used to store variables, and also Xgridfit's own run-time data. The number must always be 24 or greater.
- -t value
- Maximum number of points in Twilight zone. The default is 25, but few fonts require so many.
Here are some sample command lines:
Compiling all glyphs: xgridfit myfont.xgf Compiling only glyph uni0312: xgridfit -g uni0312 myfont.xgf Compiling several related glyphs: xgridfit -g a+macron+amacron myfont.xgf Producing a file to aid in debugging: xgridfit -d -g a+macron+amacron myfont.xgf Specifying input and output files: xgridfit -i myfont.sfd -o myfont.ttf
You may also invoke your favorite XSLT processor directly--in which case parameters have a longer form. Here Xgridfit is run with xsltproc, a command-line program packaged with libxslt and found in most recent Linux distributions:
xsltproc -o Junicode-Bold.pe \ --stringparam infile Junicode-Bold.sfd \ --stringparam outfile Junicode-Bold.ttf \ --param max-twilight-points 29 \ --param max-storage 128 \ /usr/local/share/xgridfit/lib/xgridfit.xsl Junicode-Bold.xgf
Here are illustrations of how to use Xgridfit with various XSLT processors. (If you run Xgridfit under Windows or the Mac you will need to do things differently; but the parameters will be the same.) First Saxon:
java -jar /usr/local/saxon/saxon.jar \ -o Junicode-Bold.pe \ Junicode-Bold.xgf \ /usr/local/share/xgridfit/lib/xgridfit.xsl
Xalan C++:
xalan -in Junicode-Bold.xgf \ -out Junicode-Bold.pe \ -xsl /usr/local/share/xgridfit/lib/xgridfit.xsl \ -param infile "'Junicode-Bold.sfd'" \ -param outfile "'Junicode-Bold.sfd'"
Xalan java:
java org.apache.xalan.xslt.Process -in Junicode-Bold.xgf \ -out "Junicode-Bold.pe" \ -xsl /usr/local/share/xgridfit/lib/xgridfit.xsl
If you like (and are feeling confident), you can skip generation of a FontForge script file and pass the output of an Xgridfit run directly to FontForge:
xsltproc /usr/local/share/xgridfit/lib/xgridfit.xsl \ Junicode-Bold.xgf | fontforge -script -
Note: The 4xslt processor does not work with Xgridfit: I do not know why. Other XSLT processors may or may not work: I can undertake to test only the major Open Source processors.