Debian Codegraph @

Doc/source/pens/index.rst

raw
1 ###########################################
2 pens: Inspect and manipulate glyph outlines
3 ###########################################
4
5
6 .. rubric:: Overview:
7 :heading-level: 2
8
9 The fontTools **pens** are a collection of classes that can operate
10 on a font glyph via the points and the contours of the glyph's outlines.
11
12 Some pens trace through the outlines and generate graphical output,
13 such as a new glyph outline or a formatted image, but other
14 pens analyze the outlines and return information about the glyph.
15
16 Pens that alter or produce a pen-compatible :class:`.ttGlyph` object can
17 be chained together by calling he :meth:`.draw` method of each glyph
18 object, in turn, with a subsequent pen argument.
19
20 The majority of the pens process glyph outlines in a segment-oriented
21 manner, meaning that they operate by processing the Bezier segments of
22 each glyph or glyph component in sequential order. This model
23 corresponds to the way that glyph data is stored in both
24 TrueType-flavored and CFF-flavored OpenType fonts; the documentation
25 often refers to pens of this type as *SegmentPens*.
26
27 New pens can be written by sub-classing the :class:`.AbstractPen` or,
28 somewhat more practically, :class:`.BasePen` classes. The general Pen
29 Protocol is documented on the :doc:`basePen </pens/basePen>` page:
30
31 .. toctree::
32 :maxdepth: 2
33
34 basePen
35
36 There are also several "point-oriented" pens in the collection. These
37 pens serve to interpret the storage format used in Unified Font Object
38 (UFO) source files, which records all of the points of each contour in
39 sequential order, rather than as Bezier-curve segments. Thus, these
40 *PointPens* operate only on sequences of points.
41
42 UFO's point-only file format can be deterministically converted into
43 segment-oriented form and vice-versa; therefore all pens are available
44 to be used with UFO sources. General examples can be found on the
45 :doc:`pointPen </pens/pointPen>` page:
46
47 .. toctree::
48 :maxdepth: 2
49
50 pointPen
51
52 but there are also ``-PointPen`` variants available for several of the
53 other pens, included alongside the modules for their segment-oriented
54 version.
55
56
57
58 Pen modules
59 -----------
60
61
62 Note:
63 Some of the platform-specific pen modules rely on importing external
64 Python libraries; these cases are noted on the relevant pen modules'
65 pages.
66
67
68
69 .. toctree::
70 :maxdepth: 2
71
72 areaPen
73 boundsPen
74 cu2quPen
75 filterPen
76 momentsPen
77 perimeterPen
78 pointInsidePen
79 recordingPen
80 reverseContourPen
81 roundingPen
82 statisticsPen
83 svgPathPen
84 t2CharStringPen
85 teePen
86 transformPen
87 ttGlyphPen
88
89 .. toctree::
90 :maxdepth: 2
91
92 cairoPen
93 cocoaPen
94 freetypePen
95 qtPen
96 quartzPen
97 reportLabPen
98 wxPen
99