robofab.pens.filterPen
index
/code/projects/robofab/Lib/robofab/pens/filterPen.py

A couple of point pens to filter contours in various ways.

 
Modules
       
math

 
Classes
       
fontTools.pens.basePen.AbstractPen
ThresholdPen
fontTools.pens.basePen.BasePen(fontTools.pens.basePen.AbstractPen)
FlattenPen

 
class FlattenPen(fontTools.pens.basePen.BasePen)
    Process the contours into a series of straight lines by flattening the curves.
 
 
Method resolution order:
FlattenPen
fontTools.pens.basePen.BasePen
fontTools.pens.basePen.AbstractPen

Methods defined here:
__init__(self, otherPen, approximateSegmentLength=5, segmentLines=False, filterDoubles=True)
addComponent(self, glyphName, transformation)

Methods inherited from fontTools.pens.basePen.BasePen:
closePath(self)
curveTo(self, *points)
endPath(self)
lineTo(self, pt)
moveTo(self, pt)
qCurveTo(self, *points)

 
class ThresholdPen(fontTools.pens.basePen.AbstractPen)
    Removes segments shorter in length than the threshold value.
 
  Methods defined here:
__init__(self, otherPen, threshold=10)
addComponent(self, glyphName, transformation)
closePath(self)
curveTo(self, pt1, pt2, pt3)
endPath(self)
lineTo(self, pt, smooth=False)
moveTo(self, pt)
qCurveTo(self, *points)

 
Functions
       
distance(pt1, pt2)
flattenGlyph(aGlyph, threshold=10, segmentLines=True)
Replace curves with series of straight l ines.
halftoneGlyph(aGlyph, invert=False)
Convert the glyph into some sort of halftoning pattern.
Measure a bunch of inside/outside points to simulate grayscale levels.
Slow.
spikeGlyph(aGlyph, segmentLength=20, spikeLength=40, patternFunc=None)
Add narly spikes or dents to the glyph.
patternFunc is an optional function which recalculates the offset.
thresholdGlyph(aGlyph, threshold=10)