Debian Codegraph @

doc/sphinx/techref/stroke.rst

raw
1 Expand Stroke Facility
2 ======================
3
4 The Expand Stroke facility traces a closed, convex contour (referred to as the
5 "nib") along a "source" contour, producing a new contour or contours that
6 enclose the area the nib "passed over". When the source contour is open the
7 result is usually a single closed contour, and when the source contour is closed
8 the result is usually two closed contours:
9
10 .. figure:: /images/stroke/typical.svg
11
12 Typical Examples
13
14 There are exceptions when the geometry of the nib and the source contour
15 interact:
16
17 .. figure:: /images/stroke/exceptional.svg
18
19 Unusual Examples
20
21 The "Expand Stroke..." dialog in the "Element" menu of a font view or outline
22 view window is the primary interactive interface for the facility. In the font
23 view it traces all foreground contours in all selected glyphs. In the outline
24 view it traces all contours with at least one point selected, or every contour
25 if no points are selected on any contour. The dialog looks like this:
26
27 .. figure:: /images/stroke/dialog_1x.png
28 :alt: Expand Stroke Dialog
29
30 The :ref:`Freehand Tool <charview.freehand>` also uses the facility and has a
31 similar dialog, and there are interfaces for both
32 :py:meth:`Python <fontforge.glyph.stroke>` and
33 :ff:func:`FontForge's native scripting language <ExpandStroke>`.
34
35 This guide is arranged into four sections. The :ref:`first <stroke.offsetting>`
36 discusses the common case of tracing a circular nib, which is also called
37 "offsetting". It includes a description of the ":ref:`cap <stroke.cap>`" and
38 ":ref:`join <stroke.join>`" options for offset curves.
39
40 The :ref:`second section <stroke.nibs>` introduces the other nibs types: the
41 rectangular "calligraphic" nibs associated with some types of calligraphy,
42 elliptical nibs, and general convex nibs designed by the user. All nibs support
43 the same cap and join options listed in the first section, but some have
44 slightly different behaviors and effects.
45
46 The :ref:`third section <stroke.parameters>` discusses additional parameters
47 that address special cases, influence the geometric accuracy of the generated
48 contours, or that can aid in debugging potential problems.
49
50 The :ref:`last section <stroke.troubleshooting>` is an overview of problems a
51 user may encounter using the system and some potential work-arounds. Please read
52 this section prior to filing a GitHub issue.
53
54
55 .. _stroke.offsetting:
56
57 Offsetting
58 ----------
59
60 Tracing a contour with a circular nib of radius *r* is equivalent to
61 "offsetting"-creating parallel contours on each side at distance *r* for a total
62 line thickness of *2r* (source contour shown in green):
63
64 .. figure:: /images/stroke/offsets.svg
65
66 Offset Curves
67
68 In FontForge you specify a circular nib in the UI dialog by choosing the
69 "Circular/Elliptical" nib type and making the Major and Minor Axis lengths
70 equal. In the native and Python API a Minor Axis value of zero will be replaced
71 by the Major Axis value. And although it does not make a geometric difference,
72 the recommended Nib Angle for a Circular nib is zero.
73
74 Offsetting is a longstanding way of specifying a line of fixed thickness in
75 terms of a contour-that is, a sequence of connecting splines-combined with an
76 offset radius. The model was common in PostScript and is currently used in the
77 SVG graphics markup language. Most font formats do not support offset curves
78 directly, however, so any line specified that way must be "translated" into
79 (roughly) equivalent closed contours. This is a common use of the Expand Stroke
80 facility.
81
82 The parallel lines determined by the contour and offset radius alone will not
83 necessarily connect. They will all connect in the case of a source contour that
84 is closed and has only "smooth" points:
85
86 .. figure:: /images/stroke/offset_smooth.svg
87
88 Offsets of a smooth contour
89
90 They will not connect where the source contour is open or has "corner" points
91 where the angle changes:
92
93 .. figure:: /images/stroke/offset_other.svg
94
95 Offsets of angled and open contour
96
97
98 .. _stroke.cap:
99
100 Caps
101 ^^^^
102
103 The line that closes the gap between the offset lines traced to the end of of an
104 open source contour is called a "cap". PostScript and SVG specify three cap
105 styles that are really two styles: "Round" and "Butt"/"Square". A Round cap
106 connects the ends with a semi-circle, while a Butt cap connects them with a
107 straight line. When tracing with a circular nib the FontForge cap options "Nib"
108 and "Round" are both equivalent to PS/SVG "Round", and the options "Butt" and
109 "Bevel" are both equivalent to PS/SVG "Butt". (These options differ when used
110 with other nib shapes.)
111
112 .. figure:: /images/stroke/caps.svg
113
114 Butt and Round Caps
115
116 A PS/SVG "Square" cap is a Butt cap extended by the length of the offset radius,
117 and therefore half the width of the traced line. The FontForge "Extend Cap"
118 parameter generalizes this feature by allowing the user to specify the distance
119 between the end of the source contour and the cap line either as an absolute
120 length or in units of stroke-width. The parameter works with the "Round" and
121 "Butt" cap styles but not the "Nib" and "Bevel" styles. A PS/SVG Square cap is
122 therefore equivalent to a Butt cap with "Extend Cap" set to 0.5 in stroke-width
123 units.
124
125 .. figure:: /images/stroke/extend_cap.svg
126
127 Extend Cap Examples
128
129
130 .. _stroke.join:
131
132 Joins
133 ^^^^^
134
135 When the source contour has a "corner" point with an angle change there will be
136 one angle of less than 180 degrees and one greater than 180 degrees. The offset
137 lines on the side with the smaller angle will intersect, and the easy solution
138 is to trim off the parts of the line past the intersection:
139
140 .. figure:: /images/stroke/join_trimmed.svg
141
142 Offset Trimmed At Join
143
144 The offset lines at the larger "reflex" angle do not meet. The line closing the
145 gap between those is called a "join". PostScript specified three join styles:
146 "Round", "Bevel" and "Miter". SVG 2.0 adds styles "Miter Clip" and "Arcs".
147 FontForge currently supports the six styles "Nib", "Bevel", "Round", "Miter",
148 "Miter Clip", and "Arcs".
149
150 A PS/SVG "Bevel" join connects the two offset curves with a straight line, and
151 this is also what FontForge's "Bevel" option does. A PS/SVG "Miter" or SVG
152 "Miter Clip" join (normally) extends each offset curve with a straight line
153 tangent to the curve at the endpoint to where each intersects, as do FontForge's
154 equivalent "Miter" and "Miter Clip" options. A FontForge "Nib" join connects the
155 offset curves with an edge corresponding to the shape of the nib; when using a
156 round nib this is equivalent to the PS/SVG "Round" join option, which connects
157 the offset lines with an arc of the offset radius. FontForge's "Round" join
158 option is also equivalent when using a circular nib:
159
160 .. figure:: /images/stroke/joins.svg
161
162 Join Examples
163
164 The difference between Miter and Miter Clip is in how "long" joins are handled.
165 The "Join Limit" parameter specifies the maximum "length" of a miter join. This
166 limit can be specified either in em-units or (when the nib is circular)
167 nib-widths (e.g. the diameter of the circle). The term "join length" is a bit
168 misleading because the limit is actually calculated based on the angle of the
169 join, and the "length" is how long the join *would* be if the offset curves were
170 straight lines. There is a more complete explanation in the
171 `stroke-miterlimit" section of the SVG specification <https://www.w3.org/TR/SVG2/painting.html#LineJoin>`__.
172 With the Miter style a join that exceeds the join limit "falls back" to a Bevel
173 join, while with the Miter Clip such a join is clipped at the join limit by a
174 line parallel to the Bevel line:
175
176 .. figure:: /images/stroke/miters.svg
177
178 Miter and Miter Clip
179
180 Note, however, that the term "limit" is also somewhat misleading, in that a
181 Miter join is *never* shortened past the Bevel line, which therefore restricts
182 the minimum length of a given join.
183
184 Like Miter Clip, the "Arcs" join style matches the position and tangent angles
185 at each offset curve endpoint, but the curve is extended with a circular arc of
186 matching curvature rather than a line. (In some cases the curvature of the
187 extensions must be adjusted to ensure they intersect, in which case the
188 curvatures at the endpoints will not be continuous.) This style is based on the
189 SVG 2 join of the same name and should have close to the same geometry when used
190 with a circular nib. (Arcs joins are not yet widely supported in browsers or
191 other SVG tools and there are some ambiguities in the specification.)
192
193 Note that Arcs joins exceeding the Join Limit are clipped in a way similar to
194 those of the Miter Clip style.
195
196
197 .. _stroke.nibs:
198
199 Calligraphic and Other Convex Nibs
200 ----------------------------------
201
202 In addition to circular nibs the Expand Stroke facility also has parameterized
203 support for "Calligraphic" (rectangular) and Elliptical nibs. These nibs are
204 described by Width and Height (called the Major and Minor Axes in the case of an
205 ellipse) and a rotation Angle:
206
207 .. figure:: /images/stroke/paramnibs.svg
208
209 Calligraphic and Elliptical Nibs
210
211
212 General convex nibs
213 ^^^^^^^^^^^^^^^^^^^
214
215 In contrast with the parameterized nibs, the shape of a Convex nib is specified
216 as a contour which can be edited interactively in the area at the top of the
217 dialog, created elsewhere and then pasted into that area, or set via the Python
218 API. As the name implies the shape enclosed by the contour must be *convex*.
219 Formally, a shape is convex when the line between any two points on the edge of
220 or inside the shape does not pass through any points *not* inside the shape (or,
221 if both points are chosen from the same linear edge, only passes through points
222 also on that edge). Less formally, a shape is convex when no edges are concave
223 or "indented".
224
225 While these definitions may help, it is probably more useful to focus on the
226 specific rules used by the facility to verify that a contour is convex. These
227 rules are slightly conservative, in that some geometrically convex contours fail
228 to meet them. (Such cases are rare in practice, and can anyway often be
229 "repaired" by adding some points without (visibly) changing the shape.)
230
231 Note: These rules are defined in relation to a cubic contour. Although you can
232 design a nib as a quadratic contour, you must switch the layer to "Cubic" before
233 applying Expand Stroke. (Or, in the API, you must convert the contour or layer
234 prior to calling the ``stroke`` method or ``ExpandStroke`` function.) In
235 contrast, when using a Spiro nib on a Cubic layer it is not necessary to switch
236 into Bezier mode. However, it can still be a good idea to do so to better
237 understand any reported errors.
238
239 There are actually two groups of rules. The first group restrict the relative
240 positions of *on-curve* points. The points must be arranged as a *convex
241 polygon*, which is a non-self-intersecting (i.e. "simple") polygon of at least 3
242 points/edges, where all interior angles at the points are less than 180 degrees.
243 These points must be in the form of a closed, *clockwise* contour:
244
245 .. figure:: /images/stroke/convexpoly.svg
246
247 Convex Polygons and Exceptions
248
249 The second group of rules restrict the relative positions of the control points:
250
251 #. Each spline must either be a line with *no control points*, or have two control
252 points positioned outside of the convex polygon. That means they can not be
253 either inside the polygon or on the edge of the polygon.
254 #. The angle between the on-curve line and the control point line is limited by the
255 angle to that point's other control point. Or, if the adjacent "edge" is a line,
256 the angle to the next on-curve point.
257 #. The control point *line segment* must not intersect the spline's other control
258 point *line*.
259
260 These three rules typically define a triangle (with one excluded edge) where one
261 control point can be positioned given the positions of the other points:
262
263 .. figure:: /images/stroke/convexcontrol.svg
264
265 Control Point Rules for Convex Shapes
266
267 Aside from the shape, the position of a convex nib relative to the origin has an
268 effect on the output. Parameterized nibs are always centered on the origin,
269 which leaves the output in the "same place" as the source contour. A nib offset
270 from the origin will cause the output to be offset by that amount:
271
272 .. figure:: /images/stroke/uncentered.svg
273
274 Centered and Uncentered Convex Nib Output
275
276
277 Caps and Joins With Other Nibs
278 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279
280 Earlier versions of FontForge only provided cap and join options for circular
281 and elliptical nibs (and some of the latter were misleadingly named). For other
282 nibs it automatically closed the cap and join edges with the nib
283 shape-equivalent to the current "Nib" cap and join styles. Given that the Nib
284 options produce the shape that would be created by inking and tracing the nib on
285 paper, "Nib" is a good default choice:
286
287 .. figure:: /images/stroke/nibnib.svg
288
289 Calligraphic nib with Nib Cap and Join
290
291 The other cap and join options now also work with all nibs. Although some
292 "behave" differently with different nib geometries, in general you can choose a
293 style based on how it looks when used with a circular nib. The rest of this
294 section describes some differences from the "circular case".
295
296 When tracing with a circular nib, the angles ends of the offset curves at a join
297 are always perpendicular to the line from source contour point. This is not true
298 for other nibs. The difference lead to unexpected results with Bevel and clipped
299 Miter Clip joins, although both are constructed according to the same rules.
300
301 .. figure:: /images/stroke/customjoinbevel.svg
302
303 Join Bevel Angle of Custom Nib
304
305 For similar reasons it is often impossible to close an arbitrary join with a
306 smooth circular arc. When the Round join is specified in such cases FontForge
307 will instead choose the smooth arc of the least eccentric compatible ellipse
308 (which might still be noticeably eccentric).
309
310 .. figure:: /images/stroke/customround.svg
311
312 Round Join of Custom Nib
313
314 No matter what nib you use, at the end of any open contour the tangent angle of
315 the left and right lines will be the same as the tangent angle of the end of the
316 source contour. However, the *length* of these lines will vary. With a circular
317 nib a Bevel Cap is the same as a Butt Cap; with other nibs the Bevel angle
318 differs and the Bevel will often not touch the end of the traced contour. (The
319 Bevel cap option just draws a line between the ends of the two trace lines. This
320 option is an :ref:`unusual choice <stroke.bevelcaps>` for a final cap style but
321 may be useful to see where the trace lines end in a given case or as the
322 simplest option for later editing stages.)
323
324 .. figure:: /images/stroke/customcapbevel.svg
325
326 Cap Angle of Custom Nib
327
328 FontForge will not trim a trace line to make a Butt or Round cap; instead it
329 extends one of the lines to match the other. This means that Butt and Round caps
330 often extend past the end of the source contour, with a distance that depends on
331 the nib shape and the cap angle. If this is a problem the Extend Cap option
332 provides one easy solution: The extension length is always measured from the end
333 of the source contour, so higher values will tend to even out the lengths. At
334 some value-the particular amount depends on the nib and the source contours-all
335 cap distances will be the same.
336
337 .. figure:: /images/stroke/extendcapfix.svg
338
339 Standardizing Cap Length with Extend Cap
340
341 With a circular nib the em-unit and nib-span ways of specifying a Join Limit or
342 Extend Cap length are basically equivalent: for every value expressed one way
343 there is a value expressed the other way that has the same effect. With other
344 nibs the width of the curve varies by angle, breaking this equivalence. In the
345 case of Extend Cap, the cap width is defined as the span of the nib at the end
346 angle-that is, the width of the nib when it is rotated by that angle. For Join
347 Limit the "Nib Span" is defined-somewhat artificially-as the average of the nib
348 spans at the starting and ending angles of the join. The result is that when
349 using Width/Span-relative values the result will tend to scale with the stroke
350 width at the join or cap.
351
352 .. figure:: /images/stroke/extendcapdiff.svg
353
354 Relative and Length-based Extend Cap with Custom Nibs
355
356 Unclipped, the Arcs join style should work the same way for other nibs as it
357 does with circular nibs. However, with shorter Join Limits (less than 4 in
358 relative units) and more oblong nibs the SVG 2 clipping algorithm may fail. The
359 :ref:`Arcs Clip Parameter <stroke.arcsclip>` section has more information.
360
361
362 Multi-Nibs and "Pseudo-Concavity"
363 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
364
365 Although a nib will typically consist of a single convex contour, the nib
366 ``foreground`` layer can contain multiple contours as long as each conforms to
367 the shape rules. Each source contour will be traced with each nib contour and
368 then combined.
369
370 Because the nib contours can overlap, you can simulate a concave nib by
371 splitting the shape into convex sub-shapes and putting each in its own contour.
372 When doing this it is best if the contours actually overlap where they meet
373 rather than just "touch".
374
375
376 .. _stroke.parameters:
377
378 Other Parameters
379 ----------------
380
381 The remaining Expand Stroke parameters have default values that work well for
382 most cases, but you may need or want to change them in more unusual cases or
383 when you encounter problems.
384
385
386 Accuracy Target
387 ^^^^^^^^^^^^^^^
388
389 The "Accuracy Target" is specified in em-units and influences the geometric
390 accuracy of the output. The algorithms generally "try" to be at least as
391 accurate as the target but there can be exceptions. The default of 0.25 is a
392 reasonable choice even you plan to round-to-integer later, although a value of 1
393 or even higher may well depending on your needs. Given that the Expand Stroke
394 algorithms are generally fast, the benefit of lower accuracy is not speed but
395 fewer points/splines in the output.
396
397 .. figure:: /images/stroke/accuracytarget.svg
398
399 Outputs with Different Accuracy Targets
400
401
402 Remove Overlap
403 ^^^^^^^^^^^^^^
404
405 The core algorithm of Expand Stroke calculates the "generalized offset curves"
406 of the source contour and the nib. Its output can therefore include
407 :ref:`"cusps" <stroke.cusps>` and other artifacts of offsetting. These are
408 typically removed by passing the initial output through the Remove Overlap
409 algorithm. By default Remove Overlap is run on the whole layer, but you can also
410 choose to run it independently on the output of each source contour.
411
412 The third option is to skip the Remove Overlap pass entirely. This option is
413 provided mostly for debugging purposes. In rare cases the Remove Overlap
414 algorithm may fail or produce inaccurate results. If you run into problems it
415 can therefore be helpful to "undo" and run Expand Stroke again without Remove
416 Overlap to see what the problem might be. (And you may be able to fix the
417 problem area by hand and then run Remove Overlap on the rest, and get your
418 output without having to wait for a software fix.)
419
420 .. figure:: /images/stroke/removeoverlap.svg
421
422 Outputs with Different Remove Overlap Settings
423
424
425 External Only and Internal Only
426 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
427
428 As noted above a closed source contour will typically yield a larger contour
429 enclosing a smaller one. The External Only and Internal Only options allow the
430 user to choose one of the two contours produced in this way. However, the
431 options names are somewhat misleading. They are accurate in the case of a
432 *clockwise source* contour: when External Only is chosen only the larger, outer,
433 clockwise contour is returned while when Internal Only is chosen only the
434 smaller, inner, counterclockwise contour is returned. When tracing a
435 *counterclockwise source* contour, however, the two options have the opposite
436 effect.
437
438 As a result, when offsetting a typical "o" (for example), choosing External Only
439 will keep the larger clockwise counterpart of the glyph's larger clockwise
440 contour and the smaller counterclockwise counterpart of the glyph's smaller
441 counterclockwise contour. This increases the "weight" of the character by
442 *2r*-the diameter of the nib. Choosing Internal Only analogously decreases the
443 weight by *2r*, assuming it is thicker than that at all points. (FontForge's
444 Change Weight facility uses Expand Stroke with these options.)
445
446 .. figure:: /images/stroke/intext.svg
447
448 Example of External Only and External Only
449
450
451 Add Extrema and Simplify
452 ^^^^^^^^^^^^^^^^^^^^^^^^
453
454 It is normally desirable to avoid mid-spline extrema and to remove unneeded
455 on-curve points and (in the case of straight lines) unneeded control points.
456 Therefore Expand Stroke normally runs FontForge's Add Extrema and Simplify
457 algorithms on its output (in that order). You can change this behavior by
458 changing these options. One reason to do this is if you prefer a different
459 choice of Simplify parameters. Expand Stroke uses the Accuracy Target as the
460 Simplify error parameter, but the other parameters are hard-coded and may change
461 over time.
462
463
464 .. _stroke.arcsclip:
465
466 Arcs Clip Algorithm
467 ^^^^^^^^^^^^^^^^^^^
468
469 The SVG 2 specification clips an Arcs join perpendicular to a circle through the
470 source contour knot (where the angle changes, requiring the join) and the
471 intersection of the arcs. This approach works well for roughly-round nibs at any
472 Join Limit and for any nibs at longer Join Limits. Unfortunately it can produce
473 poor or nonsensical results for oblong nibs at shorter Join Limits. To handle
474 such cases FontForge includes an alternate "Ratio" Arcs join clipping algorithm.
475
476 The default "Auto" setting uses the SVG 2 algorithm unless the ratio of maximum
477 to minimum axis for a circular or calligraphic nib is greater than 2 and the
478 Join Limit is relative to Nib Span and less than 4, in which case it uses the
479 Ratio algorithm. (With a custom convex nib it uses Ratio when the Join Limit is
480 relative and less than 4 regardless of nib dimension.) This heuristic works in
481 many cases but is not foolproof.
482
483
484 .. _stroke.troubleshooting:
485
486 Troubleshooting
487 ---------------
488
489 There are some known problems with and limitations of the Expand Stroke system.
490 Many of these have simple workarounds, others may be easiest to address by
491 editing the output contours. One advantage of the new system over the old is
492 that it will almost always provide accurate contour edges if the additional
493 processing steps (Remove Overlap, Simplify, etc.) are disabled.
494
495
496 .. _stroke.gentrouble:
497
498 General Guidance
499 ^^^^^^^^^^^^^^^^
500
501 If the system produces unexpected or bad looking contours that are still roughly
502 right a good first step is to try disabling Simplify and Add Extrema. These
503 algorithms occasionally produce inaccurate output and both can be run
504 selectively "by hand" on parts of a contour as needed.
505
506 If instead the output has more contours than expected or is badly misshapen the
507 problem may be with Remove Overlap. Complex input contours with tight curves
508 often lead to complex output contours with many self-intersections that can
509 occasionally confuse the overlap removal algorithm. In such cases it may be
510 easiest to first edit the contour by hand to reduce the number of intersections
511 and then run Remove Overlap on the simpler contour.
512
513 Some special use cases, such as stroking with an unusually large nib to create
514 an "outline background", can result in undesirable artifacts that Remove Overlap
515 (correctly) reduces to counterclockwise contours or "holes". While these are
516 difficult to identify algorithmically they are easy to delete by hand.
517
518
519 .. _stroke.cusps:
520
521 Cusps and Inverted Curvature
522 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
523
524 Where the curvature of the "tracing" point on the nib is less than the curvature
525 of the source contour, the curvature of the output contour inverts. The
526 transition point where the two curvatures are equal is called a "cusp" and that
527 term is sometimes used to refer to the whole inverted portion. The Expand Stroke
528 algorithm does not accurately trace these areas because they are almost always
529 eliminated by Remove Overlap, but when set to "None" a traced cusp will look
530 something like the contour portion on the right:
531
532 .. figure:: /images/stroke/cusps.svg
533
534 Cusp and Inverted Curvature
535
536 A cusp can appear in the final, non-overlapping output of the algorithm in
537 certain unusual cases, such as a sharp turn in an open contour just before a
538 Butt cap:
539
540 .. figure:: /images/stroke/buttcusp.svg
541
542 Visible Cusp Near a Butt Cap
543
544 The usual remedy for this problem is a different choice of source contour shape
545 or cap, but post-processing is another option. Here is a more obscure case that
546 came up in practice when the source contour was stroked with a very eccentric
547 ellipse (shown on the left) and a round cap. The distortion, which is just
548 barely visible on the lower-left of the output contour on the right, is shown
549 magnified in the center:
550
551 .. figure:: /images/stroke/roundcusp.svg
552
553 Visible Cusp Portion Near a Round Cap
554
555 This output contour was produced without Simplify, which removes most but not
556 all of the distortion. If this contour had instead been stroked using the Nib
557 cap style there would be no visible cusp; all cusps are, in a sense, traced out
558 "under the nib". However, in this case the round cap turns out to be not quite
559 long enough to obscure the cusp resulting from the very eccentric nib.
560
561 Cusps are fundamental to the offsetting algorithm of the Expand Stroke system,
562 and therefore any user combining tight curves, large nibs, and "short" caps
563 should keep an eye out for them. The best remedies may vary. Slightly altering
564 the source contour geometry is one approach. The user who encountered the round
565 cap problem pictured above just reused Simplify on that part of the contour with
566 a larger error parameter to smooth out the distortion.
567
568
569 .. _stroke.bevelcaps:
570
571 Bevel Caps and Flat Nibs
572 ^^^^^^^^^^^^^^^^^^^^^^^^
573
574 As noted above, Bevel caps were included as the simplest cap choice in some
575 situations. A Bevel cap just joins the ends of each offset contour - wherever
576 the two sides of the nib leave them - with a straight line. This can yield
577 counter-intuitive results in some cases, particularly with nibs that have flat
578 edges such as Calligraphic nibs:
579
580 .. figure:: /images/stroke/bevelcap.svg
581
582 A Bevel Cap Produced by a Nib Line
583
584 Both the jutting portion at the bottom left and the strange triangle structure
585 on the right are due to a flat line on the nib aligning with the cap angle.
586 Although these results are unusual and probably undesirable they are not
587 *wrong*, and the straightforward "solution" is to choose a different cap style.