coldtype.pens.datpen.DATPen¶
-
class
DATPen
(**kwargs)¶ Bases:
fontTools.pens.recordingPen.RecordingPen
,coldtype.pens.datpenlikeobject.DATPenLikeObject
Main vector representation in Coldtype
DATPen is a subclass of fontTools
RecordingPen
-
addFrame
(frame, typographic=False, passthru=False)¶ Add a new frame to the DATPen, replacing any old frame. Passthru ignored, there for compatibility
-
attr
(tag=None, field=None, **kwargs)¶ Set a style attribute on the pen.
-
bounds
()¶ Calculate the bounds of this shape; mostly for internal use.
-
cast
(_class, *args)¶ Quickly cast to a (different) subclass.
-
catmull
(points, close=False)¶ Run a catmull spline through a series of points
-
clearAttrs
()¶ Remove all styling.
-
clearFrame
()¶ Remove the DATPen frame.
-
closePath
()¶ The standard RecordingPen.closePath, but returns self for chainability.
-
collapse
()¶ For compatibility with calls to a DATPens
-
contain
(rect)¶ For conveniently marking an arbitrary Rect container.
-
copy
(with_data=False)¶ Make a totally fresh copy; useful given the DATPen’s general reliance on mutable state.
-
curveTo
(*points)¶ The standard RecordingPen.curveTo, but returns self for chainability.
-
difference
(otherPen)¶ Calculate and return the difference of this shape and another.
-
dots
(radius=4)¶ (Necessary?) Create circles at moveTo commands
-
endPath
()¶ The standard RecordingPen.endPath, but returns self for chainability.
-
explode
()¶ Read each contour into its own DATPen; returns a DATPens
-
f
(*value)¶ Get/set a (f)ill
-
fill
(*value)¶ Get/set a (f)ill
-
filmjitter
(doneness, base=0, speed=10, 20, scale=2, 3, octaves=16)¶ An easy way to make something move in a way reminiscent of misregistered film
-
flatpoints
()¶ Returns a flat list of points from the DATPen’s original contours; does not modify the DATPen
-
flatten
(length=10)¶ Runs a fontTools FlattenPen on this pen
-
frameSet
(th=False, tv=False)¶ Return a new DATPen representation of the frame of this DATPen.
-
getFrame
(th=False, tv=False)¶ For internal use; creates a frame based on calculated bounds.
-
getTag
()¶ Retrieve the tag (could probably be a real property)
-
glyph
(glyph)¶ Play a glyph (like from defcon) into this pen.
-
gridlines
(rect, x=20, y=None, absolute=False)¶ Construct a grid in the pen using x and (optionally) y subdivisions
-
hull
(points)¶ Same as DATPen.line but calls closePath instead of endPath`
-
image
(src=None, rect=Rect([0, 0, 500, 500]), pattern=True, opacity=1.0)¶ Get/set an image fill
-
img
(src=None, rect=Rect([0, 0, 500, 500]), pattern=True, opacity=1.0)¶ Get/set an image fill
-
intersection
(otherPen)¶ Calculate and return the intersection of this shape and another.
-
length
(t=1)¶ Get the length of the curve for time t
-
line
(points)¶ Syntactic sugar for moveTo`+`lineTo`(…)+`endPath; can have any number of points
-
lineTo
(p1)¶ The standard RecordingPen.lineTo, but returns self for chainability.
-
lines
()¶ Returns lines connecting point-representation of flatpoints
-
moveTo
(p0)¶ The standard RecordingPen.moveTo, but returns self for chainability.
-
noop
(*args, **kwargs)¶ Does nothing
-
openAndClosed
()¶ Explode and then classify group each contour into open/closed pens; (what is this good for?)
-
outline
(offset=1, drawInner=True, drawOuter=True, cap='square')¶ AKA expandStroke
-
oval
(rect)¶ Oval primitive
-
pen
()¶ Return a single-pen representation of this pen(set).
-
point_t
(t=0.5)¶ Get point value for time t
-
points
()¶ Returns a list of points grouped by contour from the DATPen’s original contours; useful for drawing bezier skeletons; does not modify the DATPen
-
polygon
(sides, rect)¶ Polygon primitive; WIP
-
qCurveTo
(*points)¶ The standard RecordingPen.qCurveTo, but returns self for chainability.
-
rasterized
(rect, scale=1, pen_class=None, context=None)¶ Same as precompose but returns the Image created rather than setting that image as the attr-image of this pen
-
record
(pen)¶ Play a pen into this pen, meaning that pen will be added to this one’s value.
-
rect
(rect, *args)¶ Rectangle primitive — moveTo/lineTo/lineTo/lineTo/closePath
-
removeBlanks
()¶ If this is blank, return True (for recursive calls from DATPens).
-
removeOverlap
()¶ Remove overlaps within this shape and return itself.
-
reverse
()¶ Reverse the winding direction of the pen.
-
reverseDifference
(otherPen)¶ Calculate and return the reverseDifference of this shape and another.
-
rotate
(degrees, point=None)¶ Rotate this shape by a degree (in 360-scale, counterclockwise).
-
roughen
(amplitude=10, threshold=10, ignore_ends=False)¶ Randomizes points in skeleton
-
round
(rounding)¶ Round the values of this pen to integer values.
-
round_to
(rounding)¶ Round the values of this pen to nearest multiple of rounding.
-
roundedRect
(rect, hr, vr)¶ Rounded rectangle primitive
-
s
(*value)¶ Get/set a (s)troke
-
scale
(scaleX, scaleY=None, center=None)¶ Scale this shape by a percentage amount (1-scale).
-
scaleToHeight
(h, shrink_only=False)¶ Scale this shape horizontally
-
scaleToRect
(rect, preserveAspect=True, shrink_only=False)¶ Scale this shape into a Rect.
-
scaleToWidth
(w, shrink_only=False)¶ Scale this shape horizontally
-
semicircle
(r, center, fext=0.5, rext=0.5)¶ Not really a semicircle fext controls extension from the standard on the “flat” edge rext controls extension from the standard on the “round” edge
-
simplify
()¶ DO NOT USE
-
sine
(r, periods)¶ Sine-wave primitive
-
skeleton
(scale=1, returnSet=False)¶ Vector-editing visualization
-
skeletonPoints
()¶ WIP
-
sleep
(time)¶ Sleep call within the chain (if you want to measure something)
-
smooth
()¶ Runs a catmull spline on the datpen, useful in combination as flatten+roughen+smooth
-
standingwave
(r, periods, direction=1)¶ Standing-wave primitive
-
stroke
(*value)¶ Get/set a (s)troke
-
strokeWidth
(value)¶ Get/set a (s)troke (w)idth
-
subsegment
(start=0, end=1)¶ Return a subsegment of the pen based on t values start and end
-
svg
(file, gid, rect=Rect([0, 0, 0, 100]))¶ WIP; attempt to read an svg file into the pen
-
sw
(value)¶ Get/set a (s)troke (w)idth
-
tag
(tag)¶ For conveniently marking a DATPen(Set) w/o having to put it into some other data structure.
-
to_glyph
(name=None, width=None)¶ Create a glyph (like from defcon) using this pen’s value. Warning: be sure to call endPath or closePath on your pen or this call will silently do nothing
-
trackToRect
(rect, pullToEdges=False, r=0)¶ Distribute pens evenly within a frame
-
transform
(transform, transformFrame=True)¶ Perform an arbitrary transformation on the pen, using the fontTools Transform class.
-
translate
(x, y=None, transformFrame=True)¶ Translate this shape by x and y (pixel values).
-
union
(otherPen)¶ Calculate and return the union of this shape and another.
-
xor
(otherPen)¶ Calculate and return the XOR of this shape and another.
-