source: trunk/filemanager/tp/dompdf/lib/ttf2ufm/ttf2ufm-src/README.html @ 2000

Revision 2000, 46.4 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implementação do módulo gerenciador de arquivos

Line 
1<HTML>
2<HEAD>
3<TITLE>
4TTF2PT1 - A True Type to PostScript Type 1 Converter
5</TITLE>
6</HEAD>
7<BODY>
8<!-- =defdoc t1 ttf2pt1 1 -->
9<H2>
10<!-- =section t1 NAME -->
11TTF2PT1 - A True Type to PostScript Type 1 Font Converter
12<!-- =stop -->
13</H2>
14
15<!
16(Do not edit this file, it is generated from README.html!!!)
17>
18<TT>
19[
20<blockquote>
21<!-- =section t1 HISTORY -->
22  Based on ttf2pfa by Andrew Weeks, and help from Frank Siegert.
23<BR>
24  Modification by Mark Heath.
25<BR>
26  Further modification by Sergey Babkin.
27<BR>
28  The Type1 assembler by I. Lee Hetherington with modifications by
29  Kai-Uwe Herbing.
30<!-- =stop -->
31</blockquote>
32]
33</TT>
34<p>
35
36Ever wanted to install a particular font on your XServer but only could find
37the font you are after in True Type Format?
38<p>
39
40Ever asked <TT>comp.fonts</TT> for a True Type to Type 1 converter and got a List
41of Commercial software that doesn't run on your Operating System?
42<p>
43
44Well, this program should be the answer.  This program is written in C (so it
45should be portable)  and therefore should run on any OS.  The only limitation
46is that the program requires some method of converting Big endian integers into
47local host integers so the network functions ntohs and ntohl are used. These
48can be replaced by macros if your platform doesn't have them.
49Of course the target platform requires a C compiler and command line ability.
50<p>
51
52<!-- =section t1 DESCRIPTION -->
53Ttf2pt1 is a font converter from the True Type format (and some other formats
54supported by the FreeType library as well) to the Adobe Type1 format.
55<p>
56
57The versions 3.0 and later got rather extensive post-processing algorithm that
58brings the converted fonts to the requirements of the Type1 standard, tries to
59correct the rounding errors introduced during conversions and some simple
60kinds of bugs that are typical for the public domain TTF fonts. It
61also generates the hints that enable much better rendering of fonts in
62small sizes that are typical for the computer displays. But everything
63has its price, and some of the optimizations may not work well for certain
64fonts. That's why the options were added to the converter, to control
65the performed optimizations.
66<p>
67<!-- =stop -->
68
69The converter is simple to run, just:
70<p>
71
72<!-- =section t1 SYNOPSIS -->
73<blockquote>
74        <tt>ttf2pt1 <i>[-options] ttffont.ttf [Fontname]</i></tt>
75</blockquote>
76or
77<blockquote>
78        <tt>ttf2pt1 <i>[-options] ttffont.ttf -</i></tt>
79</blockquote>
80<!-- =stop -->
81<p>
82
83<!-- =section t1 OPTIONS -->
84The first variant creates the file <tt>Fontname.pfa</tt> (or <tt>Fontname.pfb</tt> if the
85option '<b>-b</b>' was used) with the converted font and <tt>Fontname.afm</tt> with the
86font metrics, the second one prints the font or another file (if the option
87'<b>-G</b>' was used) on the standard output from where it can be immediately
88piped through some filter. If no <tt>Fontname</tt> is specified for the first
89variant, the name is generated from <tt>ttffont</tt> by replacing the <tt>.ttf</tt>
90filename suffix.
91<p>
92
93Most of the time no options are neccessary (with a possible exception
94of '<b>-e</b>'). But if there are some troubles with the resulting font, they
95may be used to control the conversion.
96The <B>options</B> are:
97<p>
98
99<!-- ==over 2 -->
100<!-- ==item * -->
101<TT><B>-a</TT></B> - Include all the glyphs from the source file into the converted
102   file. If this option is not specified then only the glyphs that have
103   been assigned some encoding are included, because the rest of glyphs
104   would be inaccessible anyway and would only consume the disk space.
105   But some applications are clever enough to change the encoding on
106   the fly and thus use the other glyphs, in this case they could
107   benefit from using this option. But there is a catch: the X11 library
108   has rather low limit for the font size. Including more glyphs increases
109   the file size and thus increases the chance of hitting this limit.
110   See <A HREF="app/X11/README.html"><tt>app/X11/README</tt></A> for the description of a
111   patch to X11 which fixes this problem.
112<p>
113
114<!-- ==item * -->
115<TT><B>-b</TT></B> - Encode the resulting font to produce a ready <tt>.pfb</tt> file.
116<p>
117
118<!-- ==item * -->
119<TT><B>-d <i>suboptions</i></TT></B> - Debugging options. The suboptions are:
120<p>
121
122<blockquote>
123   <TT><B>a</TT></B> - Print out the absolute coordinates of dots in outlines. Such
124   a font can not be used by any program (that's why this option is
125   incompatible with '<b>-e</b>') but it has proven to be a valuable debuging
126   information.
127<p>
128
129   <TT><B>r</TT></B> - Do not reverse the direction of outlines. The TTF fonts have
130   the standard direction of outlines opposite to the Type1 fonts. So
131   they should be reversed during proper conversion. This option
132   may be used for debugging or to handle a TTF font with wrong
133   direction of outlines (possibly, converted in a broken way from
134   a Type1 font). The first signs of the wrong direction are the
135   letters like "P" or "B" without the unpainted "holes" inside.
136<p>
137</blockquote>
138
139<!-- ==item * -->
140<TT><B>-e</TT></B> - Assemble the resulting font to produce a ready <tt>.pfa</tt> file.
141<I>
142   [ </I>S.B.<I>: Personally I don't think that this option is particularly useful.
143   The same result may be achieved by piping the unassembled data
144   through t1asm, the Type 1 assembler. And, anyways, it's good to
145   have the t1utils package handy. But Mark and many users think that
146   this functionality is good and it took not much time to add this option. ]
147</I>
148<p>
149
150<!-- ==item * -->
151<TT><B>-F</TT></B> - Force the Unicode encoding: any type of MS encoding specified
152   in the font is ignored and the font is treated like it has Unicode
153   encoding. <B>WARNING:</B> <I>this option is intended for buggy fonts
154   which actually are in Unicode but are marked as something else. The
155   effect on the other fonts is unpredictable.</I>
156<p>
157
158<!-- ==item * -->
159<TT><B>-G <i>suboptions</i></TT></B> - File generation options. The suboptions may be lowercase
160   or uppercase, the lowercase ones disable the generation of particular
161   files, the corresponding uppercase suboptions enable the generation of the
162   same kind of files. If the result of ttf2pt1 is requested to be printed on
163   the standard output, the last enabling suboption of <b>-G</b> determines
164   which file will be written to the standard output and the rest of files
165   will be discarded. For example, <b>-G A</b> will request the AFM file.
166   The suboptions to disable/enable the generation of the files are:
167<p>
168
169<blockquote>
170   <TT><B>f/F</TT></B> - The font file. Depending on the other options this file
171   will have one of the suffixes <tt>.t1a</tt>, <tt>.pfa</tt> or <tt>.pfb</tt>. If the conversion result
172   is requested on the standard output ('<tt>-</tt>' is used as the output file name)
173   then the font file will also be written there by default, if not overwritten
174   by another suboption of <b>-G</b>.
175   <b>Default: enabled</b>
176<p>
177
178   <TT><B>a/A</TT></B> - The Adobe font metrics file (<tt>.afm</tt>).
179   <b>Default: enabled</b>
180<p>
181
182   <TT><B>e/E</TT></B> - The dvips encoding file (<tt>.enc</tt>).
183   <b>Default: disabled</b>
184<p>
185
186</blockquote>
187
188<!-- ==item * -->
189<TT><B>-l <I>language</I>[+<I>argument</I>]</TT></B> - Extract the fonts for the specified language from a
190   multi-language Unicode font. If this option is not used the converter
191   tries to guess the language by the values of the shell variable LANG.
192   If it is not able to guess the language by LANG it tries all the
193   languages in the order they are listed.
194<p>
195
196   After the plus sign an optional argument for the language extractor
197   may be specified. The format of the argument is absolutely up to
198   the particular language converter. The primary purpose of the
199   argument is to support selection of planes for the multi-plane
200   Eastern encodings but it can also be used in any other way. The
201   language extractor may decide to add the plane name in some form
202   to the name of the resulting font. None of the currently supported
203   languages make any use of the argument yet.
204<p>
205
206   As of now the following languages are supported:
207<br>
208   &nbsp;&nbsp;<TT>latin1</TT> - for all the languages using the Latin-1 encoding
209<br>
210   &nbsp;&nbsp;<TT>latin2</TT> - for the Central European languages
211<br>
212   &nbsp;&nbsp;<TT>latin4</TT> - for the Baltic languages
213<br>
214   &nbsp;&nbsp;<TT>latin5</TT> - for the Turkish language
215<br>
216   &nbsp;&nbsp;<TT>cyrillic</TT> - for the languages with Cyrillic alphabet
217<br>
218   &nbsp;&nbsp;<TT>russian</TT> - historic synonym for cyrillic
219<br>
220   &nbsp;&nbsp;<TT>bulgarian</TT> - historic synonym for cyrillic
221<br>
222   &nbsp;&nbsp;<TT>adobestd</TT> - for the AdobeStandard encoding used by TeX
223<br>
224   &nbsp;&nbsp;<TT>plane+<i>argument</i></TT> - to select one plane from a multi-byte encoding
225<p>
226
227   The argument of the "<tt>plane</tt>" language may be in one of three forms:
228<p>
229   &nbsp;&nbsp;<tt>plane+<b>pid=</b><i>&lt;pid&gt;</i><b>,eid=</b><i>&lt;eid&gt;</i></tt>
230<br>
231   &nbsp;&nbsp;<tt>plane+<b>pid=</b><i>&lt;pid&gt;</i><b>,eid=</b><i>&lt;eid&gt;</i><b>,</b><i>&lt;plane_number&gt;</i></tt>
232<br>
233   &nbsp;&nbsp;<tt>plane+<i>&lt;plane_number&gt;</i></tt>
234<p>
235
236   Pid (TTF platform id) and eid (TTF encoding id) select a particular
237   TTF encoding table in the original font. They are specified as decimal
238   numbers. If this particular encoding table is not present in the font
239   file then the conversion fails. The native ("ttf") front-end parser supports
240   only pid=3 (Windows platform), the FreeType-based ("ft") front-end supports
241   any platform. If pid/eid is not specified then the TTF encoding table is
242   determined as usual: Unicode encoding if it's first or an 8-bit encoding
243   if not (and for an 8-bit encoding the plane number is silently ignored).
244   To prevent the converter from falling back to an 8-bit encoding, specify
245   the Unicode pid/eid value explicitly.
246<p>
247
248   Plane_number is a hexadecimal (if starts with "<b>0x</b>") or decimal number.
249   It gives the values of upper bytes for which 256 characters will be
250   selected. If not specified, defaults to 0. It is also used as a font
251   name suffix (the leading "0x" is not included into the suffix).
252<p>
253
254<!-- =stop -->
255   <B>NOTE:</B>
256<!-- =section t1 BUGS -->
257   It seems that many Eastern fonts use features of the TTF format that are
258   not supported by the ttf2pt1's built-in front-end parser. Because of
259   this for now we recommend using the FreeType-based parser (option
260   '<b>-p ft</b>') with the "<tt>plane</tt>" language.
261<p>
262<!-- =stop -->
263
264<!-- =section t1 OPTIONS -->
265<I>
266   <B>NOTE:</B>
267   You may notice that the language names are not uniform: some are the
268   names of particular languages and some are names of encodings. This
269   is because of the different approaches. The original idea was to
270   implement a conversion from Unicode to the appropriate Windows
271   encoding for a given language. And then use the translation tables
272   to generate the fonts in whatever final encodings are needed. This
273   would allow to pile together the Unicode fonts and the non-Unicode
274   Windows fonts for that language and let the program to sort them out
275   automatically. And then generate fonts in all the possible encodings
276   for that language. An example of this approach is the Russian language
277   support. But if there is no multiplicity of encodings used for some
278   languages and if the non-Unicode fonts are not considered important
279   by the users, another way would be simpler to implement: just provide
280   only one table for extraction of the target encoding from Unicode
281   and don't bother with the translation tables. The </I>latin*<I> "languages"
282   are examples of this approach. If somebody feels that he needs the
283   Type1 fonts both in Latin-* and Windows encodings he or she is absolutely
284   welcome to submit the code to implement it.
285</I><p>
286
287   <B>WARNING:</B>
288   Some of the glyphs included into the AdobeStandard encoding are not
289   included into the Unicode standard. The most typical examples of such
290   glyphs are ligatures like 'fi', 'fl' etc. Because of this the font
291   designers may place them at various places. The converter tries to
292   do its best, if the glyphs have honest Adobe names and/or are
293   placed at the same codes as in the Microsoft fonts they will be
294   picked up. Otherwise a possible solution is to use the option '<b>-L</b>'
295   with an external map.
296<p>
297
298<!-- ==item * -->
299<TT><B>-L <I>file</I>[+[pid=<I>&lt;pid&gt;</I>,eid=<I>&lt;eid&gt;</I>,][<I>plane</I>]]</TT></B> - Extract the fonts for the specified
300   language from a multi-language font using the map from this file. This is
301   rather like the option '<b>-l</b>' but the encoding map is not
302   compiled into the program, it's taken from that file, so it's
303   easy to edit. Examples of such files are provided in
304   <tt>maps/adobe-standard-encoding.map</tt>, <tt>CP1250.map</tt>. (<b>NOTE:</b>
305   <I>the 'standard encoding' map does not include all the glyphs of the
306   AdobeStandard encoding, it's provided only as an example</I>.) The
307   description of the supported map formats is in the file
308   <tt>maps/unicode-sample.map</tt>.
309<p>
310
311   Likewise to '<b>-l</b>', an argument may be specified after the map file
312   name. But in this case the argument has fixed meaning: it selects the
313   original TTF encoding table (the syntax is the same as in '<b>-l plane</b>')
314   and/or a plane of the map file. The plane name also gets added after dash
315   to the font name. The plane is a concept used in the Eastern fonts with big
316   number of glyphs: one TTF font gets divided into multiple Type1 fonts,
317   each containing one plane of up to 256 glyphs. But with a little
318   creativity this concept may be used for other purposes of combining
319   multiple translation maps into one file.  To extract multiple planes
320   from a TTF font <tt>ttf2pt1</tt> must be run multiple times, each time with
321   a different plane name specified.
322<p>
323
324   The default original TTF encoding table used for the option '<b>-L</b>' is
325   Unicode. The map files may include directives to specify different original
326   TTF encodings. However if the pid/eid pair is specified with
327   it overrides any original encoding specified in the map file.
328<p>
329
330<!-- ==item * -->
331<TT><B>-m <i>type</i>=<i>value</i></TT></B> - Set maximal or minimal limits of resources.
332   These limits control the the font generation by limiting the resources
333   that the font is permitted to require from the PostScript interpreter.
334   The currently supported types of limits are:
335<p>
336
337<blockquote>
338   <TT><B>h</TT></B> - the maximal hint stack depth for the substituted hints.
339   The default value is 128, according to the limitation in X11. This seems to
340   be the lowest (and thus the safest) widespread value. To display the
341   hint stack depth required by each glyph in a <tt>.t1a</tt> file use the script
342   <tt>scripts/cntstems.pl</tt>.
343<p>
344</blockquote>
345
346<!-- ==item * -->
347<TT><B>-O <i>suboptions</i></TT></B> - Outline processing options. The suboptions
348   may be lowercase or uppercase, the lowercase ones disable the features,
349   the corresponding uppercase suboptions enable the same features.
350   The suboptions to disable/enable features are:
351<p>
352
353<blockquote>
354   <TT><B>b/B</TT></B> - Guessing of the ForceBold parameter. This parameter helps
355   the Type1 engine to rasterize the bold fonts properly at small sizes.
356   But the algorithm used to guess the proper value of this flag makes
357   that guess based solely on the font name. In rare cases that may cause
358   errors, in these cases you may want to disable this guessing.
359   <b>Default: enabled</b>
360<p>
361
362   <TT><B>h/H</TT></B> - Autogeneration of hints. The really complex outlines
363   may confuse the algorithm, so theoretically it may be useful
364   sometimes to disable them. Although up to now it seems that
365   even bad hints are better than no hints at all.
366   <b>Default: enabled</b>
367<p>
368
369   <TT><B>u/U</TT></B> - Hint substitution. Hint substitution is a technique
370   permitting generation of more detailed hints for the rasterizer. It allows
371   to use different sets of hints for different parts of a glyph and change
372   these sets as neccessary during rasterization (that's why "substituted"). 
373   So it should improve the quality of the fonts rendered at small sizes. 
374   But there are two catches: First, the X11 library has rather low limit for
375   the font size. More detailed hints increase the file size and thus increase
376   the chance of hitting this limit (that does not mean that you shall hit it
377   but you may if your fonts are particularly big). This is especially
378   probable for Unicode fonts converted with option '<b>-a</b>', so you may want to
379   use '<b>-a</b>' together with '<b>-Ou</b>'. See <A HREF="app/X11/README.html"><tt>app/X11/README</tt></A> for the description of
380   a patch to X11 which fixes this problem. Second, some rasterizers (again,
381   X11 is the typical example) have a limitation for total number of hints
382   used when drawing a glyph (also known as the hint stack depth). If that
383   stack overflows the glyph is ignored. Starting from version 3.22 <tt>ttf2pt1</tt>
384   uses algorithms to minimizing this depth, with the trade-off of slightly
385   bigger font files. The glyphs which still exceed the limit set by option
386   '<b>-mh</b>' have all the substituted hints removed and only base hints left.
387   The algorithms seem to have been refined far enough to make the fonts with
388   substituted hints look better than the fonts without them or at least the
389   same. Still if the original fonts are not well-designed the detailed
390   hinting may emphasize the defects of the design, such as non-even thickness
391   of lines. So provided that you are not afraid of the X11 bug the best idea
392   would be to generate a font with this feature and without it, then compare
393   the results using the program <tt>other/cmpf</tt> (see the description
394   in <A HREF="other/README.html"><tt>other/README</tt></A>) and decide which one looks better.
395   <b>Default: enabled</b>
396<p>
397
398   <TT><B>o/O</TT></B> - Space optimization of the outlines' code. This kind of optimization
399   never hurts, and the only reason to disable this feature is for comparison
400   of the generated fonts with the fonts generated by the previous versions of
401   converter. Well, it _almost_ never hurts. As it turned out there exist
402   some brain-damaged printers which don't understand it. Actually this
403   feature does not change the outlines at all. The Type 1 font manual
404   provides a set of redundant operators that make font description shorter,
405   such as '10 hlineto' instead of '0 10 rlineto' to describe a horizontal
406   line. This feature enables use of these operators.
407   <b>Default: enabled</b>
408<p>
409
410   <TT><B>s/S</TT></B> - Smoothing of outlines. If the font is broken in some
411   way (even the ones that are not easily noticeable), such smoothing
412   may break it further. So disabling this feature is the first thing to be
413   tried if some font looks odd. But with smoothing off the hint generation
414   algorithms may not work properly too.
415   <b>Default: enabled</b>
416<p>
417
418   <TT><B>t/T</TT></B> - Auto-scaling to the 1000x1000 Type1 standard matrix. The
419   TTF fonts are described in terms of an arbitrary matrix up to
420   4000x4000. The converted fonts must be scaled to conform to
421   the Type1 standard. But the scaling introduces additional rounding
422   errors, so it may be curious sometimes to look at the font in its
423   original scale.
424   <b>Default: enabled</b>
425<p>
426
427   <TT><B>v/V</TT></B> - Do vectorization on the bitmap fonts. Functionally
428   "vectorization" is the same thing as "autotracing", a different word is
429   used purely to differentiate it from the Autotrace library. It tries to
430   produce nice smooth outlines from bitmaps. This feature is still a work
431   in progress though the results are already mostly decent.
432   <b>Default: disabled</b>
433<p>
434
435   <TT><B>w/W</TT></B> - Glyphs' width corection. This option is designed to be
436   used on broken fonts which specify too narrow widths for the
437   letters. You can tell that a font can benefit from this option
438   if you see that the characters are smashed together without
439   any whitespace between them. This option causes the converter
440   to set the character widths to the actual width of this character
441   plus the width of a typical vertical stem. But on the other hand
442   the well-designed fonts may have characters that look better if
443   their widths are set slightly narrower. Such well-designed fonts
444   will benefit from disabling this feature. You may want to convert
445   a font with and without this feature, compare the results and
446   select the better one. This feature may be used only on proportional
447   fonts, it has no effect on the fixed-width fonts.
448   <b>Default: disabled</b>
449<p>
450
451   <TT><B>z/Z</TT></B> - Use the Autotrace library on the bitmap fonts. The results
452   are horrible and <b>the use of this option is not recommended</b>. This option is
453   present for experimental purposes. It may change or be removed in the
454   future. The working tracing can be achieved with option <tt><b>-OV</b></tt>.
455   <b>Default: disabled</b>
456<p>
457</blockquote>
458
459<!-- ==item * -->
460<TT><B>-p <I>parser_name</I></TT></B> - Use the specified front-end parser to read the font file.
461   If this option is not used, ttf2pt1 selects the parser automatically based
462   on the suffix of the font file name, it uses the first parser in its
463   list that supports this font type. Now two parsers are supported:
464<p>
465
466   &nbsp;&nbsp;<TT>ttf</TT> - built-in parser for the ttf files (suffix <tt>.ttf</tt>)
467<br>
468   &nbsp;&nbsp;<TT>bdf</TT> - built-in parser for the BDF files (suffix <tt>.bdf</tt>)
469<br>
470   &nbsp;&nbsp;<TT>ft</TT> - parser based on the FreeType-2 library (suffixes <tt>.ttf</tt>,
471       <tt>.otf</tt>, <tt>.pfa</tt>, <tt>.pfb</tt>)
472<p>
473
474   The parser <tt>ft</tt> is <b>NOT</b> linked in by default. See <tt>Makefile</tt>
475   for instructions how to enable it. We do no support this parser on
476   Windows: probably it will work but nobody tried and nobody knows how
477   to build it.
478<p>
479
480   The conversion of the bitmap fonts (such as BDF) is simplistic yet,
481   producing jagged outlines.  When converting such fonts, it might be
482   a good idea to turn off the hint substitution (using option <b>-Ou</b>)
483   because the hints produced will be huge but not adding much to the
484   quality of the fonts.
485<p>
486
487<!-- ==item * -->
488<TT><B>-u <I>number</I></TT></B> - Mark the font with this value as its
489   UniqueID. The UniqueID is used by the printers with the hard disks
490   to cache the rasterized characters and thus significantly
491   speed-up the printing. Some of those printers just can't
492   store the fonts without UniqueID on their disk.The problem
493   is that the ID is supposed to be unique, as it name says. And
494   there is no easy way to create a guaranteed unique ID. Adobe specifies
495   the range 4000000-4999999 for private IDs but still it's difficult
496   to guarantee the uniqueness within it. So if you don't really need the
497   UniqueID don't use it, it's optional. Luckily there are a few millions of
498   possible IDs, so the chances of collision are rather low.
499   If instead of the number a special value '<tt><b>A</b></tt>' is given
500   then the converter generates the value of UniqueID automatically,
501   as a hash of the font name. (<b>NOTE:</b> <i> in the version 3.22 the
502   algorithm for autogeneration of UniqueID was changed to fit the values
503   into the Adobe-spacified range. This means that if UniqueIDs were used
504   then the printer's cache may need to be flushed before replacing the
505   fonts converted by an old version with fonts converted by a newer version</i>).
506   A simple way to find if any of the fonts in a given directory have
507   duplicated UniqueIDs is to use the command:
508<p>
509
510   <tt>&nbsp;&nbsp;cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 '</tt>
511<p>
512
513   Or if you use <tt>scripts/convert</tt> it will do that for you automatically
514   plus it will also give the exact list of files with duplicate UIDs.
515<p>
516
517<!-- ==item * -->
518<TT><B>-v <I>size</I></TT></B> - Re-scale the font to get the size of a typical uppercase
519   letter somewhere around the specified size. Actually, it re-scales
520   the whole font to get the size of one language-dependent letter to be
521   at least of the specified size. Now this letter is "A" in all the
522   supported languages. The size is specified in the points of the
523   Type 1 coordinate grids, the maximal value is 1000. This is an
524   experimental option and should be used with caution. It tries to
525   increase the visible font size for a given point size and thus make
526   the font more readable. But if overused it may cause the fonts to
527   look out of scale. As of now the interesting values of size for
528   this option seem to be located mostly between 600 and 850. This
529   re-scaling may be quite useful but needs more experience to
530   understand the balance of its effects.
531<p>
532
533<!-- ==item * -->
534<TT><B>-W <i>level</i></TT></B> - Select the verbosity level of the warnings.
535   Currently the levels from 0 to 4 are supported. Level 0 means no warnings
536   at all, level 4 means all the possible warnings. The default level is 3.
537   Other levels may be added in the future, so using the level number 99 is
538   recommended to get all the possible warnings. Going below level 2 is
539   not generally recommended because you may miss valuable information about
540   the problems with the fonts being converted.
541<p>
542
543<!-- ==item * -->
544<B>Obsolete option:</B>
545<TT><B>-A</TT></B> - Print the font metrics (.afm file) instead of the font on STDOUT.
546   Use <b>-GA</b> instead.
547<p>
548
549<!-- ==item * -->
550<B>Very obsolete option:</B>
551<br>
552   The algorithm that implemented the forced fixed width had major
553   flaws, so it was disabled. The code is still in the program and
554   some day it will be refined and returned back. Meanwhile the
555   option name '<b>-f</b>' was reused for another option. The old version was:
556<br>
557<TT><B>-f</TT></B> - Don't try to force the fixed width of font. Normally the converter
558   considers the fonts in which the glyph width deviates by not more
559   than 5% as buggy fixed width fonts and forces them to have really
560   fixed width. If this is undesirable, it can be disabled by this option.
561<p>
562<!-- ==back -->
563
564The <tt>.pfa</tt> font format supposes that the description of the characters
565is binary encoded and encrypted. This converter does not encode or
566encrypt the data by default, you have to specify the option '<b>-e</b>'
567or use the <tt>t1asm</tt> program to assemble (that means, encode and
568encrypt) the font program. The <tt>t1asm</tt> program that is included with
569the converter is actually a part of the <tt>t1utils</tt> package, rather old
570version of which may be obtained from
571<p>
572
573<blockquote>
574<A HREF="http://ttf2pt1.sourceforge.net/t1utils.tar.gz">
575        http://ttf2pt1.sourceforge.net/t1utils.tar.gz
576</A>
577</blockquote>
578<p>
579
580Note that <tt>t1asm</tt> from the old version of that package won't work properly
581with the files generated by <tt>ttf2pt1</tt> version 3.20 and later. Please use
582<tt>t1asm</tt> packaged with <tt>ttf2pt1</tt> or from the new version <tt>t1utils</tt>
583instead. For a newer version of <tt>t1utils</tt> please look at
584<p>
585
586<blockquote>
587<A HREF="http://www.lcdf.org/~eddietwo/type/">
588        http://www.lcdf.org/~eddietwo/type/
589</A>
590</blockquote>
591<p>
592<!-- =stop -->
593
594<!-- =section t1 EXAMPLES -->
595So, the following command lines:
596<p>
597
598<blockquote>
599        <tt>ttf2pt1 -e ttffont.ttf t1font</tt>
600<br>
601        <tt>ttf2pt1 ttffont.ttf - | t1asm &gt;t1font.pfa</tt>
602</blockquote>
603<p>
604
605represent two ways to get a working font. The benefit of the second form
606is that other filters may be applied to the font between the converter
607and assembler.
608<p>
609<!-- =stop -->
610
611<H4>
612Installation and deinstallation of the converter
613</H4>
614<!
615------------------------------------------------
616>
617
618The converter may be easily installed systemwide with
619
620<blockquote>
621        <tt>make install</tt>
622</blockquote>
623
624and uninstalled with
625
626<blockquote>
627        <tt>make uninstall</tt>
628</blockquote>
629
630By default the <tt>Makefile</tt> is configured to install in the hierarchy
631of directory <tt>/usr/local</tt>. This destination directory as well as
632the structure of the hierarchy may be changed by editing the <tt>Makefile</tt>.
633
634<H4>
635Installation of the fonts
636</H4>
637<!
638-------------------------
639>
640
641Running the converter manually becomes somewhat boring if it has to
642be applied to a few hundreds of fonts and then you have to generate the
643<tt>fonts.scale</tt> and/or <tt>Fontmap</tt> files. The <A HREF="FONTS.html"><tt>FONTS</tt></A> file describes how to use
644the supplied scripts to handle such cases easily. It also discusses
645the installation of the fonts for a few widespread programs.
646<p>
647
648<H4>
649Other utilities
650</H4>
651<!
652---------------
653>
654
655A few other small interesting programs that allow a cloase look at
656the fonts are located in the subdirectory '<tt>other</tt>'. They
657are described shortly in <A HREF="other/README.html">others/README</a>.
658<p>
659
660<H4>
661Optional packages
662</H4>
663<!
664-----------------
665>
666
667Some auxiliary files are not needed by everyone and are big enough that
668moving them to a separate package speeds up the downloads of the main
669package significantly. As of now we have one such optional package:
670<p>
671
672&nbsp;&nbsp;<b>ttf2pt1-chinese</b> - contains the Chinese conversion maps
673<p>
674
675The general versioning policy for the optional packages is the following:
676These packages may have no direct dependency on the ttf2pt1 version.
677But they may be updated in future, as well as some versions of optional
678packages may have dependencies on certain versions of ttf2pt1.
679To avoid unneccessary extra releases on one hand and keep the updates in
680sync with the ttf2pt1 itself on the other hand, a new version of an optional
681package will be released only if there are any changes to it and it will be
682given the same version number as ttf2pt1 released at the same time. So not
683every release of ttf2pt1 would have a corresponding release of all optional
684packages. For example, to get the correct version of optional packages for an
685imaginary release 8.3.4 of ttf2pt1 you would need to look for optional
686packages of the highest version not higher than (but possibly equal to) 8.3.4.
687<p>
688
689<H4>
690TO DO:
691</H4>
692<!
693------
694>
695
696<ul>
697<li> Improve hinting.
698<li> Improve the auto-tracing of bitmaps.
699<li> Implement the family-level hints.
700<li> Add generation of CID-fonts.
701<li> Handle the composite glyphs with relative base points.
702<li> Preserve the relative width of stems during scaling to 1000x1000 matrix.
703<li> Add support for bitmap TTF fonts.
704<li> Implement better support of Asian encodings.
705<li> Implement automatic creation of ligatures.
706</ul>
707
708<H4>
709TROUBLESHOOTING AND BUG REPORTS
710</H4>
711<!
712-------------------------------
713>
714<!-- =section t1 BUGS -->
715<!-- ==head2 Troubleshooting and bug reports -->
716
717Have problems with conversion of some font ? The converter dumps core ? Or your
718printer refuses to understand the converted fonts ? Or some characters are
719missing ? Or some characters look strange ?
720<p>
721
722Send the bug reports to the ttf2pt1 development mailing list at
723<A HREF="mailto:ttf2pt1-devel@lists.sourceforge.net">ttf2pt1-devel@lists.sourceforge.net</A>.
724<p>
725
726Try to collect more information about the problem and include it into
727the bug report. (Of course, even better if you would provide a ready
728fix, but just a detailed bug report is also good). Provide detailed
729information about your problem, this will speed up the response greatly.
730Don't just write "this font looks strange after conversion" but describe
731what's exactly wrong with it: for example, what characters look wrong
732and what exactly is wrong about their look. Providing a link to the
733original font file would be also a good idea. Try to do a little
734troublehooting and report its result. This not only would help with
735the fix but may also give you a temporary work-around for the bug.
736<p>
737
738First, enable full warnings with option '<b>-W99</b>', save them to
739a file and read carefully. Sometimes the prolem is with a not implemented
740feature which is reported in the warnings. Still, reporting about such
741problems may be a good idea: some features were missed to cut corners,
742in hope that no real font is using them. So a report about a font using
743such a feature may motivate someone to implement it. Of course, you
744may be the most motivated person: after all, you are the one wishing
745to convert that font. ;-) Seriously, the philosophy "scrath your own itch"
746seems to be the strongest moving force behind the Open Source software.
747<p>
748
749The next step is playing with the options. This serves a dual purpose:
750on one hand, it helps to localize the bug, on the other hand you may be
751able to get a working version of the font for the meantime while the
752bug is being fixed. The typical options to try out are: first '<b>-Ou</b>', if
753it does not help then '<b>-Os</b>', then '<b>-Oh</b>', then '<b>-Oo</b>'.
754They are described in a bit more detail above. Try them one by one
755and in combinations. See if with them the resulting fonts look better.
756<p>
757
758On some fonts ttf2pt1 just crashes. Commonly that happens because the
759font being converted is highly defective (although sometimes the bug
760is in ttf2pt1 itself). In any case it should not crash, so the reports
761about such cases will help to handle these defects properly in future.
762<p>
763
764We try to respond to the bug reports in a timely fashion but alas, this
765may not always be possible, especially if the problem is complex.
766This is a volunteer project and its resources are limited. Because
767of this we would appreciate bug reports as detailed as possible,
768and we would appreciate the ready fixes and contributions even more.
769<p>
770<!-- =stop -->
771<!-- =section t1 FILES -->
772<!-- ==over 2 -->
773<!-- ==item * -->
774<!-- =text TTF2PT1_LIBXDIR/t1asm -->
775<!-- ==item * -->
776<!-- =text TTF2PT1_SHAREDIR/* -->
777<!-- ==item * -->
778<!-- =text TTF2PT1_SHAREDIR/scripts/* -->
779<!-- ==item * -->
780<!-- =text TTF2PT1_SHAREDIR/other/* -->
781<!-- ==item * -->
782<!-- =text TTF2PT1_SHAREDIR/README -->
783<!-- ==item * -->
784<!-- =text TTF2PT1_SHAREDIR/FONTS -->
785<!-- ==back -->
786<!-- =stop -->
787
788<H4>
789CONTACTS
790</H4>
791<!
792--------
793>
794<!-- =section t1 SEE ALSO -->
795<!-- ==over 4 -->
796<!-- ==item * -->
797<!-- =text L&lt;ttf2pt1_convert(1)&gt; -->
798<!-- ==item * -->
799<!-- =text L&lt;ttf2pt1_x2gs(1)&gt; -->
800<!-- ==item * -->
801<!-- =text L&lt;t1asm(1)&gt; -->
802
803<!-- ==item * -->
804<A HREF="http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-announce">
805ttf2pt1-announce@lists.sourceforge.net
806</A><br>
807  The mailing list with announcements about ttf2pt1. It is a moderated mailing
808  with extremely low traffic. Everyone is encouraged to subscribe to keep in
809  touch with the current status of project. To subscribe use the Web interface
810  at <A HREF="http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-announce">http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-announce</A>.
811  If you have only e-mail access to the Net then send a subscribe request to
812  the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody
813  will help you with subscription.
814<p>
815
816<!-- ==item * -->
817<A HREF="mailto:ttf2pt1-devel@lists.sourceforge.net">
818ttf2pt1-devel@lists.sourceforge.net
819</A><br>
820<A HREF="mailto:ttf2pt1-users@lists.sourceforge.net">
821ttf2pt1-users@lists.sourceforge.net
822</A><br>
823  The ttf2pt1 mailing lists for development and users issues. They have not
824  that much traffic either. To subscribe use the Web interface at
825  <A HREF="http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-devel">http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-devel</A>
826  and <A HREF="http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-users">http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-users</A>.
827  If you have only e-mail access to the Net then send a subscribe request to
828  the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody
829  will help you with subscription.
830<p>
831
832<!-- =stop -->
833<A HREF="mailto:mheath@netspace.net.au">
834mheath@netspace.net.au
835</A><br>
836  Mark Heath
837<p>
838
839<A HREF="mailto:A.Weeks@mcc.ac.uk">
840A.Weeks@mcc.ac.uk
841</A><br>
842  Andrew Weeks
843<p>
844
845<A HREF="mailto:babkin@users.sourceforge.net">
846babkin@users.sourceforge.net</A> (preferred)<br>
847<A HREF="mailto:sab123@hotmail.com">
848sab123@hotmail.com
849</A><br>
850<A HREF="http://members.bellatlantic.net/~babkin">
851http://members.bellatlantic.net/~babkin
852</A><br>
853  Sergey Babkin
854<p>
855
856<H4>
857SEE ALSO
858</H4>
859<!
860--------
861>
862
863<!-- =section t1 SEE ALSO -->
864<!-- ==item * -->
865<A HREF="http://ttf2pt1.sourceforge.net">
866http://ttf2pt1.sourceforge.net
867</A><br>
868  The main page of the project.
869<p>
870
871<A HREF="http://www.netspace.net.au/~mheath/ttf2pt1/">
872http://www.netspace.net.au/~mheath/ttf2pt1/
873</A><br>
874  The old main page of the project.
875<p>
876<!-- ==back -->
877<!-- =stop -->
878
879<A HREF="http://sourceforge.net/projects/gnuwin32">
880http://sourceforge.net/projects/gnuwin32
881</A><br>
882  Precompiled binaries for Windows.
883<p>
884
885<A HREF="http://www.lcdf.org/~eddietwo/type/">
886http://www.lcdf.org/~eddietwo/type/
887</a><br>
888  The home page of the Type 1 utilities package.
889<p>
890
891<A HREF="http://www.rightbrain.com/pages/books.html">
892http://www.rightbrain.com/pages/books.html
893</a><br>
894  The first book about PostScript on the Web, "Thinking in PostScript".
895<p>
896
897<A HREF="http://fonts.apple.com/TTRefMan/index.html">
898http://fonts.apple.com/TTRefMan/index.html
899</a><br>
900  The True Type reference manual.
901<p>
902
903<A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
904http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf
905</a><br>
906  Adobe PostScript reference manual.
907<p>
908
909<A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/T1_SPEC.PDF">
910http://partners.adobe.com/asn/developer/PDFS/TN/T1_SPEC.PDF
911</a><br>
912  Specification of the Type 1 font format.
913<p>
914
915<A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/5015.Type1_Supp.pdf">
916http://partners.adobe.com/asn/developer/PDFS/TN/5015.Type1_Supp.pdf
917</a><br>
918  The Type 1 font format supplement.
919<p>
920
921<A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/5004.AFM_Spec.pdf">
922http://partners.adobe.com/asn/developer/PDFS/TN/5004.AFM_Spec.pdf
923</A><BR>
924  Specification of the Adobe font metrics file format.
925<p>
926
927<A HREF="http://www.cs.wpi.edu/~matt/courses/cs563/talks/surface/bez_surf.html">
928http://www.cs.wpi.edu/~matt/courses/cs563/talks/surface/bez_surf.html
929</A><BR>
930<A HREF="http://www.cs.wpi.edu/~matt/courses/cs563/talks/curves.html">
931http://www.cs.wpi.edu/~matt/courses/cs563/talks/curves.html
932</A><BR>
933  Information about the Bezier curves.
934<p>
935
936<A HREF="http://www.neuroinformatik.ruhr-uni-bochum.de/ini/PEOPLE/rmz/t1lib/t1lib.html">
937http://www.neuroinformatik.ruhr-uni-bochum.de/ini/PEOPLE/rmz/t1lib/t1lib.html
938</A><br>
939  A stand-alone library supporting the Type1 fonts. Is neccessary
940  to compile the programs <tt>other/cmpf</tt> and <tt>other/dmpf</tt>.
941<p>
942
943<A HREF="http://www.freetype.org">
944http://www.freetype.org
945</A><br>
946  A library supporting the TTF fonts. Also many useful TTF programs
947  are included with it.
948<p>
949
950<A HREF="http://heliotrope.homestead.com/files/printsoft.html">
951http://heliotrope.homestead.com/files/printsoft.html
952</A><br>
953  Moses Gold's collection of links to printing software.
954<p>
955
956<A HREF="http://linuxartist.org/fonts/">
957http://linuxartist.org/fonts/
958</A><br>
959  Collection of font-related links.
960<p>
961
962<HR>
963<HR>
964<!
965----------------------------------------------------------------------
966----------------------------------------------------------------------
967>
968
969Following is the Readme of <tt>ttf2pfa</tt> (true type to type 3 font converter) It
970covers other issues regarding the use of this software. Please note that
971although <tt>ttf2pfa</tt> is a public domain software, <tt>ttf2pt1</tt>
972is instead covered by an Open Source license. See the <tt>COPYRIGHT</tt>
973file for details.
974<p>
975
976Please note also that <tt>ttf2pfa</tt> has not been maintained for a long time.
977All of its functionality has been integrated into <tt>ttf2pt1</tt> and all the
978development moved to <tt>ttf2pt1</tt>, including Andrew Weeks, the author of
979<tt>ttf2pfa</tt>. <tt>Ttf2pfa</tt> is provided for historical reasons only. Please use
980<tt>ttf2pt1</tt> instead.
981
982<HR>
983<!
984----------------------------------------------------------------------
985>
986
987<H3>
988True Type to Postscript Font converter
989</H3>
990<!
991--------------------------------------
992>
993
994My mind is still reeling from the discovery that I was able to write
995this program. What it does is it reads a Microsoft TrueType font and
996creates a Postscript font. '<I>_A_</I> postscript font', that is, not necessarily
997the same font, you understand, but a fair imitation.
998<p>
999
1000Run it like this:
1001<p>
1002
1003<blockquote><tt>
1004        ttf2pfa fontfile.ttf fontname
1005</tt></blockquote>
1006<p>
1007
1008The first parameter is the truetype filename, the second is a stem for
1009the output file names. The program will create a <tt>fontname.pfa</tt> containing
1010the Postscript font and a <tt>fontname.afm</tt> containing the metrics.
1011<p>
1012
1013The motivation behind this is that in Linux if you do not have a
1014Postscript printer, but only some other printer, you can only print
1015Postscript by using Ghostscript. But the fonts that come with
1016Ghostscript are very poor (they are converted from bitmaps and look
1017rather lumpy). This is rather frustrating as the PC running Linux
1018probably has MS-Windows as well and will therefore have truetype fonts,
1019but which are quite useless with Linux, X or Ghostscript.
1020<p>
1021
1022The program has been tested on over a hundred different TrueType fonts
1023from various sources, and seems to work fairly well. The converted
1024characters look OK, and the program doesn't seem to crash any more. I'm
1025not sure about the AFM files though, as I have no means to test them.
1026<p>
1027
1028The fonts generated will not work with X, as the font rasterizer that
1029comes with X only copes with Type 1 fonts. If I have the time I may
1030modify ttf2pfa to generate Type 1s.
1031<p>
1032
1033<H4>
1034Copyright issues
1035</H4>
1036<!
1037----------------
1038>
1039
1040I am putting this program into the public domain, so don't bother
1041sending me any money, I'd only have to declare it for income tax.
1042<p>
1043
1044Copyright on fonts, however, is a difficult legal question. Any
1045copyright statements found in a font will be preserved in the output.
1046Whether you are entitled to translate them at all I don't know.
1047<p>
1048
1049If you have a license to run a software package, like say MS-Windows, on
1050your PC, then you probably have a right to use any part of it, including
1051fonts, on that PC, even if not using that package for its intended
1052purpose.
1053<p>
1054
1055I am not a lawyer, however, so this is not a legal opinion, and may be
1056garbage.
1057<p>
1058
1059There shouldn't be a any problem with public domain fonts.
1060<p>
1061
1062<H4>
1063About the Program
1064</H4>
1065<!
1066-----------------
1067>
1068
1069It was written in C on a IBM PC running Linux.
1070<p>
1071
1072The TrueType format was originally developed by Apple for the MAC, which
1073has opposite endianness to the PC, so to ensure compatibility 16 and 32
1074bit fields are the wrong way round from the PC's point of view. This is
1075the reason for all the 'ntohs' and 'ntohl' calls. Doing it this way
1076means the program will also work on big-endian machines like Suns.
1077<p>
1078
1079I doubt whether it will work on a DOS-based PC though.
1080<p>
1081
1082The program produces what technically are Type 3 rather than Type 1
1083fonts. They are not compressed or encrypted and are plain text. This is
1084so I (and you) can see what's going on, and (if you're a Postscript guru
1085and really want to) can alter the outlines.
1086<p>
1087
1088I only translate the outlines, not the 'instructions' that come with
1089them. This latter task is probably virtually impossible anyway. TrueType
1090outlines are B-splines rather than the Bezier curves that Postscript
1091uses. I believe that my conversion algorithm is reasonably correct, if
1092nothing else because the characters look right.
1093<p>
1094
1095<H4>
1096Problems that may occur
1097</H4>
1098<!
1099-----------------------
1100>
1101
1102Most seriously, very complex characters (with lots of outline segments)
1103can make Ghostscript releases 2.x.x fail with a 'limitcheck' error. It
1104is possible that this may happen with some older Postscript printers as
1105well. Such characters will be flagged by the program and there are
1106basically two things you can do. First is to edit the <tt>.pfa</tt> file to
1107simplify or remove the offending character. This is not really
1108recommended. The second is to use Ghostscript release 3, if you can get
1109it. This has much larger limits and does not seem to have any problems
1110with complex characters.
1111<p>
1112
1113Then there are buggy fonts (yes, a font can have bugs). I try to deal
1114with these in as sane a manner as possible, but it's not always
1115possible.
1116<p>
1117
1118<H4>
1119Encodings
1120</H4>
1121<!
1122---------
1123>
1124
1125A postscript font must have a 256 element array, called an encoding,
1126each element of which is a name, which is also the name of a procedure
1127contained within the font. The 'BuildChar' command takes a byte and uses
1128it to index the encoding array to find a character name, and then looks
1129that up in the font's procedure table find the commands to draw the
1130glyph. However, not all characters need be in the encoding array. Those
1131that are not cannot be drawn (at least not using 'show'), however it is
1132possible to 're-encode' the font to enable these characters. There are
1133several standard encodings: Adobe's original, ISO-Latin1 and Symbol
1134being the most commonly encountered.
1135<p>
1136
1137TrueType fonts are organised differently. As well as the glyph
1138descriptions there are a number of tables. One of these is a mapping
1139from a character set into the glyph array, and another is a mapping from
1140the glyph array into a set of Postscript character names. The problems
1141are:
1142<p>
1143        1)      Microsoft uses Unicode, a 16-bit system, to encode the font.
1144<br>
1145        2)      that more than one glyph is given the same Postscript name.
1146<p>
1147
1148I deal with (1) by assuming a Latin1 encoding. The MS-Windows and
1149Unicode character sets are both supersets of ISO-8859-1. This usually
1150means that most characters will be properly encoded, but you should be
1151warned that some software may assume that fonts have an Adobe encoding.
1152Symbol, or Dingbat, fonts are in fact less of a problem, as they have
1153private encodings starting at 0xF000. It is easy to just lose the top
1154byte.
1155<p>
1156
1157Postscript fonts can be re-encoded, either manually, or by software.
1158Groff, for example, generates postscript that re-encodes fonts with the
1159Adobe encoding. The problem here is that not all characters in the Adobe
1160set are in the MS-Windows set. In particular there are no fi and fl
1161ligatures. This means that conversions of the versions of
1162Times-New-Roman and Arial that come with MS-Windows cannot be used
1163blindly as replacements for Adobe Times-Roman and Helvetica. You can get
1164expanded versions of MS fonts from Microsoft's web site which do contain
1165these ligatures (and a lot else besides).
1166<p>
1167
1168I deal with (2) by creating new character names. This can be error-prone
1169because I do not know which of them is the correct glyph to give the
1170name to. Some (buggy) fonts have large numbers of blank glyphs, all with
1171the same name.
1172<p>
1173
1174(almost every TrueType font has three glyphs called <tt>.notdef</tt>, one of them
1175is usually an empty square shape, one has no outline and has zero width,
1176and one has no outline and a positive width. This example is not really
1177a problem with well formed fonts since the <tt>.notdef</tt> characters are only
1178used for unprintable characters, which shouldn't occur in your documents
1179anyway).
1180<p>
1181</BODY>
1182</HTML>
Note: See TracBrowser for help on using the repository browser.