forked from robotools/compositor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage.txt
133 lines (75 loc) · 2.71 KB
/
usage.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
h1. Compositor Usage Reference
This document covers the basic usage of the compositor package. For more detailed information read the documentation strings in the source.
h2. Asumptions
Some assumptions about the OpenType fonts being used are made by the package:
* The font is valid.
* The font's _cmap_ table contains Platform 3 Encoding 1.
* The font does not contain _GSUB_ or _GPOS_ lookup types that are not supported by the GSUB or GPOS objects. If an unsupported lookup type is present, the lookup will simply be ignored. It will not raise an error.
h2. The Font Object
h3. Importing
<pre>
from compositor import Font
</pre>
h3. Construction
<pre>
font = Font(path)
</pre>
*path* A path to an OpenType font.
h3. Special Behavior
<pre>
glyph = font["aGlyphName"]
</pre>
Returns the glyph object named "aGlyphName". This will raise a KeyError if "aGlyphName" is not in the font.
<pre>
isThere = "aGlyphName" in font
</pre>
Returns a boolean representing if "aGlyphName" is in the font.
h3. Methods
<pre>
font.keys()
</pre>
A list of all glyph names in the font.
<pre>
glyphRecords = font.process(aString)
</pre>
This is the most important method. It takes a string (Unicode or plain ASCII) and processes it with the features defined in the font's _GSUB_ and _GPOS_ tables. A list of _GlyphRecord_ objects will be returned.
<pre>
featureTags = font.getFeatureList()
</pre>
A list of all available features in GSUB and GPOS.
<pre>
state = font.getFeatureState(featureTag)
</pre>
Get a boolean representing if a feature is on or not. This assumes that the feature state is consistent in both the GSUB and GPOS tables. A _CompositorError_ will be raised if the feature is inconsistently applied. A _CompositorError_ will be raised if featureTag is not defined in GSUB or GPOS.
<pre>
font.setFeatureState(self, featureTag, state)
</pre>
Set the application state of a feature.
h3. Attributes
*info* The Info object for the font.
h2. The GlyphRecord Object
h3. Attributes
*glyphName* The name of the referenced glyph.
*xPlacement* Horizontal placement.
*yPlacement* Vertical placement.
*xAdvance* Horizontal adjustment for advance.
*yAdvance* Vertical adjustment for advance.
*alternates* A list of _GlyphRecords_ indicating alternates for the glyph.
h2. The Glyph Object
h3. Methods
<pre>
glyph.draw(pen)
</pre>
Draws the glyph with a FontTools pen.
h3. Attributes
*name* The name of the glyph.
*index* The glyph's index within the source font.
*width* The width of the glyph.
*bounds* The bounding box for the glyph. Formatted as (xMin, yMin, xMax, yMax). If the glyph contains no outlines, this will return _None_.
h2. The Info Object
h3. Attributes
*familyName*
*styleName*
*unitsPerEm*
*ascender*
*descender*