Debian Codegraph @

doc/sphinx/ui/dialogs/multiplemaster.rst

raw
1 Multiple Master Dialog
2 ======================
3
4 Allows you to create or modify a multiple master font
5
6
7 .. _multiplemaster.MM:
8
9 What is a multiple master font?
10 -------------------------------
11
12 A multiple master font is a
13 (`PostScript Type1 <http://adobe-type-tools.github.io/font-tech-notes/pdfs/5015.Type1_Supp.pdf>`__)
14 font which contains, in one font description several extreme styles of a font
15 family and code for interpolating between them to produce intermediate designs.
16 Apple has a
17 `similar concept <http://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fvar.html>`__
18 for TrueType -- The only name I've seen given to this is "Apple Distortable
19 Font" -- I call both multiple master.
20
21 A multiple master font has several axes along which variation may occur. For
22 example a font might allow variation along the Weight axis (everything from Thin
23 to Black), along the Width axis (Condensed to Extended) and along the Optical
24 Size axis (from 6pt to 72pt). The Type1 spec requires that there be a design for
25 every extreme combination along each axis. In the above example there should be:
26
27 * Thin Condensed 6pt
28 * Thin Condensed 72pt
29 * Thin Extended 6pt
30 * Thin Extended 72pt
31 * Black Condensed 6pt
32 * Black Condensed 72pt
33 * Black Extended 6pt
34 * Black Extended 72pt
35
36 A font designer may also add intermediate designs as well.
37
38 From these extreme designs PostScript is able to interpolate any intermediate
39 style desired (as Normal Normal 12pt).
40
41 Apple has a slightly different format, not only must the extreme designs be
42 specified but the default designs must be as well (so Apple requires 3 designs
43 per axis as opposed to 2 for PostScript). In the above example there would be 27
44 designs:
45
46 * Thin Condensed 6pt
47 * Thin Condensed 12pt
48 * Thin Condensed 72pt
49 * Thin 6pt
50 * Thin 12pt
51 * Thin 72pt
52 * Thin Extended 6pt
53 * Thin Extended 12pt
54 * Thin Extended 72pt
55 * Regular Condensed 6pt
56 * ...
57 * Black Extended 72pt
58
59 Apple also allows for intermediate designs, but FontForge does not currently
60 support this.
61
62 A font designer first determines how many axes s/he will need. PostScript allows
63 a maximum of 4 axes in a Type1 font. FontForge only supports 4 axes for Apple's
64 fonts too.
65
66 Then s/he provides information about each axis, specifically:
67
68 * The axis type (Weight, Width, Optical Size, etc)
69 * The range of design values over which this axis will vary
70
71 Typically 1-999 for Weight and Width (1 being extremely thin or condensed, 999
72 being extremely black or extended) or 6-72 for Optical Size
73
74 Apple fonts seem to have a different default range, .05-2.0
75 * A mapping from the design value range to the range [0 1] called the normalized
76 range. (Apple maps to [-1,1] with the default design mapped to 0)
77
78 This mapping is piecewise linear. Generally it will just be the obvious (1=>0.0,
79 999=>1.0) but it is possible to add intermediate points so that 500=>.3 which
80 would give a different scaling between 1&500 than between 500&999.
81 * In an apple distortable font, each axis must be given a name which may be
82 translated into multiple languages.
83
84 Then s/he determines the number of designs needed. In a Type1 font there may be
85 at most 16, and at least 2^axis-count. So in a 3 axis font there must be at
86 least 8 designs, one for each extreme.
87
88 For Type1 fonts s/he needs to write two postscript functions
89
90 .. object:: NormalizeDesignVector
91
92 FontForge is always able to generate this function for the user (unless the
93 user wants something non-linear). This maps a vector of design values to
94 their normalized values (in our three axis case above it might map [400 500
95 12] to [.4 .5 .09])
96
97 .. object:: ConvertDesignVector
98
99 In the usual cases FontForge is able to create this function for the user
100 (but in more complicated cases, with intermediate designs it is unable to do
101 so). This function takes a normalized vector (as produced above) and figures
102 out how much each weight to give each design in the final blend.
103
104 Finally s/he provides a default vector of design weights (one for each design).
105 This will be used when the multiple master font is used without any additional
106 information being provided. It should describe the normal variant of the font.
107 The sum of all the weights must be 1.0. In the above example, if we take [400
108 500 12] as our definition of "normal" this vector might look like: [.273 .027
109 .273 .027 .182 .018 .182 .018].
110
111 Apple distortable fonts do not need the postscript functions, nor the default
112 weight vector mentioned above. Instead they need a set of named styles which map
113 a particular coordinate in design space to a name (which may be provided in
114 several languages).
115
116 Corresponding glyphs in each design must have certain similarities:
117
118 * There must be the same number of contours (or references)
119 * There must be the same number of points on each contour
120 * Corresponding contours must be oriented in the same direction
121 * In a Type1 fonts there must be corresponding hints, and hint substitution
122 points.
123 * In a TrueType font corresponding glyphs share the same instructions (and 'fpgm'
124 and 'prep' tables), but may have different 'cvt ' tables.
125
126
127 The Dialog
128 ----------
129
130 This dialog is used for creating and modifying multiple master fonts. It
131 contains several sub-dialogs which must be processed in sequence, and follows
132 pretty closely to the process described above. I will first show the sequence
133 for Adobe's fonts, and then explain Apple's fonts.
134
135 .. figure:: /images/mmcounts.png
136
137 The first screen allows you to choose the type of distortable font you wish to
138 generate (Adobe Multiple Master, or Apple), the number of axes in your font, and
139 the number of master designs, and a family name (which will be used for creating
140 new fonts, if you need any new ones).
141
142
143 .. figure:: /images/mmaxes.png
144
145 The second screen gives you control of each axis. There are a few standard axis
146 types defined by Adobe (and by Apple), but you could define your own. Note that
147 there are fields which are disabled here, they only apply to Apple's fonts.
148
149 .. figure:: /images/mmdesigns.png
150
151 Then you must assign a font to each of the master designs. You can either have
152 FontForge create a new font for you (as here), or use an already loaded font, or
153 browse your disk for a font (don't try to use the same font twice).
154
155 You must also specify the coordinates of this design along the axes. If you use
156 the minimum number of designs they will all be extremes and the coordinate
157 values will be either 0 or 1. Unless you are working with intermediate designs
158 it is best to let FontForge initialize this field for you.
159
160 .. figure:: /images/mmfuncs.png
161
162 This screen shows the postscript functions needed to map a design vector to a
163 weight vector (ie. given positions on each of the design axes, these produce
164 blending coefficients for each master design). In most useful case FontForge is
165 able to generate these functions automatically, but if you use intermediate
166 designs things get too complicated for FontForge and you must enter the
167 functions manually.
168
169 .. figure:: /images/mmfinal.png
170
171 The last screen shows the default weights (which you may either enter directly
172 or as coordinates along the design axes), the ForceBoldThreshold private
173 dictionary entry).
174
175
176 An Apple distortable font.
177 ^^^^^^^^^^^^^^^^^^^^^^^^^^
178
179 .. figure:: /images/mmappleaxes.png
180
181 The dialog looks very similar, but there are a few differences. In the Axis pane
182 of the dlg, you must also specify a default value for the axis, and a
183 translatable name.
184
185 .. figure:: /images/mmnamedstyles.png
186
187 Apple allows coordinates in design space to be named. Here the name "Black" is
188 given to the location where Weight=3.2 (the darkest value) and
189
190 .. figure:: /images/mmnamingastyle.png
191
192 Width=1 (the default value). Again these names can be translated into multiple
193 languages.
194
195
196 A suggestion
197 ------------
198
199 Adobe's Type1 fonts require all the extreme designs to be specified, so that for
200 a 3 axis multiple master font, you need 8 designs. This is because Adobe only
201 seems to expect interpolation to be used. On the other hand in many cases
202 extrapolation can be used to generate some of these designs. In the 3 axis case
203 you only need to produces 4 designs (one for the base, and one each to express
204 the variation on each axis).
205
206 I will describe the 2 axis case in detail (because it is easier to visualize):
207 Suppose you have a font which varies on the Weight axis from 50 to 900, and on
208 the Width axis from 100 to 1000. And suppose you have created fonts for
209 Weight=50,Width=100 & Weight=50, Width=100 & Weight=900,Width=100. Call these
210 designs 0, 1 and 2. We wish to produce a design, 3, with Weight=900, Width=1000.
211
212 .. image:: /images/mmextrapolate2.png
213
214 First we must produce an intermediate design (which we will delete later), call
215 it "I". Use FontForge's :menuselection:`Element --> Interpolate Fonts` command
216 to produce a design which is 50% of the way from design 1 to design 2 (This will
217 be Weight=475, Width=550). Then produce another design with is 200% of the way
218 from design 0 to design "I". This will be the desired extreme design.
219
220 Adobe's Type2 designs appear to have been prepared to allow this approach, but
221 the multiple master operators were dropped from the Type2 spec, and the question
222 is moot.