Debian Codegraph @

doc/sphinx/ui/mainviews/fontview.rst

raw
1 Font View
2 =========
3
4 .. image:: /images/AmbrosiaFV.png
5
6 The font view is a list of all the glyphs available in the given font.
7
8 You may chose to display it at various sizes, by default it will be displayed
9 with the outline font rasterized on a 24 pixel em square. You may display it at
10 36, 48, 72 and 96 pixel sizes as well. You may also choose to look at an
11 anti-aliased greymap (the above image is anti-aliased). These are slower to
12 generate but look nicer (:doc:`Comparison </techref/AA-Comparison>`).
13
14 If you have an encoding slot which has nothing in it (as opposed to an encoding
15 which maps to a space glyph) then that will be shown by a faint red X drawn
16 across the box.
17
18 Above each image of the glyphs in the font is a label indicating the glyph in
19 some conventional format. Usually this is just a small image of the glyph in a
20 standard font (as it is above), but you can change it to show the glyph's name,
21 unicode code point or encoding (in hex). In small views (24 pixel view for
22 instance) there may not be room for the entire label, and it will appear
23 truncated.
24
25 .. image:: /images/fvOutOfDateHinting.png
26 :align: left
27
28 If a glyph has been changed since it was last hinted (PostScript), or if a glyph
29 contains contours but has no instructions (TrueType), then its label will be
30 edged with blue bars. If the glyph has out of date instructions (TrueType), then
31 its label will be edged with red.
32
33 If one of your glyphs has something in its background layer then this will be
34 indicated visually (currently by darkening the background of the glyph label).
35
36 Normally the view will display the foreground layer of the font, but you may
37 change it to display any layer (other than the background layer) with
38 :ref:`View->Layers->? <viewmenu.FVLayers>`
39
40 You may also display any of the bitmap fonts you have generated from the outline
41 glyphs. Simply go to the View menu and select the one you want.
42
43 If you look at a bitmap version of the font, and it does not contain a glyph for
44 which there is an outline glyph (ie. the font needs its bitmaps regenerated)
45 then the missing glyph will be outlined in red to bring it to your attention
46 more easily.
47
48 Small bitmap fonts will be magnified. If the pixelsize of the font is less than
49 10 it will be shown 3 times normal size, if less than 20 twice normal size.
50
51 Underneath the menu bar is some information on the last glyph selected. First is
52 the encoding of the glyph in the current font expressed in decimal. Next is the
53 unicode code point for the glyph (or ???? if it is not a unicode character).
54 Next the postscript name for the glyph, and finally the unicode name. Not all
55 unicode characters will have unicode names (the CJK characters do not for
56 example)
57
58 If you move the cursor to a glyph and let it rest there a small popup window
59 will appear containing information about that glyph. If you depress the control
60 key then this window is locked in place until you move the mouse.
61
62 .. _fontview.metrics:
63
64 You may display metrics lines (baseline, origin and advance width) in the font
65 view. (View -> Show H Metrics). If you do so, I suggest viewing the font at a
66 large pixel size, otherwise the window looks too confusing.
67
68 .. flex-grid::
69
70 * - .. image:: /images/FVHMetrics.png
71
72 A 96 pixel display showing the various horizontal metric lines.
73
74 The blue line is the baseline
75
76 The small red tick on the left marks the glyph origin.
77
78 The green line on the right shows where the advance width is while the bottom
79 green line shows how long it is. (normally you will not display both at once)
80
81 The glyph is centered horizontally, and the font ascent is the top of the box
82 displaying it, while the descent is the bottom.
83
84 - .. image:: /images/FVVMetrics.png
85
86 A 96 pixel display showing the various vertical metric lines.
87
88 The blue line down the center is the vertical baseline.
89
90 The red bar at the top (over writing the ascent line) is the vertical origin.
91
92 The green line at the bottom shows where the vertical advance is while the
93 green line on the right shows how long it is. (normally you will not display
94 both at once)
95
96 You may select any number of glyphs in the font by dragging through them. You
97 may use shift-click to select (or deselect) additional glyphs. You may also use
98 the arrow keys to move around (and shift-arrow to select). To some extent the
99 order you select glyphs in will be remembered and a few commands will make use
100 of that.
101
102 You may drag and drop selected glyphs into
103
104 .. object:: The metrics view
105
106 Where they will be inserted into the display before the selected glyph
107 (selected in the metrics view) in the order in which you selected them in the
108 font view.
109
110 .. object:: The outline view
111
112 Where they will appear as references
113
114 .. object:: The glyph info substitutions/ligature dlg
115
116 Where they will appear as a substitution or ligature.
117
118 The [Tab] key will move to the next glyph with something in it, and Shift-[Tab]
119 will move to the previous glyph with something interesting.
120
121 You can perform various operations on the selected glyphs:
122
123 * Apply a general transformation (ie. move 20 units right and then rotate 180°)
124 * Expand all paths to be stroked paths
125 * Clean up areas where several paths intersect
126 * Simplify paths
127 * Build Accented Characters
128 * Regenerate bitmaps
129 * Autohint
130 * Control various metrics settings
131
132 And, of course, you can cut and paste. Normally copying a glyph will copy that
133 glyph and any bitmaps associated with it, but you can use the Edit->Copy From
134 menu item to change this so that only entries from the currently displayed font
135 are copied. So if a 12 pixel font is being displayed then only the bitmaps from
136 the 12 pixel bitmap font will be copied in this mode. Cut and Clear will clear
137 those things which would be copied.
138
139 Paste is a little more complicated. In general it will paste whatever is in the
140 clipboard, regardless of the copy mode. So if the clipboard contains a 12pixel
141 bitmap and the font view is displaying outlines, then pasting it will paste it
142 into the 12pixel font none the less. There is one exception to this. If the
143 clipboard contains a 12 pixel bitmap and the font view is currently display a
144 17pixel bitmap then the paste will go into the displayed bitmap.
145
146 A Paste from the font view will delete whatever splines were in the glyph
147 beforehand (while a paste in the outline glyph view will merge the new set of
148 splines with the old). Paste from the font view will also set the width of the
149 glyph.
150
151 You can scroll the display to any particular character by typing that character.
152 There is also a dialog which allows a slightly more general way of jumping
153 around. You may type in the glyph's name (all glyphs in a font will be named),
154 its encoding value, its unicode encoding value, or (for 2 byte fonts) its ku ten
155 specification.
156
157 Pressing the right mouse button invokes a popup menu.
158
159
160 .. _fontview.Encodings:
161
162 Encodings and Character Sets
163 ----------------------------
164
165 A Character Set is a set of characters (for example all the letters of the
166 alphabet would be one character set). An encoding is a function that takes a
167 number (often between 0 and 255) and maps it to a character. Often these two are
168 used synonymously as an encoding generally implies a given character set.
169 (strictly speaking a character set is an unordered collection with no implied
170 encoding, and some encodings work with multiple character sets).
171
172 All fonts in fontforge have both a character set and an encoding. The character
173 set is just the set of characters in the font. The encoding is the way those
174 characters are ordered (or sometimes, the way the first 256 are ordered). The
175 font info dialog allows you to chose the encoding (and character set) you wish
176 for a font. Often a font will have a few extra glyphs that don't fit into the
177 character set specified by the encoding, these glyphs will be placed at the end
178 of the font and when the font is output (ie. postscript is generated, or a
179 bitmap font created) the glyphs will be included in the font but they will not
180 be encoded (this can be useful, especially in postscript where it is possible to
181 reencode a font at run time. Thus a font might have all the glyphs needed both
182 for a cyrillic character set and for a latin one, but only one character set at
183 a time would be encoded).
184
185 It is possible for an encoding not to be one-to-one. That is there may be
186 several characters that might lead to the same underlying glyph (the classic
187 example is the non-breaking space which often uses the same glyph as the
188 breaking space). When FontForge encounters such an encoding it will create a
189 character structure for each entry, one of those structures will contain the
190 data for drawing the glyph, the other(s) will contain a reference to the one
191 real character. All characters will have the same name. When FontForge generates
192 a font it looks for this case and turns it into a font whose encoding vector
193 contains multiple references to a glyph.
194
195 It is also possible to have an encoding where a single character can lead to
196 several different glyphs depending on the context. In arabic, for example, most
197 characters have at least four different glyphs depending on whether the
198 character is found initially, medially or finally in a word, or if it appears by
199 itself (isolated).
200
201 You may also create a custom encoding. (Generally, only the first 256 entries of
202 a Custom encodings will actually be part of a font's encoding vector). You may
203 change the name of any glyph in the font with the Element->Char Info command.
204 This will force the font to have a custom encoding.
205
206 There are many standard encodings built in to the program. There are 14 ISO 8859
207 encodings, the encoding used by the Macintosh for the US and Western Europe, the
208 encoding used by MS Windows for the US and Europe (which is a slight extension
209 of ISO 8859-1). There are also several 2-byte encodings built in. Several of
210 these are subsets of unicode (whose goal is to specify every character currently
211 used by humans). There are many large CJK (Chinese, Japanese, Korean) two byte
212 encodings. You can also add your own encodings with the
213 :doc:`Encoding </ui/menus/encodingmenu>` menu. A brief description of what's in the
214 encodings also appears :doc:`on that page </ui/menus/encodingmenu>`.
215
216 There may be some slight differences between one vendor's definition of an
217 encoding and another. I try to follow those encodings specified by the Unicode
218 consortium. I notice that the Symbol encoding used by Microsoft differs from the
219 Unicode one (usually just be substituting synonyms, Omega for Ohm sign for
220 instance).
221
222 Adobe did not choose their naming conventions very well for Greek letters. They
223 assigned the name "mu" to Micro Sign, "Delta" to Increment and "Omega" to Ohm
224 Sign. So the Greek alphabet has ugly nameless holes in it.
225
226 CID fonts (see :ref:`below <fontview.CID>`) have no encodings. Instead they are
227 designed to be associated with one or several cmap files which provide encodings
228 in a general way. cmap files are beyond the scope of FontForge. Adobe has
229 defined many which are freely
230 `available <http://www.adobe.com/products/acrobat/acrrasianfontpack.html>`__.
231
232 There is one final encoding called "Glyph Order". This encoding is just the
233 glyphs in the order in which they were read from the original font.
234
235
236 .. _fontview.Unicode:
237
238 Unicode (ISO 10646)
239 ^^^^^^^^^^^^^^^^^^^
240
241 PostScript® assigns a name to every unicode character. Some of these names are
242 fairly obvious like "A" for the first letter of the latin alphabet, others are
243 more obscure like "afii57664" for hebrew alef, while others are just "uni8765"
244 for the unicode character at 0x8765.
245
246 PostScript Unicode encoding does not quite mesh with the unicode standard. This
247 is probably because PostScript deals in glyphs and Unicode deals with characters
248 so PostScript sees no distinction between space and nobreak space (and so does
249 not encode the latter) while Unicode does.
250
251 According to the `unicode website <http://www.unicode.org/>`__ the first 256
252 character positions of unicode and ISO 8859-1 (ISO Latin1) are the same. However
253 the PostScript encoding of ISOLatin1 is slightly different from that specified
254 for unicode. I cannot explain the reasoning behind this. FontForge does not use
255 PostScript's ISOLatin1 Encoding vector, instead it uses the first 256 code
256 positions of the unicode encoding vector (slightly modified by me to conform to
257 Unicode conventions rather than PostScript. So I include nobreak space and the
258 soft-hyphen).
259
260 FontForge supports two slightly different unicode encodings. The first contains
261 only the first 65536 characters of unicode (those in the
262 `Basic Multilingual Plane <http://www.unicode.org/roadmaps/bmp.html>`__, or
263 BMP), while the second can contain as many characters as you have memory for.
264 Character definitions are still sparse outside of the BMP so at the moment you
265 probably want to use just the BMP. Currently there are only definitions for
266 plane 0 (BMP, U+0000-U+ffff), Plane 1
267 (`SMP, Secondary Multilingual Plane <http://www.unicode.org/roadmaps/smp.html>`__,
268 U+10000-U+1ffff), Plane 2
269 (`SIP, Supplementary Ideographic Plane <http://www.unicode.org/roadmaps/sip.html>`__,
270 U+20000-U+2ffff), and Plane 14
271 (`SSP Supplementary Special-purpose Plane <http://www.unicode.org/roadmaps/ssp.html>`__,
272 U+e0000-U+effff).
273
274
275 .. _fontview.CID:
276
277 CID keyed fonts
278 ---------------
279
280 The standard mechanisms that postscript provides work reasonably well for
281 alphabets and syllabaries, but the massive number of characters needed for CJK
282 (Chinese, Japanese or Korean) fonts require more complex machinations. Adobe's
283 current solution is the :ref:`CID-keyed font <cidmenu.CID>`, a font consisting
284 of several subfonts each a collection of glyph descriptions with no encoding
285 imposed on them and no names given to them.
286
287 If FontForge loads in a CID keyed font it will enable a special menu called
288 :doc:`CID </ui/menus/cidmenu>` which (among other things) displays the list of all the
289 sub-fonts in the font. When it starts up FontForge will pick (practically at
290 random) a sub-font to display in the font view. You may change which font is
291 displayed by the CID menu.
292
293 The CID menu also allows you to turn a normal font into a CID keyed font. It
294 creates a collection containing just the original font (you may add other fonts,
295 or blank fonts, later). But before it can create a collection FontForge needs to
296 know what glyph set you will be using. A glyph set is just a collection of
297 glyphs, and you may define your own if you wish (but if you do you have to
298 define your own cmap files, etc and it's probably not worth it). Adobe has
299 defined glyph sets for Japanese (actually there are two, one corresponding to
300 JIS208 and one to JIS212), Korean (Wansung & Johab), Traditional Chinese (Big5)
301 and Simplified Chinese (GB2312). Although these glyph sets are based on the
302 standards mentioned, they each have many additional glyphs. Adobe also defines a
303 glyph set that works for Unicode, but it is called "Identity" instead. FontForge
304 does not have these glyph sets built in to it, each must be loaded the first
305 time it is used. I provide one file for each of the above glyph sets, they have
306 an extension of ".cidmap", and you may download them all
307 `from here <https://fontforge.org/downloads/cidmaps.tgz>`__.
308
309 (There are also many other character sets floating around feel free to install
310 them yourself).
311
312 Adobe identifies each glyph set by a three values: a registry, an ordering and a
313 supplement. The registry is the name of the organization that is defining the
314 glyph set (Adobe calls itself Adobe), an ordering identifies the glyph set
315 (Japan1, Korea1, etc.) and the supplement indicates how many times the ordering
316 has been revised. Glyphs may only be added to an ordering, never removed, so an
317 old font will be perfectly described by a newer glyph set, while a new font
318 described by an old glyph set will have some unavailable glyphs. So a full
319 cidmap name will look like:
320
321 Adobe-Japan1-4.cidmap
322
323 Adobe-Korea1-2.cidmap
324
325 .. warning::
326
327 FontForge's support for CID-keyed fonts is rudimentary; especially attempting
328 to use Compact encodings and the Metrics View in CID-keyed fonts is known to
329 cause issues and crashes. At one time, the memory usage of CID-keyed fonts
330 was seen as very worrisome (≈250MB), however as even most modern smartphones
331 can support such usage it is no longer a concern for the majority of users.
332 Therefore, we recommend that if you will make serious edits to a CID-keyed
333 font, you :ref:`flatten <cidmenu.CID>` it first to prevent crashes and memory
334 corruption. Bug fixes are always welcome-to start, see
335 `issue №3946 <https://github.com/fontforge/fontforge/issues/3946#issuecomment-534005675>`__.
336
337 The :ref:`Remove Undoes <editmenu.Remove-Undoes>` command will allow you to free
338 up memory if you think you may be running short. FontForge is not always able to
339 protect itself against running out of memory, sometimes the OS just sends it a
340 SIGKILL signal.
341
342
343 .. _fontview.MM:
344
345 Multiple Master Fonts
346 ---------------------
347
348 If the font is a :ref:`Multiple Master <multiplemaster.MM>` Font there will
349 again be several subfonts only this time all the subfonts contain the same glyph
350 set. Each subfont provides glyphs for one style of the font family. The
351 :doc:`MM </ui/menus/mmmenu>` menu allows you to control which style of the family is
352 visible in the font view, and provides a few other commands for manipulating
353 multiple masters.
354
355
356 .. _fontview.Vertical-Metrics:
357
358 Vertical Metrics
359 ----------------
360
361 CJK fonts generally should have vertical metrics. Latin (Cyrillic, Greek) fonts
362 generally should not. If FontForge reads in a font with vertical metrics it will
363 retain those metrics, but when FontForge creates a new font then that font will
364 not have vertical metrics enabled.
365
366 To enable vertical metrics for a font go to
367 :ref:`Element->Font Info <fontinfo.vertical>` and select the ``General`` tab and
368 check the ``[*] Has Vertical Metrics`` checkbox. This will allow you to set the
369 vertical origin for the font and it will give every glyph a default vertical
370 advance of the emsize of the font (ascent+descent).
371
372 The vertical origin is the y height (in the design coordinate system) of the
373 origin for vertical metrics.
374
375 In the outline glyph view you will be able to adjust the vertical metrics just
376 as you adjust the horizontal metrics.
377
378 You can view the vertical metrics in the font view just as you can the
379 horizontal metrics with View->Show V Metrics.