add (C) notice.
[mftrace.git] / README.texi
blob198d0fa436c68b02ac702296e836d4d70127c8c1
1 \input texinfo @c -*-texinfo-*-
3 @c part of
4 @c mftrace - Generate Type1 or TrueType font from Metafont source.
5 @c 
6 @c Copyright (c)  2001--2006 by
7 @c  Han-Wen Nienhuys, Jan Nieuwenhuizen
8 @c  
9 @c This file is distributed under terms of the GNU Free Documentation
10 @c License.
11 @c 
13 @setfilename README.info
14 @settitle  mftrace - Scalable Fonts for MetaFont
15 @node Top, , , 
16 @top
18 @chapter mftrace - Scalable PostScript Fonts for MetaFont
20 @section Introduction
22 @code{mftrace} is a small Python program that lets you trace a @TeX{}
23 bitmap font into a PFA or PFB font (A PostScript Type1 Scalable Font)
24 or TTF (TrueType) font.  It is licensed under the GNU GPL.
26 Scalable fonts offer many advantages over bitmaps, as they allow
27 documents to render correctly at many printer resolutions. Moreover,
28 Ghostscript can generate much better PDF, if given scalable PostScript
29 fonts.   
31 Versions prior to 1.0.5 were called `pktrace'.
33 @section Download
35 @itemize
36 @item @uref{http://www.xs4all.nl/~hanwen/mftrace/mftrace-@MFTVERSION@.tar.gz}
37 @item Anonymous CVS at 
38 @code{anoncvs@@subversions.gnu.org:/cvsroot/lilypond}, module
39 @code{mftrace}.
40 @end itemize
43 @section Required
45 @file{mftrace} is a thin Python wrapper around some other programs that
46 do the real work: a tracing program and t1asm.  To run mftrace you need:
47 @itemize @bullet
48 @item A tracing program:
49       autotrace >= 0.30 (see @uref{http://autotrace.sourceforge.net}
50       or potrace (see @uref{http://potrace.sourceforge.net}).
52       Potrace is recommended as it runs quicker than autotrace.
53       
54 @item Python--2.1 or later. See @uref{http://www.python.org/}
55 @item t1utils. See @uref{http://www.lcdf.org/~eddietwo/type/}
56 @item  TeX--your tex installation should include
57 @itemize @bullet
58   @item  kpsewhich,
59   @item  MetaFont
60 @end itemize
61 @end itemize
63 @section Recommended
65 @itemize @bullet
66 @item A recent version (040215 or newer) of
67 @uref{http://fontforge.sourceforge.net,FontForge}. Some of @code{mftrace}
68 functionality requires FontForge to be present on user's system. This
69 includes rounding to integer, simplifying and autohinting font outlines,
70 as well as generating any output formats except PFA, PFB and AFM. You
71 should not request any of these features using @code{mftrace} options if
72 you don't like your font to be run through FontForge (note that in this
73 case you also have to explicitly specify @code{--noround} to disable 
74 rounding to integer).
76 @item Alternatively, you need GhostScript with its @file{printafm}
77 utility, available somethere in your PATH. @code{mftrace} uses
78 @file{printafm} to generate AFM files in case there is no need to
79 process the font with FontForge.
81 @end itemize
83 @section Red Hat
85 A RPM may be built by issuing
86 @example
88         rpm -tb mftrace-@var{version}.tar.gz
90 @end example
94 @section Debian GNU/Linux
96 Users of Debian unstable (and Debian 3.0 when it is released) can
97 install all requirements by running (as root):
98 @example
100     apt-get install mftrace
102 @end example
103 If you wish to also install the FontForge package to simplify and
104 autohint the font, then run the command
105 @example
107     apt-get install fontforge
109 @end example
112 @section Install
114 Install the prerequite packages. Then run
115 @example
117     ./configure
118     make install
120 @end example
121 in the mftrace directory. Run as follows:
122 @example
124 mftrace cmr10
126 @end example
128 @section Invoking mftrace.
130 Command line options:
131 @table @code
132 @item --formats=LIST
133  A comma-separated list of formats to generate. Choices include:  AFM, 
134  PFA, PFB, TTF and SVG. Default is to generate a PFA file. Note that 
135  @file{fontforge} (formerly called @file{pfaedit}) needs to be installed
136  in order to generate any format except PFA or PFB. For generating AFM 
137  you need either @file{fontforge} or @file{ghostscript}.
138 @item -e,--encoding=@var{enc}   
139  Use encoding file @var{enc}. Encoding files used by @code{mftrace} are 
140  basically in the  GhostScript/dvips format, but you may use a special
141  @code{.notavail} glyph name in order to tell mftrace not to process
142  a specific glyph. If this option is not specified,  mftrace will try to 
143  determine the encoding file automatically, from the encoding specified 
144  in the TFM file.
145 @item --glyphs=@var{list}
146   Only process glyphs in @var{list}, which is a  comma-delimited  list of
147   decimal numbers or ranges.
148 @example
149   --glyphs 1-10,50,55,90-100
150 @end example
151 @item --gffile=@var{name}
152 =  Take glyphs from file @var{name}. 
153 @item --grid @var{gridsize}
154 Set reciprocal grid size in em units multiplied by ratio magnification/1000. 
155 For example @code{--grid 10 --magnification 1000} will round
156 coordinates of control points to 1/10 of em unit. Useful simultaneously
157 with @code{--noround}  option. Default @var{gridsize} value is 1, i. e. round to integer.
158 @item -h,--help 
159  help on options.
160 @item -k,--keep 
161  Retain all temporary files in the directory @file{mftrace.dir/}. This
162  is useful for debugging problems.
163 @item --keep-trying
164  Try to continue if external programs called by mftrace fail. If METAFONT
165  crashes with overflow errors, but nevertheless outputs a GF file, try to 
166  process its output as is (useful for some buggy fonts, see below). If 
167  potrace/autotrace fails to trace a specific character, first try it with 
168  a less smoothed curve, and if that fails, skip the character.
170  By default mftrace outputs @file{trace-bug-FONTNAME-NUMBER.pbm} and
171 stops the process with a request to file a bugreport.
172 @item --magnification
173 The magnification to use for the PFA file. The default is 1000. The
174 larger the more precise the PFA file will be. However, when
175 magnification is too large METAFONT can crash with overflow errors.
177 Sadly, many MF fonts contain resolution checks
178 @example
179   if dots_per_inch * design_size > 1500:  
180     ...
181 @end example
182 This check is susceptible to overflow errors.  Such code should be
183 reported as a bug, and changed to
184 @example
185   if dots_per_inch > (1500 / design_size):
186     ...
187 @end example
189 @item --noround 
190 Don't round coordinates of control points to integer
191 values. Useful simultaneously  with
192 @code{--grid} option. Disabled by default.
194 @item -o,--output-base=FILE
195  Output to FILE.pfa or FILE.pfb.
196 @item --simplify
197  Pass the font through FontForge for automatic  simplification and hinting.
198 @item --tfmfile=FILE   
199  Use @var{file} for the TFM file.  This file is needed to determine at
200  what resolution to run MetaFont.
201 @item  -V,--verbose 
202  Be verbose: print all commands as they are invoked. This is useful
203  for debugging.
204 @item -v,--version 
205  Print version number
206 @item --dos-kpath
207  Try to kludge up the paths coming from MikTeX for a cygwin
208 environment. If this doesn't work, specify @code{--tfmfile} and
209 @code{--encoding} manually.
210 @item -w,--warranty  
211 show warranty and copyright
212 @item --potrace
213 use Potrace (default).
214 @item --autotrace
215 use AutoTrace.
217 @item -D,--define=@var{symbol}=@var{value}
218 Set the font info @var{symbol} to the given @var{value}. For example
219 @code{-DFamilyName=Foo} sets the font family name to @code{Foo}.
221 Mftrace tries to fill in sensible values for the FontName, FamilyName,
222 FullName and Weight fields. It does so by guessing values for the CM font
223 series. For other fonts, it tries to read an AFM file (which is not likely
224 to exist). Suggestions for a more generic way to handle this are welcome.
226 @end table
228 Mftrace uses kpathsea for finding fonts, so any kpathsea variable can
229 be used to fine-tune which files should be loaded.  For example, you
230 can set @code{MFINPUTS} to specify which paths to search for
231 @file{.mf} files.
233 Additional options may be passed to the backend program (potrace or autotrace)
234 with the @code{MFTRACE_BACKEND_OPTIONS} environment variable.
237 @section Discussion
239 Why use @code{mftrace} over
240 @uref{http://textrace.sourceforge.net,textrace}?  Textrace and mftrace
241 are functionally similar. However, mftrace is quicker, more cleanly
242 written and can be installed using standard methods. Additionally,
243 textrace requires perl, ghostscript and dvips.
245 How about @uref{http://www.truetex.com,MetaFog}? MetaFog operates
246 directly on the curves that generate the bitmap font, its outlines will
247 probably be smaller and better. However, MetaFog is a proprietary
248 product: its source code is not available, and it will only run on a
249 limited number of platforms.
251 How about @uref{ftp://bop.eps.gda.pl/pub/metatype1/,MetaType1}?
252 MetaType1 is an approach that puts severe constraints on what may be
253 done in a font program. It does not work for fonts containing overlaps
254 and shaped pens.
256 How about @uref{http://fontforge.sourceforge.net/,FontForge} itself?
257 FontForge is an interactive editor, but it can be scripted. Since it
258 supports bitmap tracing and @TeX{} bitmap fonts, it is possible to
259 duplicate the functionality of mftrace.  However, out of the box,
260 FontForge does not recognize TeX encodings.
263 @section Bugs and todo
265 @itemize
266 @item Discuss fonts & copyright.
267 @item Submit @file{tfm.py} to www.python.org. @file{tfm.py}  is a python
268   module to parse Tex Font Metric file.
269 @end itemize 
271 Should you encounter any bug or problem, then please send a bugreport
272 to @email{hanwen@@xs4all.nl,Han-Wen Nienhuys}.
274 @section Author
276 @email{hanwen@@xs4all.nl,Han-Wen Nienhuys}
279 @section Credits
281 The biggest credits go out to Martin Weber for AutoTrace, Peter
282 Selinger for potrace and @email{gww@@silcom.com,George Williams}, for
283 FontForge.
285 Thanks to all contributors for finding bugs,
286 @itemize @bullet
287 @item
288 Andrey V. Panov
289 @item
290 Geoffrey Alan Washburn
291 @item
292  @uref{http://www.maths.qmul.ac.uk/~jdg/,Julian Gilbey}
293 @item
294   G@"{u}nther Spahlinger 
295 @item
296   Richard Mahoney
297 @item
298   Stanislav Brabec
299 @item
300   Thomas Bushnell BSG 
301 @item
302    Many others
303 @end itemize
307 The package also contains gf2pbm, a utility to convert a MetaFont GF
308 file to a PBM file. Its source code was based on Paul Vojta's Xdvi
309 program. The license notice is reproduced here:
312 @quotation
313 Copyright (c) 1990-1999  Paul Vojta
315 Permission is hereby granted, free of charge, to any person obtaining a copy
316 of this software and associated documentation files (the "Software"), to
317 deal in the Software without restriction, including without limitation the
318 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
319 sell copies of the Software, and to permit persons to whom the Software is
320 furnished to do so, subject to the following conditions:
322 The above copyright notice and this permission notice shall be included in
323 all copies or substantial portions of the Software.
325 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
326 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
327 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
328 PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
329 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
330 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
331 @end quotation
333 This page is licensed  
336 @section See also
338 @itemize @bullet
339 @item @uref{http://partners.adobe.com/asn/developer/pdfs/tn/T1Format.pdf,Type1
340 font specification} 
341 @item @uref{http://partners.adobe.com/asn/developer/pdfs/tn/5015.Type1_Supp.pdf,Supplement
342 to the Type1 specification}.
343 @end itemize
347 @bye