===============================================
Glyph - class to represent glyph
===============================================
CONSTRUCTOR:
Glyph() - generic constructor, creates an empty glyph
Glyph(Glyph) - copy constructor
Glyph(masterscount) - creates a glyph with 'masterscount' number of masters
Glyph(masterscount, [Node, ...]) - creates a glyph with 'masterscount' number of masters and assigns a list of nodes
ATTRIBUTES:
parent (read-only) - Glyph's parent object
nodes [Node] - list of Nodes
customdata (string) - custom data defined for this glyph
note (string) - note defined for this glyph
mark (integer) - True if glyph is marked
anchors [Anchor] - list of anchors
hhints [Hint] - list of horizontal hints
vhints [Hint] - list of vertical hints
hlinks [Link] - list of horizontal links
vlinks [Link] - list of vertical links
components [Component] - list of componets
replace_table [Replace] - hint replacing program, list of Replace objects
kerning [KerningPair] - list of kerning pairs
layers_number (integer) - number of masters
flags (integer) - flags set for this glyph
nodes_number (integer) - number of nodes, same as 'len(Glyph)'
width (integer) - advance width for the first master
height (integer) - advance height for the first master
unicode (integer) - first Unicode index in integer form
unicodes [integer] - list of Unicode indexes
name (string) - glyph name
mask (string) - mask
STORED TRUETYPE DATA
advance_width (integer)
advance_height (integer)
left_side_bearing (integer)
top_side_bearing (integer)
y_pels (integer)
bounding_box (Rect)
number_of_contours (integer)
end_points [integer]
points [TTPoint]
instructions [Byte]
hdmx[Byte]
OPERATIONS:
len() - returns number of nodes in the glyph
[] - can be used to access individial nodes
slice - can be used to access portion of the glyph's nodes array
+ or concatination - can be used to append Glyph, Node or sequence of Nodes
multiply - second operand must be Matrix, applies matrix transformation to a glyph
METHODS
Assign (Glyph) - copies all information from the assigned glyph
Transform(Matrix m) - applies Matrix transformation to the Glyph (see Matrix().__doc__)
SetLayersNumber(mastersnumber) - changes the number of masters, is applicable only to glyphs that have no parent
Clear() - removes all nodes
Add - refer to '+' operator
Insert (Node | Glyph | [Node]) | (Node | Glyph | [Node], nodeindex) - inserts Node, Glyph or sequence of Nodes at the begining of glyph's nodes or at specified node index
Present (style) - returns True if a layer or a combination of layers are present in the glyph
Delete (index) | (index0, index1) - removes node or range of nodes
ExpandLayer (masterindex) - expands selected master to all other masters
Shift (Point) | (Point, masterindex) - shifts positions of all nodes at first or specified master
Scale (Point(float) scale) | (Point(float) scale, Point center) | (Point(float) scale, Point center, masterindex) - scales the glyph
Layer (masterindex) - returns list of Points for all nodes for the selected master
Section (masterindex, pointindex, nodetype) - returns list of Points that conform to selected options
MoveNode(...) - moves the node copying Edit tool behavior (see User manual for details)
DeleteNode(nodeindex) - removes the node
InsertNode(nodeindex) | (nodeindex, float time) | (nodeindex, float time, masterindex) - insers new node on a contour
SELECTION OPERATIONS
Selection() - returns list of selected nodes
SelectAll() - selects all nodes
UnselectAll() - deselects all nodes
InvertSelection() - selects unselected nodes and deselects selected nodes
isAnySelected() - returns True if at least one node is selected
SelectedCount() - returns number of selected nodes
SelectRect(Rect r) | (Rect r, masterindex) - selects all nodes that are inside the rectangle
UnselectRect(Rect r) | (Rect r, masterindex) - deselects all nodes that are inside the rectangle
DeleteSelected() - deletes all selected nodes
METRICS AND BBOX OPERATIONS
GetBoundingRect() | (masterindex) - returns Rect - bounding box of the glyph
GetMetrics() | (masterindex) - returns glyph advance width and advance height in a form of Point
SetMetrics(Point p) | (Point p, masterindex) - assigns new values to the width and height of the glyph
GetVSB() | (masterindex) - returns glyph bottom sidebearing position
SetVSB(value) | (value, masterindex) - assigns new values to the bottom sidebearing of the glyph
OVERLAP OPERATIONS
RemoveOverlap() | (masterindex) - removes overlap
Badd(Glyph g) | ([Node]) | (Glyph g, masterindex) | ([Node], masterindex) - performs bollean Add operation with the glyph or list of nodes
Bsubtract(Glyph g) | ([Node]) | (Glyph g, masterindex) | ([Node], masterindex) - performs bollean Subtract operation with the glyph or list of nodes
Bintersect(Glyph g) | ([Node]) | (Glyph g, masterindex) | ([Node], masterindex) - performs bollean Insersect operation with the glyph or list of nodes
OPERATIONS ON CONTOURS
GetContoursNumber() - returns number of contours in the glyph
GetContourBegin(contourindex) - returns index of the first node for a contour
GetContourLength(contourindex) - returns number of nodes in a contour
SelectContour(contourindex) - selects all nodes in the contour
DeleteContour(contourindex) - removes contour
ReverseContour(contourindex) - reverses contour's direction
ReorderContour(contourindex, newindex) - reorders contours in the glyph
isContourClockwise(contourindex) - returns True if direction of contour is clockwise
SetStartNode(nodeindex) - makes the node a starting node of the contour
FindContour(nodeindex) - returns number of contour containing the 'nodeindex'
HINTS OPERATIONS
RemoveHints(mode) - removes hints and links
Autohint() | (masterindex) - automatically generates Type 1 hints
ANCHOR OPERATIONS
FindAnchor(string name) - finds anchor by name
TRANSFORMATION ACTIONS
Decompose() - pastes all components to the glyph outline
MakeExtremeNodes() | (masterindex) - automatically detects and adds extreme nodes
Audit() | (masterindex) - performs test of the glyph and returns list of AuditRecord objects
Iterate(Iterator) - iterates glyph trough iterator class which must unclude following methods:
Start(); ClosePath(); StartPath(Node); LineTo(Node); CurveTo(Node); SplineTo(Node); Finish()
Rotate3D
Extrude3D(outlinewidth, shift_x, shift_y)
Shadow(outlinewidth, shift_x, shift_y)
College(outlinewidth, distance)
Gradient(outlinewidth, direction, stripes_number, start_y, finish_y)
Distance(width_x, width_y, cornermode) | (width_x, width_y, cornermode, Glyph dest)
Interpolate([(nodeindex, Point newposition])
Warp([Point], float force)
Rasterize() | Rasterize(Image, [, active layer[, height]]) | Rasterize(Image, [, WeightVector[, height]]) - rasterizes glyph to the Image or to glyph's background. Returns resulting image_rect. Height is relative to font's UPM
Blend(Glyph source, integer layer1, integer layer2, Point amount) - returns blend of the glyph and source
JoinAll() - tries to join all open contours
SaveEPS(string filename) | (string filename, layer) - writes layer into the EPS file named filename
LoadEPS(string filename) - reads EPS from filename and returns Glyph object. Use Assign method to replace current glyph with the loaded outline
R([Point], float force)