Debian Codegraph @

doc/sphinx/techref/accented.rst

raw
1 Building Accented and other Composite Glyphs
2 ============================================
3
4 You can use the :menuselection:`Element --> Build --> Build Accented Glyph`
5 command to build up accented glyphs. Or you can use
6 :menuselection:`Element --> Build --> Build Composite` and build slightly more
7 general composite glyphs (ligatures and so forth). The accented version will not
8 create ligatures and will not replace Alpha with A. The composite version will
9 do both these things. My assumption is that ligatures (like the "fi" ligature)
10 usually need a bit of work on the user's part to get them to look good, in the
11 case of "fi" the dot on the "i" needs to be fused into the hook of the "f", and
12 if you are careless with the command you might destroy your work inadvertently.
13
14 What can be built?
15
16 * Unicode specifies various normative glyph decompositions. So "Aacute" is defined
17 to be an "A" with an "acute" accent centered on top. Any of these can be built
18 (though if the glyph contains no accents it will need to be built with the build
19 composite command).
20
21 Sometimes Unicode's normative definition is not as informative as it might be
22 (many of the greek accents are "unified" with latin accents that they don't
23 really look like, the result is that following Unicode slavishly will yield the
24 wrong glyph). So in some cases FontForge will use a slightly different set of
25 glyphs than the normative decomposition.
26
27 This includes:
28
29 * Latin accented characters
30 * Latin ligatures (ae, oe, fi, fl, etc)
31 * Greek accented characters
32 * Cyrillic accented characters
33 * Hebrew ligatures
34 * Arabic ligatures
35 * Fractions, digits inside parens, roman numerals, etc.
36 * The predefined Hangul characters (0xac00-0xdfaf)
37 * Many of the Korean Jamo are actually ligatures of other Jamo (ssangkiyoeok
38 (0x1101) is composed of two kiyoeok (0x1100)). For some reason this information
39 is not normative unicode, but FontForge is aware of it anyway and will build
40 those glyphs if you ask it to.
41 * The glyphs "i" and "j" can be built by adding a dot accent to the dotlessi and
42 dotlessj glyphs
43 * The dotlessi and dotlessj glyphs can be built by removing the dot from an "i" or
44 "j" glyph
45 * If a glyph name has an extension, as "agrave.sc", then it will be built out of
46 the same components as "agrave", except FontForge will use the variants of those
47 components named with the same extension. So "agrave.sc" would be built out of
48 "a.sc" and "grave.sc". If the accent variant does not exist then FontForge will
49 also try the bare accent "grave".
50 * FontForge knows a few other things. It knows that Greek "Alpha" and Cyrillic A
51 both look like the Latin "A" and will replace either if you ask. (as well as all
52 the other similar glyphs in latin, greek, cyrillic, cherokee, etc.)
53 * Some glyphs are just extremely simple to build. There are a whole slew of glyphs
54 which correspond to zero-width spaces. FontForge will build any of them. More
55 usefully it will build any of the fixed size spaces 0x2000-0x200f, and the fixed
56 sized rules 0x2010-0x2015).
57 * You may use the :menuselection:`Element --> Char Info` dialog to define a
58 ligature yourself, and FontForge will build it for you.
59 * In Adobe's CID glyph sets there are some pre-rotated versions of latin glyphs.
60 When CJK text is written vertically the convention is that any text in western
61 alphabets should be displayed rotated 90º clockwise. If you apply Build Accented
62 Glyph to one of these slots it will find the appropriate latin letter and rotate
63 it properly.
64
65 If a glyph's name is "vertcid_<cid>" where <cid> is a decimal number, then it is
66 assumed to be a vertically rotated version of the glyph at <cid>. In
67 non-cid-keyed fonts, if a glyph's name is "vertuni<uni>" where <uni> is a four
68 digit hex number, then it is assumed to be a vertically rotated version of that
69 unicode glyph.
70
71 So for each selected glyph in the font view (or for the current glyph in the
72 outline view), and if all the base glyphs and accents needed by the glyph have
73 already been created then this command will delete anything that is in the
74 current layerand put a reference to the base glyph and another reference to the
75 accent glyph into the foreground. So if the current glyph were "À" then a
76 reference to "A" would be added to it, and a reference to
77
78 If :ref:`Copy From <editmenu.From>` is set to All Fonts then any bitmaps will
79 have a similar process done -- that is to say, bitmap references will be created
80 (even in the outline glyph view).
81
82 Choosing accents can be a slightly tricky process. Unicode says that accented
83 letters are logically built out of the accents in the range 0x300-0x340, but
84 this does not work too well in postscript. A Type1 font works better if the
85 accented glyph is in the Adobe Standard Encoding, which means either using
86 accents around 0x2d0 or ascii glyphs. FontForge will first attempt to find an
87 accent around 0x2d0, then in ascii and finally in the 0x300-0x340 range. Even
88 worse, Unicode unifies the greek and latin accents, so for greek letters
89 FontForge will look for accents around 0x1fbd (FontForge will also require the
90 presence of the double accents like 0x1fdd).
91
92 Some of Adobe's fonts have accents designed for use over upper case letters (the
93 nomal accents are designed for lower case), and accents designed for use over
94 cyrillic letters. So in such a font, if you attempt to build "Agrave" FontForge
95 will build it out of "A" and "Grave" (or "grave.cap", not the standard "grave").
96
97 Not all accents should be centered above the base glyph, a cedilla is (usually)
98 centered underneath the base, while other accents need to be placed to the left
99 or right, or even overstruck. FontForge should know about proper placement of
100 most accents (or at least a rough approximation thereto).
101
102 Some Unicode glyphs contain more than one accent. Additional accents will be
103 treated similarly. This command can also be used to generate more general
104 composite glyphs .
105
106 Some accents (for example cedilla) are treated unexpectedly on certain letters
107 (different ways in different languages), so be careful of g-cedilla. Å often
108 merges the ring into the top of the A, but here it will float above it. **Be
109 alert**.
110
111 Placing an accent above a glyph is surprisingly tricky. Centered accents (like
112 grave, acute, etc.) should not really be placed in the exact center of the
113 glyph. For instance when placing an acute accent on top of an "a" the accent
114 should actually go above the highest part of the "a" which is almost but not
115 quite in the center of the glyph. And when placing an acute on top of a "k" (a
116 rare combination, but still used) the accent is centered on the stem of the "k".
117 Greek accents are even more baroque. FontForge knows many oddities of accent
118 placement, but it will never know all of them (some letters have multiple forms
119 depending on the font, or perhaps on the humidity and phase of the moon).
120
121 .. list-table::
122
123 * - .. figure:: /images/acenter.png
124
125 Center point of the glyph
126 - .. figure:: /images/ahighest.png
127
128 Highest point of the glyph
129
130 And how accents are centered depends on the accents themselves. Usually
131 FontForge will try to center an accent so that the accent's center is over the
132 base glyph's "center". But that doesn't always work either. The grave and acute
133 accents are usually (but not always) centered only on the bottom part of the
134 glyph.
135
136 .. list-table::
137
138 * - .. figure:: /images/aacutemid.png
139
140 Midpoint of accent
141 - .. figure:: /images/aacutebase.png
142
143 Centered on base of accent
144
145 FontForge gives you a minuscule amount of control over where it puts accents.
146 There are two preference items you can set
147 (:ref:`File->Preferences <filemenu.prefs>`)
148
149 * AccentOffsetPercent -- This allows you to control the amount of space between
150 the top of the letter and the bottom of the accent (or the bottom of the letter
151 and the top of the accent for accents that sink under their letters). This is
152 expressed as a percentage of the em size and defaults to 6%. (In some cases
153 there will be a little bit more space above the accent than that. All the
154 accents from all the lower case letters should be at the same height, but the
155 letter "o" is usually slightly higher than the letter "u". So all the lower case
156 accents will be placed at the appropriate height for "o", even those over "u". A
157 similar trick is done for upper case letters).
158 * AcuteCenterBottom -- This controls whether acute and grave (and double acute and
159 grave) accents are centered on the entire glyph, or just on the bottom.
160
161 .. note::
162
163 So FontForge is going to do something wrong. There are just too many areas
164 where I am ignorant or my taste doesn't match yours or the program has a bug.
165 I strongly recommend that you examine all your accented glyphs after building
166 them and be prepared to adjust things.
167
168 The algorithms take some account of the italicangle, but when working on an
169 italic (or oblique) font FontForge is even more likely to do something you don't
170 like.
171
172 If all else fails you can build your own accented glyphs with
173 :ref:`Edit->Copy Reference <editmenu.Reference>` and
174 :ref:`Edit->Paste <editmenu.Paste>`