Debian Codegraph @

doc/sphinx/ui/dialogs/multilayer.rst

raw
1 Multi Layered Editing of Type3 and SVG fonts
2 ============================================
3
4 When loading a type3 font (or an svg font organized in a similar fashion)
5 FontForge will retain information on each stroke and fill command. Each command
6 is placed in a separate layer and may be edited in isolation.
7
8 A new font may be converted to a multi-layered font by navigating to
9 :menuselection:`Element --> Font Info --> Layers`, then setting the splines
10 option to **All layers cubic** and the font type option to **Type3 Multi Layered
11 Font**.
12
13
14 Multi Layered editing in the outline view
15 -----------------------------------------
16
17 .. image:: /images/charview-multilayer.png
18 :align: right
19
20 In the image at left we have a glyph drawn by stroking two paths. One layer
21 (containing one of the paths) is currently selected and is drawn in full. All
22 its points are editable. The other layer is shown as a dashed line.
23
24 The Layer palette looks a little different here. There is no hinting information
25 (hints are irrelevant in type3 fonts), instead there are two named layers
26 (background and grid) which behave pretty much as they
27 :doc:`normally </ui/mainviews/charview>` do. They may be made active by clicking on their
28 names. They may be made invisible by turning off the check box associated with
29 them.
30
31 Under these two are the layers that make up the glyph in the font. Each layer is
32 identified by a small picture of what that layer looks like when rasterized.
33 Clicking on the layer makes it editable.
34
35 The layers are ordered in the list as they will be drawn on the screen. The
36 topmost layer is drawn first, the bottommost is drawn last. Regions drawn
37 earlier will be overwritten by Regions drawn later.
38
39 Double clicking on a layer brings up the
40 :ref:`Layer Info dialog <multilayer.Layer>`.
41
42 Clicking with the right button brings up the layer menu which contains:
43
44 .. object:: Layer Info...
45
46 Brings up the :ref:`Layer Info <multilayer.Layer>` dialog on the current
47 layer (same as double clicking)
48
49 .. object:: New Layer...
50
51 Creates a new layer and brings up the :ref:`Layer Info <multilayer.Layer>`
52 dialog to describe it. (the new layer will appear at the bottom of the layer
53 list and will be drawn last)
54
55 .. object:: Del Layer
56
57 Deletes the current layer (you may not delete the last layer in a glyph)
58
59 .. object:: First
60
61 Make the current layer the first one to be drawn.
62
63 .. object:: Earlier
64
65 Make the current layer be drawn earlier. (swaps it with the layer above it)
66
67 .. object:: Later
68
69 Makes the current layer be drawn later. (swaps it with the layer below it)
70
71 .. object:: Last
72
73 Makes the current layer be drawn last.
74
75
76 Images
77 ^^^^^^
78
79 Images are allowed in Type3 fonts. You can use the
80 :ref:`File->Import <filemenu.Import>` command to load an image into any of the
81 foreground layers. If the image is a bitmap image and the layer will be filled,
82 then it will be output with an imagemask command in PostScript (the bitmap will
83 be drawn with the fill color), otherwise (and always in SVG) the image will be
84 drawn with the colors specified in the image (Transparent images are not
85 supported here).
86
87 FontForge will not skew, flip or rotate images.
88
89
90 .. _multilayer.ClipPath:
91
92 Clipping Path
93 ^^^^^^^^^^^^^
94
95 Each layer in a Type 3 font may have its own clipping path. A clipping path is a
96 contour (or set of contours) and only things inside the clipping path will be
97 drawn.
98
99 .. image:: /images/ClippedA.png
100
101 .. image:: /images/ClippedARaster.png
102
103 The above example shows the letter "A" drawn with a clipping path that looks
104 like a star burst (the clipping path is drawn in blue). To the right above is
105 the result of rasterizing this image. The star is not drawn itself, but only the
106 region of the A within the star will be drawn.
107
108 You can change the clipping path with the
109 :ref:`Points->Make Clip Path <pointmenu.ClipPath>` command. The clipping path
110 will be set to any selected contour(s) in the image. If no contour is selected
111 then there will be no clipping path.
112
113
114 .. _multilayer.Layer:
115
116 The Layer Info dialog
117 ---------------------
118
119 .. image:: /images/layerdlg.png
120 :align: right
121
122 This dialog describes various attributes of the way the splines (or images) in
123 the current layer are drawn.
124
125 A layer may be either stroked or filled. Or both. Or neither (layers containing
126 only images need not be filled or stroked).
127
128 You may either specify a color to be used for stroking or filling the splines in
129 the layer, or you may specify that the color should be inherited (in
130 conventional fonts the color will be inherited so that the font user can specify
131 the font's color). If you do want to specify a color, you can press the color
132 wheel button to get a color picker dialog, or enter a 6 hex-digit rgb value
133 "#rrggbb".
134
135 SVG fonts may include an opacity level (postscript type3 fonts may not). 0 is
136 fully transparent, 1.0 is fully opaque, .5 is translucent. Again this value may
137 be inherited from the environment.
138
139 A stroke has a width (which again may be inherited, but probably should not be).
140 Strokes are drawn using a circular pen. An elliptical pen may be specified by
141 giving a transformation matrix here.
142
143 A line may be dashed. Dash patterns are specified as a list of numbers, the
144 first number in the list will draw a line segment at most that many em-units,
145 the next number will skip that many em-units, the third will be drawn, and so
146 on. After then entire list has been used, it will start again at the beginning.
147 If the list has an odd number of elements, then this time through the first
148 entry indicates that many units should be skipped. So "10" would mean a line
149 which alternates being drawn every 10 units, while "20 10" would draw 20 units,
150 skip 10, draw 20 and so on.
151
152 A stroke needs to know how to treat the ends of paths (``Line Cap``), and how to
153 join non-tangent path-segments (``Line Join``).
154
155 In an additional level of complexity a contour need not be filled (or stroked)
156 with a constant color, you can provide a repeating pattern, or a gradual change
157 from one color to another (a gradient).
158
159
160 Gradients
161 ^^^^^^^^^
162
163 .. image:: /images/GradientDlg.png
164 :align: right
165
166 FontForge supports two kinds of gradients, linear gradients and radial
167 gradients. In a linear gradient the color changes along a line (as in the
168 example at right, and below)
169
170 .. image:: /images/LinearGradient.png
171
172 You can specify the color at any point along the gradient line (as a percentage
173 of the distance along that line). The example at left only specifies a color
174 (white) at the start of the line, and a color (grey) at the end, but
175 intermediate values could be inserted, and a full range of RGB colors may be
176 used.
177
178 A Radial gradient specifies a center point and a final radius, the start
179 position (and color) is the center point and colors change in concentric circles
180 until the final radius (and final color) is attained.
181
182 .. flex-grid::
183
184 * - .. image:: /images/RadialGradient.png
185 - .. image:: /images/RadialGradientDlg.png
186
187
188 .. _multilayer.Patterns:
189
190 Patterns
191 ^^^^^^^^
192
193 .. image:: /images/TilePatternDlg.png
194 :align: right
195
196 A contour may also be filled or stroked with a tiled pattern. That is a pattern
197 is repeatedly layed down until it covers the entire area to be filled.
198
199 .. image:: /images/TiledPattern.png
200
201 In the example above the tile
202
203 .. image:: /images/Tile.png
204
205 has been scaled and replicated. The example at right is a bit more complex. Not
206 only is the pattern replicated, but after that it is rotated through 45 degrees
207
208 .. image:: /images/TiledPattern45.png
209
210 The pattern is defined in another glyph in the same font. By default the
211 bounding box of that glyph will be used to describe the pattern's extent (You
212 may change change that with
213 :ref:`Element->Glyph Info->Tile Size <charinfo.TileSize>`). You may then scale
214 it by specifying the Width and Height fields. You may apply other
215 transformations as described in the dialog.
216
217 FontForge's rasterization leaves much to be desired. It does not support full
218 color (rounding everything to a shade of grey), and its stroking algorithm is
219 quite poor (it does not rasterize dashes), it does not support the full
220 complexity of radial gradients...