Debian Codegraph @

doc/sphinx/ui/mainviews/charview.rst

raw
1 Outline Glyph View
2 ==================
3
4 .. image:: /images/charview2.png
5
6 The outline glyph view is the window in which most editing happens.
7
8 At the top of the window, underneath the menu bar is an information line. The
9 first item is the location of the mouse pointer (in the internal coordinate
10 system of the glyph). If there is a single selected point then the next item
11 gives its location, and the next three are, respectively, the offsets from the
12 selected point to the current location, the distance from the selected point,
13 and the angle from the horizontal (measured counter-clockwise). Then we have the
14 current scale factor, and the layer which is active. Finally (in the debugging
15 view) is an indication of whether the instruction pointer is in the glyph
16 program, the 'prep' program of the 'fpgm'.
17
18 Underneath the information is a ruler showing the current pointer location as a
19 red line. There's a similar ruler on the left side.
20
21 Underneath that is the glyph itself. On the left edge of the screen is a grey
22 line indicating the x=0 line, further right is a black line showing where the
23 glyph's width is currently set. There are also grey lines showing the ascent,
24 descent and baseline.
25
26 Background images and background splines are drawn in grey. Grid lines are also
27 drawn in grey. Vertical hinting regions are drawn in light blue, Horizontal
28 hints are drawn in light green. If any hints overlap the boundaries are drawn in
29 cyan.
30
31 The points of the glyph are of three types, corner points drawn as filled
32 squares, curve points drawn as filled circles and tangent points drawn as filled
33 triangles. If a point is selected then it will be drawn as an outlined square,
34 circle or triangle and its control points are drawn as little magenta or
35 dull-cyan xs at the end of a similarly colored line. (in a curved point the
36 control points will be collinear). (the "Next" control point will be drawn dull
37 cyan, and the Prev point will be magenta).
38
39 .. image:: /images/charview-quadratic.png
40 :align: right
41 :alt: A quadratic glyph
42
43 In a TrueType font, an on-curve point can be implied between two control points.
44 FontForge will draw these with an open circle.
45
46 The initial point in a contour will be drawn in green, and beside it will be a
47 tiny arrow pointing in the direction of the contour.
48
49 .. image:: /images/extrema-poi.png
50 :align: left
51 :alt: Showing extrema
52
53 Sometimes it is important to know which points are at the extrema of splines
54 (postscript likes for there to be points at the extrema of all splines), if this
55 is important to you set the "Mark Extrema" flag in the View menu. After that
56 points at extrema will show up as dull purple. And internal extrema will also be
57 marked.
58
59 There are also two palettes, one, a layer palette, allowing you to control
60 :ref:`which layers are visible <charview.Layers>`, and one, a tool palette, from
61 which you :ref:`may pick editing tools <charview.Tools>`. Normally these are
62 docked in the window, but you may choose to make them free floating windows by
63 unchecking :menuselection:`View --> Show --> Palettes --> Dock Palettes`.
64
65 You select an editing tool by clicking on the appropriate button on the tools
66 palette, or you may depress the right mouse button and select a tool from a
67 popup menu (you may also change layers and do a few other things with this
68 menu). There are four different tools bindings available to you (this may be a
69 complication with no utility). The left mouse button has a tool bound to it, and
70 this tool will be displayed when the program is idle. If you hold down the
71 control key, another tool is available, by default this is a pointer but if you
72 click on the tools palette with the control key down you can select something
73 else. If you depress the middle mouse button you get a third tool (by default a
74 magnifying glass), and the control key and middle button give you the fourth (a
75 ruler).
76
77 If the mouse pointer is close to a point (within a few pixels) when you depress
78 the mouse, then the effective location of the press will be the location of the
79 point.
80
81 If you drag a glyph from the font view and drop it into a glyph view then
82 FontForge will drop a reference to the dragged glyph into the view.
83
84 .. warning::
85
86 If your glyph has truetype instructions then editing it may cause those
87 instructions to behave very oddly. If your glyph has anchor points which
88 depend on truetype point matching then editing the glyph may disconnect the
89 points. If your glyph is used as a reference in another glyph that positions
90 references by point matching then editing this glyph may reposition those
91 references.
92
93
94 .. _charview.Layers:
95
96 Layers
97 ------
98
99 .. image:: /images/layers.png
100 :align: left
101
102 There are several drawing layers in the outline view. Each layer has an "eye
103 box" (indicating whether it is visible or not), curve type ("C" for cubic,
104 "Q"for quadratic, " " for Guide layer, which is always cubic), mode ("#" for
105 Guide layer, "B" for background layers, "F" for foreground layers) and a name.
106
107 The first layer is a set of guide lines/splines. These are common to all glyphs
108 in the font. A few lines are provided for you (the x=0 line, the ascent, descent
109 and baseline). Other handy lines might be the x-height of the font, the
110 cap-height, ascender-height, descender-height, ... When you are working in any
111 of the other layers, points will snap to splines in this layer (making it easy
112 to force a consistent x-height for example).
113
114 Next are the background layers, these contain background images and splines.
115 These do not go into the font, but may be helpful to you in tracing the outline
116 of your glyph. It is possible to paste an image into the background if you have
117 an image manipulation program that supports selection by mime type (the kde
118 family of applications does this, perhaps others), then FontForge will be able
119 to read images in either "image/png" or "image/bmp", otherwise you may import
120 background image files.
121
122 When debugging truetype (:ref:`Hints->Debug <hintsmenu.Debug>`), or showing
123 gritfit outlines (:ref:`View->Show Gridfit <viewmenu.ShowGridFit>`) the
124 visibility of the gridfit outlines can be controlled by the background layer's
125 visibility.
126
127 The last is the foreground layer, this contains the splines that actually make
128 up the glyph that will be placed into the font.
129
130 One can actually have multiple foreground and background layers. They can be
131 created and deleted with "+" and "-" buttons. FontForge, won't delete last layer
132 of its type, though. And care must be taken when generating a font to have the
133 right foreground layer selected, if multiple are present.
134
135 Layer curve type and visibility can be toggled freely with left mouse button.
136 Making the layer cubic or quadratic is a little trickier, as it's done with
137 right mouse button: a pop-up menu will appear, allowing for some additional
138 operations, like moving contents between layers.
139
140
141 .. _charview.Tools:
142
143 Tools
144 -----
145
146 .. image:: /images/tools.png
147 :align: left
148
149 There are 19 different editing tools, a mode button which alters the behavior of
150 5 of them, and two others (rectangle/ellipse and polygon/star) which come in two
151 forms.
152
153 At the bottom of the palette is a list of the current bindings of the mouse
154 buttons. Here mouse button 1 is bound to the pointer tool, mouse button 1 with
155 the control key pressed is also bound to pointer, mouse button 2 is bound to
156 magnify, and mouse button 2 with control is bound to ruler.
157
158 .. _charview.alt-meta-capslock:
159
160 Many of the tools have different behaviors if you hold the shift or alt (meta)
161 key down when using the tool. On the mac there is no alt/meta key, and the
162 Option and Command keys are usually bound to making a one button mouse look like
163 a three button mouse. So on the mac fontforge uses the caps-lock key rather than
164 alt/meta.
165
166
167 The pointer tool
168 ^^^^^^^^^^^^^^^^
169
170 .. image:: /images/cvarrowicon.png
171 :align: left
172
173 .. _charview.pointer:
174
175 This tool is used for selecting points, images and referenced glyphs. It can
176 also move these and scale images and referenced glyphs.
177
178 Only things that are in the layer that is currently editable may be selected or
179 moved or scaled.
180
181 A simple click on an unselected point selects it and deselects everything else.
182 A shift click on a point toggles whether that point is selected or not. A double
183 click selects all points on the path containing that point. A triple click
184 selects everything in the layer. Clicking on the background will deselect
185 everything. Clicking on the background and dragging out a rectangle will select
186 everything within the rectangle. Clicking on a line or spline will select the
187 two end points of that line or spline. Clicking on the dark part of an image
188 (when in a layer with images) will select the image. Clicking on the outline of
189 a referenced glyph will select that reference (if a reference glyph happens to
190 have the same outline and bounding box, then holding down the
191 :ref:`meta/alt/caps-lock <charview.alt-meta-capslock>` key will allow you to
192 move it once it is selected, without the meta key you will resize it).
193
194 If a point has no visible control points, then they are at the same location as
195 the point itself. If you want to select one of the control points then first
196 select the point (to make the control points active) then hold down the meta key
197 (use caps-lock on the mac) and depress the mouse on the point. This should allow
198 you to drag one of the control points (if you get the wrong point the first time
199 drag it out of the way, repeat the process to get the other control and then put
200 the first one back). Sadly some window managers (gnome-sawtooth for one) will
201 steal meta-clicks. If this happens you will need to use Element->Get Info to set
202 the control points.
203
204 .. _charview.CpInfo:
205
206 .. image:: /images/cpinfo.png
207 :align: right
208
209 When you move a control point you have the option
210 (:ref:`View->Show Control Point Info <viewmenu.CpInfo>`) of getting a popup box
211 showing information about the control point (and its opposite number on the
212 other side of the on-curve point). You will be told whether this is the next or
213 previous control point, the absolute location of the point, the offset from the
214 on-curve point, the slope expressed as a ratio, and as an angle, and the
215 curvature on this side of the base point. At the very bottom is the difference
216 between the two curvatures. Try to make this number approach 0 for curved
217 points.
218
219 Once something is selected you may drag it around. If you select something and
220 drag the mouse then it and everything else selected will be moved. If you drag
221 an open path and one of the end points happens to fall on the end point of
222 another open path, then the two will be merged into one (If you don't want open
223 paths to merge, hold down the
224 :ref:`Alt/meta/caps-lock <charview.alt-meta-capslock>` key). If you drag a
225 control point then it will be moved (if you drag a control point defining an
226 implied point, then the implied point(s) will also be moved).
227
228 If you selected a spline, then dragging it will drag the location on the spline
229 where you pressed the mouse (so you are changing the shape of the spline).
230
231 If you hold the shift key down when you drag then the motion will be constrained
232 to be either horizontal, vertical, or at a 45° angle. (When moving control
233 points the combination of shift and
234 :ref:`meta (alt) <charview.alt-meta-capslock>` will mean that the control point
235 is constrained to be the same angle from the base point as it was before you
236 started moving it).
237
238 If your font has an ItalicAngle set, and the ItalicConstrain preference item is
239 set, then motion that would normally be constrained to the vertical is
240 constrained to be along the ItalicAngle.
241
242 If you move the mouse to the bounding box of a selected image or reference glyph
243 and drag it then you will scale that object.
244
245 .. _charview.set-width:
246
247 If you move the mouse to the advance width line, then dragging it will change
248 the width of the current glyph. If there are any bitmaps of this glyph then
249 their widths will also be updated. If there are any other glyphs which depend on
250 this glyph (ie. include this glyph as a reference) and their width was the same
251 as the glyph's, then their widths will also be updated (so if you change the
252 width of A, then the width of À, Á, Â, Ã, Ä and Å might also be changed). If you
253 are displaying vertical metrics (in a font that has them), then you can use the
254 same technique to modify the vertical advance.
255
256 If you are in an accented glyph then you may not be able to change the width, as
257 its width is bound to that of the base glyph (By setting the "Use My Metrics"
258 bit in the reference containing the base glyph). This will be displayed as a
259 lock icon at the top of the window near the width line.
260
261 It is also possible to use the arrow keys to move selected items around. Each
262 arrow will move the selection one em-unit (this can be changed in preferences to
263 be any number of em-units) in the obvious direction. The selection may include
264 the width (right bearing) line (or vertical with line). If the last thing you
265 selected was a control point then that point will be moved. If you hold down the
266 shift key at the same time the up and down arrows will move parallel to the
267 italic angle (be careful of this: this leads to non-integral values). If you
268 hold down the :ref:`meta (alt) <charview.alt-meta-capslock>` key, then the
269 motion will be 10 times the normal amount.
270
271 If you hold down the control key while working with the arrows then the view
272 will be scrolled rather than moving the selection.
273
274 If the glyph is a ligature (and has a ligature entry in Glyph Info) then it has
275 the potential of having "ligature caret locations". Essentially this means that
276 between each ligature component it is possible to place a caret location (so
277 that the word processor will place be able to place a caret between each
278 component of the ligature). In a ligature window a series of vertical lines will
279 be drawn across the screen at the caret locations. By default these lines will
280 be placed at the origin, but you may move one by placing the mouse pointer on
281 it, depressing the button and dragging the line around. See the description on
282 :ref:`building a ligature <editexample4.ligature>` for a more complete
283 description.
284
285
286 The magnifying tool
287 ^^^^^^^^^^^^^^^^^^^
288
289 .. image:: /images/cvmagicon.png
290 :align: left
291
292 .. _charview.magnify:
293
294 Clicking with the magnifying tool will magnify the view and center it around the
295 point you clicked on. Holding down the
296 :ref:`Alt/Meta/CapsLock <charview.alt-meta-capslock>` key and clicking will
297 minify the view, again centered around the point at which you clicked. Again
298 some window managers will steal meta-clicks, so you may have to use the View
299 menu to minify (It's called Zoom Out
300
301 If you drag out a rectangle with this tool then when you release, FontForge will
302 shift and scale the view so that your rectangle just fits into the window.
303
304 If your mouse has a scroll wheel then holding down the control key with the
305 scroll wheel causes it to magnify or minify the window.
306
307
308 .. _charview.scroll:
309
310 The scroll tool
311 ^^^^^^^^^^^^^^^
312
313 .. image:: /images/cvhandicon.png
314 :align: left
315
316 You can use this tool to scroll the window without using the scroll bars.
317
318
319 .. _charview.freehand:
320
321 The freehand tool
322 ^^^^^^^^^^^^^^^^^
323
324 .. image:: /images/cvfreehandicon.png
325 :align: left
326
327 .. image:: /images/freehandctl.png
328 :align: right
329
330 You can use this tool to draw a random curve which FontForge will then attempt
331 to convert into a set of splines. If you hold down the
332 :ref:`Alt/Meta/CapsLock <charview.alt-meta-capslock>` key then FontForge will
333 close the curve when you release the mouse.
334
335 If you double click on the icon in the tool palette you get a dialog similar to
336 the :ref:`Element->Expand Stroke <elementmenu.Expand>` which will give you
337 slightly more control over the results, as you can have it not expand the stroke
338 you draw (ie. leave a single trace.)
339
340
341 .. _charview.add-point:
342
343 Tools for adding curved, corner and tangent points.
344 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
345
346 .. image:: /images/cvcurveicon.png
347
348 .. image:: /images/cvhvcurveicon.png
349
350 .. image:: /images/cvcornericon.png
351
352 .. image:: /images/cvtangenticon.png
353
354 These four tools behave similarly, differing only in what kind of point is added
355 to the view.
356
357 If a single point is selected, and if that point is at the end of a path then
358 depressing the mouse button will create a new point where the mouse was
359 depressed and draw a spline from the selected point to new point. If this new
360 location happens to be the end of a path then the two paths will be joined (or
361 if it is the end of the current path then the path will be closed).
362
363 Otherwise if the mouse is depressed while being on a spline then a point will be
364 added to that spline.
365
366 Otherwise a new point is created not on any path at the location of the press.
367
368 Once the point has been created then it becomes selected and all others are
369 deselected. You may drag the point around, and if the point is on an open path
370 and you drag it to the end point of another open path then the two paths will be
371 joined.
372
373 If you double click then a point will be added as above and a
374 :doc:`Point Info </ui/dialogs/getinfo>` dlg will appear to give you fine control over the
375 location of the point and its control points.
376
377 The four different point types are
378
379 * curved points (where the incoming and outgoing splines have the same slope)
380 * horizontal/vertical curved points (similar to the above except the slope is
381 constrained to be either horizontal or vertical)
382 * corner points (where the incoming and outgoing splines may have different
383 slopes)
384 * tangent points (where one spline is a line segment and the other spline is
385 curved then the curved spline is constrained to start with the same slope as the
386 line).
387
388
389 .. _charview.pen:
390
391 The pen tool
392 ^^^^^^^^^^^^
393
394 .. image:: /images/cvpenicon.png
395 :align: left
396
397 This tool behaves differently in cubic and quadratic editing. In many ways it is
398 similar to the tools above as it adds a point to the current spline.
399
400 In a cubic font the points created are curved points, and they are initially
401 created with the control points on the point and as you drag you drag out the
402 control points rather than moving the point itself around.
403
404 In a quadratic font a point will be created half-way between the last control
405 point and the current location (which becomes the next control point).
406
407 If you hold down the Alt (Meta, etc) key you change the behavior so that cubic
408 editing looks like quadratic and vice versa.
409
410
411 .. _charview.spiro-add-points:
412
413 Tools for adding spiro control points
414 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
415
416 .. image:: /images/cvspiroG4icon.png
417
418 .. image:: /images/cvspiroG2icon.png
419
420 .. image:: /images/cvspirocornericon.png
421
422 .. image:: /images/cvspirolefticon.png
423
424 .. image:: /images/cvspirorighticon.png
425
426 These tools add spiro control points to the current contour, these are only
427 available in spiro mode, but the basic adding process is similar to the above.
428
429 The different point types are:
430
431 * G4 (continuous up to the fourth derivative)
432 * G2 (continuous up to the second derivative)
433
434 Basically, if you have a sharp curve you should probably use a G2 point, and if
435 a more gentle curve a G4.
436 * corner
437 * prev constraint point -- vaguely like a tangent (Raph calls this a "left" point)
438
439 This type of point should be used where the contour changes from a curve to a
440 straight line (where the curve is on the previous side of the constraint point)
441 * next constraint point -- vaguely like a tangent (Raph calls this a "right"
442 point)
443
444 This type of point should be used where the contour changes from a straight line
445 to a curve (where the curve is on the next side of the constraint point)
446
447 This is based on `Raph Levien's work <http://www.levien.com/spiro/>`__ with
448 clothoid splines which provide constant curvature across points.
449
450
451 .. _charview.spiro-mode:
452
453 Spiro mode
454 ^^^^^^^^^^
455
456 .. image:: /images/cvspiromodeicon.png
457 :align: left
458
459 This button toggles between editing contours using Bézier control points, or
460 between using spiro (clothoid) control points.
461
462
463 .. _charview.knife:
464
465 The knife tool
466 ^^^^^^^^^^^^^^
467
468 .. image:: /images/cvknifeicon.png
469 :align: left
470
471 This tool is used to cut splines. As you drag it across the view fontforge draws
472 a line showing where the cut will happen. When you release, every spline you
473 intersect will be cut-- that is at the location where this line intersects the
474 spline two new points will be created and the old spline will be split in two
475 connecting to the two new end points. These endpoints are not joined, so the
476 spline is now open (or if it were previously open, it is now cut in two).
477
478
479 .. _charview.ruler:
480
481 The ruler tool
482 ^^^^^^^^^^^^^^
483
484 .. image:: /images/cvrulericon.png
485 :align: left
486
487 .. image:: /images/ruler.png
488 :align: right
489
490 This tool tells you the current position of the mouse. If the mouse is near the
491 outline it will give the slope and curvature there. If the mouse is near a point
492 on the outline will give the slope and curvature on each side of the point.
493
494 If you depress the button and drag, the first line of the tool's pop-up shows
495 the distance, angle and (x-y) offsets from the first point where you depressed
496 the mouse to the last point, the mouse's current location. The next lines in the
497 pop-up show information about points along the line that intersect splines,
498 including the start and end points of the line itself. If there are more than
499 two intersections then the x, y, and total distance between the first and last
500 intersections are shown before the point list.
501
502 [0] indicates the starting point of the measure line, and the (x-y) co-ordinates
503 of that point. Initially [1] is the end point; when it intersects with one
504 spline then [1] becomes the first intersection point and [2] becomes the end
505 point, and so on. The co-ordinates are followed by the x and y distances and
506 then the final number is the length of the section ending at that point; which
507 is also shown directly on the canvas.
508
509 If you hold down the :ref:`Meta/Alt/CapsLock <charview.alt-meta-capslock>` key
510 then information will only be shown when the mouse is depressed.
511
512
513 .. _charview.scale:
514
515 The scale tool
516 ^^^^^^^^^^^^^^
517
518 .. image:: /images/cvscaleicon.png
519 :align: left
520
521 This tool allows you to scale the selection by eye rather than by a set amount
522 (if there is no selection then everything in the current layer will be scaled,
523 as though all points in that layer were selected).
524
525 Double clicking on this tool icon will bring up the transform dialog with the
526 "Scale..." option selected, useful for typing in scale percentages manually.
527
528 When the scale tool is active, FontForge shows a bounding box around the
529 selection, with draggable resize handles at the corners and edges:
530
531 .. image:: /images/cvscalemode.gif
532 :align: center
533
534 * Dragging a corner resize handle scales the selection while keeping the opposite corner fixed.
535
536 * Dragging a left/right edge handle scales only horizontally while keeping the opposite edge fixed.
537
538 * Dragging a top/bottom edge handle scales only vertically while keeping the opposite edge fixed.
539
540 Clicking or dragging anywhere other than a bounding box handle does not start a
541 scale operation, and is ignored. To change the selected points to scale, switch
542 to the "pointer tool" to make a new selection, then come back to the scale tool
543 to resize the selection.
544
545
546 .. _charview.flip:
547
548 The flip tool
549 ^^^^^^^^^^^^^
550
551 .. image:: /images/cvflipicon.png
552 :align: left
553
554 This tool allows you to flip the selection either horizontally or vertically.
555 Again the point at which you press the mouse is the origin of the
556 transformation.
557
558 Double clicking on this will bring up the transform dialog with the "Flip..."
559 option selected.
560
561 .. note::
562
563 After flipping an outline you will almost certainly want to apply
564 :ref:`Element->Correct Direction <elementmenu.Correct>`.
565
566
567 .. _charview.rotate:
568
569 The rotate tool
570 ^^^^^^^^^^^^^^^
571
572 .. image:: /images/cvrotateicon.png
573 :align: left
574
575 This tools allows you to rotate the selection freely.
576
577 Double clicking on this will bring up the transform dialog with the "Rotate..."
578 option selected.
579
580
581 .. _charview.skew:
582
583 The skew tool
584 ^^^^^^^^^^^^^
585
586 .. image:: /images/cvskewicon.png
587 :align: left
588
589 This tool allows you to skew the selection.
590
591 Double clicking on this will bring up the transform dialog with the "Skew..."
592 option selected.
593
594
595 .. _charview.rotate3d:
596
597 The rotate 3D tool
598 ^^^^^^^^^^^^^^^^^^
599
600 .. image:: /images/cvrotate3dicon.png
601 :align: left
602
603 This tool allows you to rotate the selection in the third dimension and project
604 the result back onto the x-y plane. An imaginary line is drawn from the point
605 where you pressed to the current point, this line determines the axis of
606 rotation. The distance you move from the initial press determines the amount of
607 rotation.
608
609 Double clicking on this will bring up the transform dialog with the "Rotate
610 3D..." option selected.
611
612
613 .. _charview.perspective:
614
615 The perspective tool
616 ^^^^^^^^^^^^^^^^^^^^
617
618 .. image:: /images/Eperspective.png
619 :align: right
620
621 .. image:: /images/cvperspectiveicon.png
622 :align: left
623
624 This tool allows you to apply a perspective transformation to the selection
625 (this is a non-linear transformation). This tool uses three points: The glyph
626 origin, the press point, and the current location of the cursor. In the image at
627 right the mouse was pressed on the baseline near the glyph's advance width, and
628 the mouse was released in the upper middle of the image. The glyph is
629 transformed so that the release point is treated as the point at infinity. The
630 line between the origin and the press point defines one axis of the
631 transformation. Distances perpendicular to this line are retained, distances
632 parallel to it are scaled as:
633
634 .. math::
635
636 x' &= x_{\mathrm{release}} + \frac{y_{\mathrm{release}} - y}{y_{\mathrm{release}}} (x - x_{\mathrm{release}}) \\
637 y' &= y
638
639 .. _charview.rectangle:
640
641 The rectangle/ellipse tools
642 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
643
644 .. image:: /images/cvrecticon.png
645
646 .. image:: /images/cvellipseicon.png
647
648 By default this produces a rectangle, single-clicking on the tool palette will
649 toggle between rectangle and ellipse, and double clicking in the tools palette
650 gives you a dialog which allows you to control whether your rectangles are drawn
651 with round corners, and how both rectangles and ellipses are specified.
652
653 You can choose whether the rectangle (or ellipse) will be drawn between the
654 point where you depressed the mouse on the view and the point where you released
655 it (bounding box), or whether the point where you depress the mouse becomes the
656 center of the rectangle and the point where you release it provides an end-point
657 (center out).
658
659 If you want even more control, you can double click in the glyph view and get
660 another dialog which allows you to define numerically where the
661 rectangle/ellipse should be placed, how big it should be, and whether it should
662 be rotated.
663
664
665 The polygon/star tools
666 ^^^^^^^^^^^^^^^^^^^^^^
667
668 .. image:: /images/cvpolyicon.png
669
670 .. image:: /images/cvstaricon.png
671
672 By default this draws a regular polygon, but by double clicking on the button in
673 the tools palette you can make it draw a star, or select the number of verteces
674 in your polygon.
675
676 The polygon is drawn as though it were inscribed in the circle whose center is
677 the point where you depressed the mouse and whose radius is the distance between
678 the press point and the release point. One of the polygon's verteces will be at
679 the release point.
680
681 A star is drawn similarly. It will be a star generated from a regular polygon.
682 As the number of verteces of the polygon gets larger the star will look more and
683 more like a circle, for this reason the dialog box that allows you to pick the
684 number of verteces will also allow you to pick how far the star's points should
685 extend beyond the circle in which the polygon is inscribed (this will make a
686 non-regular star, but it might look nicer).
687
688
689 .. _charview.Vertical:
690
691 Vertical View
692 -------------
693
694 .. image:: /images/charview-vert.png
695 :align: right
696
697 In this view the vertical metrics of the glyph are shown. You can change the
698 vertical advance just as you changed the glyph's width (by selecting the pointer
699 tool and dragging the vertical advance line up or down).
700
701 .. container:: clearer
702
703 ..
704
705
706 .. _charview.GridFit:
707
708 Grid Fit View
709 -------------
710
711 .. image:: /images/GridFit.png
712 :align: right
713
714 If you have the freetype library, then you can see the results of rasterizing
715 your glyph. If you have freetype's bytecode interpreter enabled you can also see
716 how the truetype instructions in the glyph have moved the points around (if you
717 don't have the bytecode interpreter enabled you will see what freetype's
718 autohinter does to points). This mode can be invoked with
719 :ref:`View->Show Grid Fit <viewmenu.ShowGridFit>`...
720
721 The Show Grid Fit command will ask you for some basic information first. It
722 needs to know the pointsize and resolution for which you want the action
723 performed (the example at right is 12pt on a 72dpi screen).
724
725 .. image:: /images/ShowGridFit.png
726
727
728 .. _charview.Debugging:
729
730 The Debugging View
731 ------------------
732
733 .. image:: /images/cvdebug.png
734
735 .. epigraph::
736
737 "I told you butter wouldn't suit the works!" he added, looking angrily at the
738 March Hare.
739
740 "It was the *best* butter," the March Hare meekly replied.
741
742 -- Alice's Adventures in Wonderland
743 -- Lewis Carroll
744
745 FontForge has a truetype debugger -- provided you have a version of freetype on
746 your machine with the bytecode interpreter enabled.
747
748 .. warning::
749
750 You need a license from Apple to enable this. It is protected by several
751 patents
752
753 The image to the right shows an example of this mode. You invoke it with
754 :ref:`Hints->Debug <hintsmenu.Debug>`, and as with the grid-fit view above you
755 must establish a pointsize and and resolution. The view divides into two panes,
756 the left of which is similar to the grid fit view above (except that it changes
757 as you step through the instructions), the right pane provides a list of the
758 instructions to be executed.
759
760 In addition to showing you all the points in your glyph there are either 2 or 4
761 additional points. These are the so-called "phantom" points and represent the
762 horizontal and vertical metrics of the glyph (old versions of freetype will only
763 display 2 points -- left side bearing and advance width, while newer versions
764 will display top side bearing and advance height as well).
765
766 As you step through a glyph occasionally points will light up. This is
767 FontForge's attempt to show you what points will be affected (usually moved) by
768 the current instruction. Other points will have a circle drawn around them.
769 These are used as reference points by the instruction.
770
771 There are a series of buttons at the top of the instruction view. The first will
772 single step the truetype program (step into), the second will step over
773 procedure calls, the third will set a break point at the return point for the
774 current function and continue until that is hit, and the fourth will continue
775 until:
776
777 * It hits a break point
778 * It hits a watch point
779 * It reaches the end of the glyph program
780 * An error occurs
781
782 The red "STOPPED" arrow shows the current location of the instruction pointer
783 (and what instruction will be executed next).
784
785 The fifth button allows you to set a watch point. You select a point (or several
786 points) in the left hand pane, and press this button. Thereafter, whenever one
787 of those points is moved FontForge will stop the glyph program. (You may also
788 set watch points through the points window).
789
790 When you are in this mode there are a few special "hot keys"
791
792 r
793 run/restart
794 k
795 kill/quit debugger
796 q
797 kill/quit debugger
798 c
799 continue
800 s
801 step (into)
802 n
803 next (step over)
804 f
805 finish function (continue until we return from the function)
806
807 Similarly you may watch storage and cvt locations by clicking on the appropriate
808 spot in the storage and cvt windows.
809
810 You can set a more conventional break point by clicking on an instruction. A
811 little red stop sign will appear on top of the address area, and the program
812 will halt when the instruction pointer reaches that instruction. Clicking on the
813 instruction again will remove the breakpoint.
814
815 .. warning::
816
817 Flaw: Currently there is no way to set breakpoints outside of the current
818 function (or glyph).
819
820 Flaw: Currently there is no way to examine the call stack.
821
822 The sixth button brings up a menu with which you can control which of various
823 debugging palettes are visible. The ones available so far are: Registers, Stack,
824 Points, Storage, Cvt, Raster and Gloss.
825
826 .. rubric:: Registers and the stack
827
828 .. flex-grid::
829 * - .. image:: /images/TTRegisters.png
830
831 Shows the truetype graphics state.
832
833 - .. image:: /images/TTStack.png
834
835 Shows the truetype stack. The value in parentheses is a 26.6 number.
836
837 .. rubric:: Points
838
839 .. image:: /images/TTPoints.png
840 :align: center
841
842 Shows the points. You may choose to view the twilight points, or the points
843 displayed in the glyph pane (the normal points). You may view the current
844 location or the original location. You may view them in the units of the
845 current grid, or in em-units.
846
847 When debugging a composite glyph the Transformed check box indicates whether
848 the points of the current component have been transformed (to show where they
849 fit in the composite) or not (showing where they are in the base component --
850 this is what the instructions are working on).
851
852 The points may have some flags associated with them: 'P' means the point is
853 an on curve point, 'C' means the point is an off curve point (a control
854 point), 'I' means the point is an on-curve point interpolated between two
855 control points, 'F' means a phantom point, 'T' means a twilight point, 'X'
856 means the horizontal touch flag has been set, 'Y' means the vertical touch
857 flag has been set.
858
859 A small stop sign indicates the point is being watched (that is execution
860 will stop if the point moves). You may change whether a point is watched by
861 clicking on it.
862
863 Contours are separated by horizontal lines
864
865 .. rubric:: Storage locations
866
867 .. image:: /images/TTStorage.png
868 :align: right
869
870 Shows the truetype storage locations.
871
872 A small stop sign indicates the storage location is being watched (that is
873 execution will stop if the location changes). You may change whether a
874 location is watched by clicking on it.
875
876 .. rubric:: The cvt array
877
878 .. image:: /images/TTCvt.png
879 :align: right
880
881 Shows the current values in the cvt array.
882
883 A small stop sign indicates the cvt location is being watched (that is
884 execution will stop if the value changes). You may change whether a location
885 is watched by clicking on it.
886
887 .. rubric:: Raster
888
889 .. image:: /images/TTRaster.png
890 :align: right
891
892 Shows the current raster with no magnificaton
893
894 .. rubric:: Instruction Gloss
895
896 .. image:: /images/TTgloss.png
897 :align: right
898
899 This window tries to provide a gloss for the current instruction. It gives a
900 brief description of the instruction in the top few lines, then explains what
901 registers it uses, and shows their values, it shows what use is made of the
902 stack and attempts to interpret the data on the stack. Finally it explains
903 what registers will be set, and what will be pushed onto the stack.
904
905 .. container:: clearer
906
907 ..
908
909 -------------------------------------------------------------------------------
910
911 The final button will exit the debugger.
912
913 The debugger also responds to some single character commands common to many
914 debuggers:
915
916 s
917 step into
918 n
919 step over (next)
920 c
921 continue
922 r
923 restart (with same grid)
924 f
925 step out (finish routine)
926 k
927 kill the debugger
928 q
929 kill the debugger
930
931 The :menuselection:`Hints --> Debug` menu command can also be used to exit the
932 debugger (by turning off the debug check box), or to restart the debugger with
933 different values for the point size and resolution. This dlg can also control
934 whether the fpgm and prep tables are debugged. Usually debugging will start
935 when execution reaches the instructions associated with this glyph.
936
937
938 Debugging composite glyphs
939 ^^^^^^^^^^^^^^^^^^^^^^^^^^
940
941 FontForge is not as friendly when debugging composite glyphs as it should be --
942 this is influenced by the way truetype works. Suppose you want to debug the
943 "Atilde" glyph.
944
945 First FontForge will load and grid fit the "A" glyph, points from the "tilde"
946 will not be displayed and behavior will be exactly the same as if you were
947 debugging a stand alone "A".
948
949 Then FontForge will load and grid fit the "tilde" glyph, and now points from the
950 "A" glyph will not be visible. The point numbers on the "tilde" will be the same
951 as they are in a stand-alone "tilde" (whereas in a true representation of
952 "Atilde", the points numbering in the "tilde" component will be offset by the
953 number of points in the "A" component). The "tilde" may appear oddly positioned,
954 this is caused by rounding: the "tilde" will usually be translated, and this
955 translation will usually be rounded to fit the pixel grid. The width line will
956 show the width of the "tilde" and not of the "Atilde".
957
958 Finally FontForge will execute any instructions in the composite itself, now all
959 sub-components will be displayed, and all points will be numbered as they should
960 be.
961
962 Several words of caution:
963
964 * If a component, or the composite as a whole, has no instructions then FontForge
965 will not debug that piece (there will be nothing to debug).
966 * FontForge does not translate references which do point matching properly until
967 the entire glyph has been loaded.
968
969 .. figure:: /images/mmcharview.png
970
971 Intermediate version of "A" with two other styles in the background
972
973 .. _charview.MM:
974
975 Multiple Master View
976 --------------------
977
978 In a multiple master font the :ref:`MM <mmmenu.outline-char>` menu gives you
979 control over which style of the font you are editing. It will also allow you to
980 display any (or all) of the other styles in the background. Although the menu is
981 called "MM" it applies equally to Apple's distortable fonts ("\*var" fonts, like
982 Skia).
983
984
985 .. _charview.multilayer:
986
987 Multiple Layer Editing
988 ----------------------
989
990 .. image:: /images/charview-multilayer.png
991 :align: right
992
993 If you wish to :doc:`edit type3 fonts </ui/dialogs/multilayer>`, FontForge can display a
994 glyph broken down into a series of strokes and fills and allow you to edit each
995 one.