Debian Codegraph @

doc/sphinx/ui/dialogs/generate.rst

raw
1 Generate Font Dialog
2 ====================
3
4 .. image:: /images/generate.png
5 :align: right
6
7 This generates font files, both outline and bitmap. You may choose not to
8 generate either, you may generate an afm file or a pfm file, you may select the
9 type of postscript output, you may select which pixelsizes of bitmap to
10 generate.
11
12 The outline types are:
13
14 * PostScript Type1 font, binary format (a .pfb file, this may be used by most
15 modern windowing systems)
16 * PostScript Type1 font, ascii format (a .pfa file, this is used by printers)
17 * PostScript Type1 font, macbinary format (a postscript font wrapped up in a set
18 of mac resources wrapped up in a macbinary file, to be copied to a mac,
19 unmacbinaried, and installed there)
20
21 If you are on a mac then a resource fork will be generated directly, macbinary
22 will not be used.
23
24 .. note::
25
26 The mac will not recognize a PostScript font unless you also generate a
27 bitmap font in NFNT format and place it in the same directory. If you haven't
28 created any bitmap fonts yet, cancel this dlg and use
29 :ref:`Element->Bitmaps Available <elementmenu.Bitmaps>` to generate a bitmap
30 font, and then retry this dlg.
31
32 .. warning::
33
34 Apple implies that this format is deprecated and therefore it may not work in
35 future versions.
36
37 * Multiple Master(A), generates a multiple master font in ascii format (same as
38 .pfa)
39 * Multiple Master(B), generates a multiple master font in binary format (same as
40 .pfb)
41 * Multiple PostScript Type 1 binary fonts (this is used to convert a large font
42 with a two byte encoding into a series of smaller pfb (or pfa) files with 256
43 glyphs in each. You may be prompted for a file to specify the conversion. See
44 the ttf2tfm man page for a description of these SUBFONT DEFINITION FILES.
45 `Here is an example of what the file should look like <https://fontforge.org/downloads/Big5.txt>`__)
46 * PostScript Type3 font (a .pt3 font, this is also used by printers and is not
47 encrypted)
48 * PostScript Type0 font, this is only available if you have a font encoded with
49 Unicode or one of the CJK encodings. Type0 fonts can have up to 65536 glyphs in
50 them (as opposed to 256 for Type1s and Type3s).
51 * PostScript Type42 font (this is really a TrueType font wrapped up in PostScript)
52 * PostScript Type11 font (this is another format for wrapping a TrueType font in
53 PostScript, it is a CID format)
54 * PostScript CID font, this is only available if your font is a
55 :doc:`CID font </ui/menus/cidmenu>`. This produces a font in the old Type1 CID format. You
56 probably want to use the OpenType CID format...
57 * PostScript CFF font, this is the format that lives inside the 'CFF ' table of an
58 opentype font. It is a valid font format in its own right.
59 * True Type.
60 * True Type Symbol. Same as True Type, except it uses the 1 byte encoding given in
61 the font. This is important on windows as symbol and dingbat encodings often
62 include characters (in the range 0x80-0x9f) which aren't mapped in normal
63 encodings. It is important on the Mac because I do not generate the correct
64 encoding tables for any script other than MacRoman, so if you want a MacCyrillic
65 font use this mode.
66 * True Type macbinary format, a truetype font wrapped up in a mac resource,
67 wrapped up in a macbinary file. Designed to be used for a mac.
68
69 If you are on a mac, then a file with a resource fork will be generated directly
70 (macbinary will not be used).
71 * True Type dfont format, a truetype font wrapped up in a mac dfont (data fork
72 resource file). Mac OS/X font.
73 * OpenType (CFF). Officially OpenType includes True Type, but OpenType True Type
74 fonts are no different from plain True Type fonts, so they might as well just be
75 called True Type. So here when I say OpenType I mean OpenType with a CFF
76 PostScript Type 2 font inside it.
77 * OpenType dfont format, an OpenType font wrapped up in a mac dfont (data fork
78 resource file). Mac OS/X font.
79 * OpenType CID, This is only available if your font is a
80 :doc:`CID font </ui/menus/cidmenu>`. It produces an OpenType CID-keyed font.
81 * :ref:`SVG font <generate.svg>`
82 * None
83
84 The bitmap types are:
85
86 * BDF -- The internal bitmap fonts will be saved in bdf format. You may only
87 select sizes for which you have already generated fonts (you may output
88 anti-aliased (greymap) fonts as well as bitmaps. A 12pixel high greymap font
89 with 8 bits/pixel can be represented as 12@8).
90 * In TTF/OTF -- Store the bitmap fonts inside the ttf (or otf) file (the exact
91 format will depend on the settings of the Apple and OpenType bits in the Options
92 dlg).
93 * Apple bitmap only sfnt (dfont) -- Only available if no outline font is
94 generated.
95 :ref:`Apple allows bitmaps to be stored within a truetype file (sfnt) <bitmaponlysfnt.Apple>`
96 even if there is no outline font. So this generates a ttf file that just
97 contains bitmaps and wraps it up in a dfont.
98 * (faked) MS bitmap only sfnt (ttf) --
99 :ref:`Microsoft does not support a bitmap only format for an sfnt <bitmaponlysfnt.MS>`,
100 but this option attempts to fake one as best it can.
101 * X11 bitmap only sfnt (otb) -- this is the new
102 :ref:`X11 bitmap format with bitmaps embedded in an sfnt wrapper <bitmaponlysfnt.X11>`
103 (an opentype or truetype font) but with no outline data.
104 * NFNT (MacBin) -- Converts the bitmap fonts into Macintosh NFNT resources and
105 wraps them up in a mac binary file.
106
107 NFNT (Resource) -- On a mac the NFNT font will be generated in a resource fork
108 directly.
109
110 .. note::
111
112 Mac OS/X appears not to support NFNT bitmaps (at least I can't get them to
113 work). *However*, the mac still needs at least one NFNT in order to find an
114 type1 font. Even though the bitmap is required, it will not be used. Odd.
115 * Windows FON -- Windows resource based font format.
116 * Windows FNT -- Windows format, one bitmap font per file.
117 * Palm fonts -- support for :doc:`various palm bitmap font formats. </techref/palmfonts>`
118 * PS Type3 Bitmap -- create a PostScript Type3 font which uses the imagemask
119 operator to display each glyph's bitmap.
120 * None
121
122 .. _generate.Options:
123
124 .. image:: /images/GenerateOptions.png
125 :align: right
126
127 The options dialog provides the following check boxes. Not all are enabled at
128 all times.
129
130 * [] Round -- Round all coordinates to integral values. If this is not checked
131 then Type1 fonts will be output with 2 decimal digits of precision, and Type2
132 fonts with 16 binary digits (~4 decimal digits) when needed.
133 * [] Hints -- Include PostScript hints in the output file
134 * [] Flex Hints -- Include PostScript flex hints in the output file
135 * [] AFM -- Generate an adobe font metrics file (controls generation of .amfm
136 files for multiple master fonts too)
137
138 .. note::
139 Normally only 'liga' and 'rlig' ligatures will be output in the AFM file.
140 But you can control that in the lookup dialog off of
141 :doc:`Font Info </ui/dialogs/fontinfo>`.
142 * [] Composites in AFM -- the AFM format includes a mechanism for building
143 composite glyphs out of components. It is roughly equivalent to the OpenType
144 mark-to-base feature. Almost nobody uses these data, and they can increase the
145 size of an AFM file enormously, but if you would like them check this box (if
146 your font does not include any anchor classes, this will have no effect).
147 * [] PFM -- Generate a windows printer font metrics file
148
149 .. _generate.TFM:
150
151 * [] TFM -- Generate a TeX font metrics file (and a TeX enc encoding file)
152
153 --------------------------------------------------------------------------------
154
155 * [] Hints -- Include truetype hints in a truetype font.
156
157 * R C van Dalen's
158 `truetype hinting utilities may be helpful here. <http://home.kabelfoon.nl/~slam/fonts/>`__
159 * [] PSNames -- Include the full 'post' (postscript name) table in the font
160
161 .. _generate.AppleMode:
162
163 * [] Apple -- Apple and MS/Adobe disagree on the format of a ttf font. This is
164 annoying. Checking this box means the font will be generated according to
165 Apple's desires, leaving it unchecked means according to MS/Adobe's desires.
166 Currently this controls:
167
168 * The bitmap tables (Apple calls it 'bdat', MS/Adobe 'EBDT'. The data in them are
169 the same)
170 * The PostScript name in the 'name' table (Apple says there must be either 0 or 1
171 of them, MS/Adobe say any value other than 1)
172 * Apple and MS/Adobe also differ on the way references (components) are scaled.
173 Luckily there is another way to disambiguate this case (and references are
174 rarely scaled anyway).
175 * The GDEF, GPOS, GSUB and prop, lcar, kern, opbd, morx, feat tables. Apple does
176 not support GPOS/GSUB tables. MicroSoft still supports kern tables for some
177 fonts but requires GPOS for others.
178 * [] OpenType -- If this is checked the font will be generated with the tables
179 used by OpenType. If both this and [] Apple are checked the font will have two
180 sets of tables, Apple will look at one set, and everyone else will look at the
181 other.
182
183 .. note::
184
185 The above statement was true up to 10.4 ("Tiger") after 10.4, Apple can use a
186 few OpenType features.).
187 * [] Old style 'kern' -- If this is checked along with OpenType then both an
188 OpenType 'GPOS' and an old style 'kern' table will be generated (assuming there
189 are any kern pairs, of course). The OpenType mailing list considers this a bad
190 idea (some applications may add the kerning values from both tables they say),
191 but it may be helpful for applications which don't support 'GPOS' kerning.
192 * [] Dummy DSIG -- On MS Windows, a font with extension "ttf" will be marked with
193 an OpenType icon if it contains a 'DSIG' table. FontForge can't generate a
194 useful 'DSIG' table, but it can generate a useless, empty and valid one.
195 * [] Save Comments -- I have added my own table
196 (':ref:`PfEd <non-standard.PfEd>`') in the truetype format in which I can store
197 whatever data I want. Checking this box saves all the glyph comments into the
198 output file.
199 * [] Save Colors -- Save the glyph colors in the ':ref:`PfEd <non-standard.PfEd>`'
200 table as well.
201 * [] Lookup Names -- Preserve lookup, lookup subtable and anchor class names in
202 the 'PfEd' table.
203 * [] Save Guides -- Save information about where the font's guidelines are into
204 the 'PfEd' table.
205 * [] Save Layers -- Save the background (and spiro) layers into the 'PfEd' table.
206 * [] TeX -- Save TeX metrics in the ':ref:`TeX <non-standard.TeX>` ' table
207 * [] Output Glyph Map -- Output a file (with extension .g2n) mapping TrueType
208 (OpenType) glyph IDs to glyphnames (and possibly to unicode values)
209 * [] Output OFM & CFG -- Output metrics files for Omega
210
211 --------------------------------------------------------------------------------
212
213 * [] Output Font Log -- if the font contains :ref:`font log <fontinfo.FontLog>`
214 information then write it out into a separate file "FontLog.txt".
215
216 TTF (and OpenType) fonts are usually generated in Unicode encoding, there will
217 also be a tiny macintosh encoding of MacRoman (and a macintosh copy of the
218 unicode encoding) -- the exceptions are: KSC5601 and Wansung fonts which will
219 use Wansung, Johab fonts will use johab, JIS208 and SJIS fonts will use SJIS,
220 Big5 will use big5 encoding. Fonts with a "Full Unicode" encoding will have both
221 a 2 byte unicode encoding table and a 4 byte table. OpenType CID keyed fonts
222 will be saved with Unicode encoding.
223
224 PostScript fonts are generated in whatever encoding the font is using (except if
225 you take a two byte encoding and generate a Type1 font (rather than a Type0)
226 then only the first few (256) glyphs will be encoded). Type0 does not support a
227 full Unicode (4 byte) encoding.
228
229 PS CID (and OpenType CID in the CFF) are saved with no encoding. The encodings
230 live in separate cmap files which are available from
231 `adobe <http://www.adobe.com/products/acrobat/acrrasianfontpack.html>`__ (and
232 perhaps other font vendors).
233
234 If you save a CID font with a format other than PS CID or OpenType CID, then
235 only the currently displayed subfont will be saved, with the current meaningless
236 glyph ordering (I suppose this is useful if you wish to extract a sub-font from
237 a CID font).
238
239 SVG fonts don't really have the concept of an encoding other than Unicode.
240
241 TTF (and OpenType) fonts will produce vertical metrics tables if the font has
242 vertical metrics enabled. PostScript type1 fonts will not produce Metrics2
243 dictionaries (If someone actually wants this let me know, it can be done, but I
244 get the impression that nobody uses this any more).
245
246 On Mac OS/X, when generating a resource font containing a postscript font then
247 the filename textfield will not be present (as the filename is determined by the
248 fontname). You can still select a directory however.
249
250 The bitmap sizes must all be present in the font database. AntiAliased fonts can
251 be indicated by following the pixelsize by "@<depth>" (ie. "@8").
252
253 If you are generating a bdf font then you will be prompted for a resolution
254 later.
255
256 See the section on :ref:`namelists <encodingmenu.namelist>` for a discussion of
257 the "Force glyph names to" field.
258
259 If you leave [] Validate Before Saving checked then FontForge will attempt to
260 validate your font. If it passes then FontForge will save it without bothering
261 you further, but if it fails FontForge will give you the option of reviewing
262 errors and fixing them. It will pop up a :doc:`validation window </ui/dialogs/validation>`.
263
264 If you check [] Append a FONTLOG entry then a text area will open up in which
265 you can create a new FONTLOG entry to be appended to the end of the FONTLOG.
266 This will become part of the FONTLOG before it is saved (with [] Output Font Log
267 in the [Options] dialog) **BUT** you must save the font if you wish to retain
268 this entry in the sfd file itself.
269
270 If you generate a TrueType or OpenType font with the OpenType mode set (note:
271 the term "OpenType" means two things, a truetype wrapper around a postscript
272 font, or a set of tables containing typographic information -- here the OpenType
273 mode refers to the typographic tables) then FontForge will generate
274 :doc:`GPOS, GSUB, and GDEF tables </techref/gposgsub>`. These contain kerning, ligature
275 information, arabic forms data, anchor points, etc.
276
277 Apple does not completely support these OpenType layout tables. If you set Apple
278 mode :ref:`'kern', 'opbd', 'morx', 'feat', 'lcar' and 'prop' <gposgsub.AAT>`
279 tables may be generated instead. (and a couple of other small differences will
280 appear).
281
282 If you set both Apple and OpenType then both sets of tables will be generated.
283 If you set neither, then only the 'kern' table will be generated, and it will
284 only contain pair-wise kerning (no kerning classes, no kerning by state
285 machine). This is the kind of kerning available in the original truetype spec
286 (from which both Apple and OpenType have diverged, but which both still
287 support).
288
289 --------------------------------------------------------------------------------
290
291
292 .. _generate.Mac-Family:
293
294 Generate Mac Family
295 -------------------
296
297 .. image:: /images/GenerateFamily.png
298 :align: right
299
300 This brings up a dialog very similar to the generate fonts dialog above, but
301 with a few added fields. Because this dialog is for Mac families, only Mac
302 formats are supported.
303
304 Right above the [Save] button is a list of all fonts that FontForge thinks
305 should be included in this family, along with their bitmap info. If you don't
306 want a font to be in the family simply uncheck its checkbox.
307
308 The font styles that are allowed in a family are limited by the capabilities of
309 the mac 'FOND' resource which only allows one style of a given type and does not
310 support the concepts of "Light", "Black" (if there is already a "Bold" style),
311 "Oblique" (if there is already an "Italic" style), etc. Generally FontForge will
312 be able to figure out a font's style from its fontname, but in some cases you
313 may wish to override this by setting the :ref:`mac style <fontinfo.Mac-Style>`
314 directly in fontinfo.
315
316 As of Mac OS/X 10.6 Apple appears to be deprecating this format and moving
317 toward :ref:`TTC files (see below <generate.GenerateTTC>`).
318
319 For information on creating mac font families beyond the capabilities of this
320 dialog look at the :ref:`FAQ <faq.How-family>`.
321
322 --------------------------------------------------------------------------------
323
324
325 .. _generate.GenerateTTC:
326
327 Generate TTC
328 ------------
329
330 .. image:: /images/GenerateTTC.png
331 :align: right
332
333 A TrueType Collection file can contain many fonts. They need not be all in the
334 same family (though, of course, they can be).
335
336 The dialog lists all open fonts, you may choose any of them to go into the ttc
337 file. No especial magic is needed to bind fonts into one family (at least I hope
338 not).
339
340 Traditionally ttc files have been used to contain variants of large CJK fonts
341 (where most of the CJK glyphs remain the same across fonts with a few glyphs
342 (often the latin letters) changing). The format allows glyphs to be shared
343 across fonts, which can result in considerable space savings in some collections
344 -- but this can also take time.
345
346 On the mac, however, ttc files are generally used to contain a font family where
347 there is very little (often no) overlap of glyphs between fonts.
348
349 FontForge can produce two kinds of ttc files, the first
350 (``[*] Merge tables across fonts``) will try to use a single merged
351 'glyf'/'hmtx'/'hhea'/'vmtx'/'vhea' tables for all fonts (and will try to share
352 other tables if that is possible). The second, with merge tables turned off,
353 will dump individual fonts into the collection with no attempt to optimize.
354
355 FontForge can also produce ttc files which use the CFF font format. The OpenType
356 documentation claims this will not work, but it does seem to on both the Mac and
357 unix/linux.
358
359 FontForge is not always able to produce merged tables ... this process will fail
360 if:
361
362 * The selected fonts have different emsizes
363 * Bitmaps are to be included in the collection
364 * More that 65534 glyphs would be needed in the merged table
365 * If you select the CFF format then the private dictionaries must match.
366 * (or something else goes wrong)
367
368 --------------------------------------------------------------------------------
369
370
371 .. _generate.svg:
372
373 SVG fonts
374 ---------
375
376 SVG (Scalable Vector Graphics) fonts, come in two forms, one corresponds roughly
377 to a PostScript Type1 font, and one to a PostScript Type 3 font.
378
379 In the first format a set of contours is specified for each glyph. There is no
380 indication given whether the font should be stroked or filled -- that information
381 will have inherited from the graphical environment when the font is used on
382 text.
383
384 In the second format each glyph may contain the stroke and fill commands needed
385 to draw it.
386
387 FontForge usually generates the first format, but for multi layered or stroked
388 fonts it will generate the second format.