Debian Codegraph @

doc/sphinx/ui/dialogs/validation.rst

raw
1 Font Validation window
2 ======================
3
4 .. image:: /images/validation.png
5 :align: right
6
7 Both PostScript and TrueType impose some restrictions on the data that define a
8 font. Before you save a font you should do a quick check (well... it's not
9 always quick) to insure that you are not breaking any rules.
10
11 * No open contours
12 * No paths may intersect.
13 * All paths must be drawn in a consistent direction. Clockwise for external paths,
14 anti-clockwise for internal paths. (Actually PostScript requires the exact
15 opposite, but FontForge reverses PostScript contours when it loads them so that
16 everything is consistent internally -- and reverses them again when it saves
17 them, of course).
18 * There may be no flipped references (this is a special case of the above, a
19 flipped reference will have its contours drawn in the wrong direction).
20 * There must be points everywhere a contour attains a local maximum or minimum,
21 horizontally or vertically. (Actually there are exceptions to this rule, for
22 small curved sections like serifs. The exception is not defined very well, and
23 FontForge makes a guess and will not report errors if the spline is small -- but
24 the actual definition of "small" is somewhat arbetrary).
25 * The coordinate offsets between adjacent points (or control points) must not be
26 greater than 32767.
27 * All opentype substitution commands must refer to real glyphs.
28 * In PostScript fonts there is a limit of 1500 points in a glyph.
29 * In PostScript fonts there is a limit of 96 hints in a glyph.
30 * In PostScript, non-cid-keyed fonts, glyph names may not be longer than 31
31 characters and may contain only "A"-"Z", "a"-"z", "0"-"9", "_" and ".". (If you
32 have the UnicodeGlyphNames preference item check, FontForge disables this check
33 because it assumes you know what you are doing and you are planning to rename
34 the glyphs before they get saved anyway).
35 * In a TrueType font, point coordinates must be integral.
36 * Missing anchor. According to the opentype spec, if a glyph contains an anchor
37 point for one anchor class in a subtable, it must contain anchor points for all
38 anchor classes in the subtable. Even it, logically, they do not apply and are
39 unnecessary.
40 * Duplicate glyph name. Two (or more) glyphs in this font have the same name. When
41 outputting a PostScript font only one of them will ever be seen.
42
43 It's a little hard to detect this in normal use, but if you change the encoding
44 to "Glyph Order", and then use :menuselection:`Edit --> Select --> Wildcard` and
45 enter the glyph name, both of them should be selected.
46 * Duplicate unicode code point. Two (or more) glyphs in this font have the code
47 point. When outputting an sfnt (TrueType/OpenType) font only one of them will
48 ever be seen.
49
50 It's a little hard to detect this in normal use, but if you change the encoding
51 to "Glyph Order", and then use Edit->Select->Wildcard and enter the code point,
52 both of them should be selected.
53 * Check that the OS/2 version number is valid.
54
55 Validating a font can take a long time. So FontForge caches the validation state
56 of each glyph (saving it to the sfd file so it is valid across invocations) and
57 will only validate those glyphs which have changed since the last validation.
58 This means that although the first validation may be slow, subsequent
59 validations will probably be very fast -- so don't be discouraged by the time it
60 takes to do this the first time.
61
62 (If, for some reason, you need to revalidate, then right clicking in the window
63 will give you a menu where "Revalidate All" is an option).
64
65 The Validation window will recheck the state of the font as you edit it. So if
66 you leave the window open you will see glyphs popping into the window and out of
67 it as you create and fix problems.
68
69 If you double click on a line in the window then FontForge will open an outline
70 glyph editing window for that glyph, and run a small version of
71 :doc:`Element->Find Problems <problems>` to help you track down exactly where in
72 the glyph the error(s) occurred.
73
74 If you right click, you will get a popup menu which has various options which
75 may fix some of the problems in the glyph. There are also options to:
76
77 * scroll the window to display the errors of a particular glyph
78 * revalidate the glyph (usually this happens when needed... but just in case
79 fontforge screws up this option is present)
80 * revalidate all glyphs (again, I hope this won't be needed -- but just in case)
81 * Select all glyphs with a particular error in the font view
82 * Try to do a batch fix of all glyphs with a particular error.
83
84 I say that these options "may" fix problems. Let me give some examples where
85 they can't.
86
87 * If a glyph contains a reference which is drawn in the wrong direction then you
88 can't fix it in the referring glyph.
89 * If a glyph contains two references which intersect one another, then Remove
90 Overlap can't fix them. You must inline the references before you can correct
91 them.
92 * The normal Add Extrema command is cautious about adding extrema which would be
93 very close to the end-points of a spline (because when you round those points to
94 integers they may end up lying right on top of the end points, or because
95 rounding the control points may cause significant distortion of the spline's
96 shape). Unfortunately these are exactly the cases which are most likely to
97 occur. So FontForge has two variants of Add Extrema, which which adds what it
98 thinks are "Good" extrema, and one which will add all extrema even if they are
99 likely to cause problems later.
100
101 When the Add Good Extrema command does not fix your problem, you may be better
102 off examining the glyph yourself and seeing if you can redesign it manually.
103
104 There is another pair of entries in the menu which sort of postpone dealing with
105 the issue. Consider the glyphs Aring, Ccedilla and Oogonek. Frequently these
106 glyphs are designed so that the accent will overlap the base letter. One would
107 like to leave the glyph as being made up of references, but one would like to
108 get rid of the overlap when the font is generated. There is a special flag in
109 :doc:`Element->Glyph Info->Unicode->Mark for Unlink, Remove Overlap before Save <charinfo>`
110 which will make fontforge unlink a glyph's references, and then run
111 Element->Remove Overlap on them just before saving them. Then after saving it
112 will reverse the operation and leave you with the original references.
113
114 So there are a pair of menu items (one for the current glyph, one for all glyphs
115 that meet certain criteria) which will set this flag for the relevant glyph(s).
116 Once this flag is set FontForge will no longer report that the glyph
117 self-intersects.