Skip to main content

Module array_tools

Module array_tools 

Source
Expand description

Rectangles and point arrays (fontTools.misc.arrayTools).

Comparisons follow Python’s min and max, which keep the first argument unless the second one is strictly smaller or larger.

Functions§

as_int16
asInt16: each value rounded half up.
calc_bounds
calcBounds: the bounding rectangle of the points; (0, 0, 0, 0) if there are none.
calc_int_bounds
calcIntBounds: the bounding rectangle, rounded with round (otRound in fontTools).
inset_rect
insetRect: the rectangle inset by dx and dy on all sides.
int_rect
intRect: the smallest integer rectangle containing the rectangle.
norm_rect
normRect: the rectangle with xMin <= xMax and yMin <= yMax.
offset_rect
offsetRect.
pairwise
pairwise: each item with the next one, the last with the first; in reverse order if reverse.
point_in_rect
pointInRect: whether the point is inside the rectangle or on its edge.
points_in_rect
pointsInRect: for each point, whether it is inside the rectangle.
quantize_rect
quantizeRect: the rectangle, normalized, with its edges moved outwards to multiples of factor. None for a factor below 1 (ValueError).
rect_area
rectArea.
rect_center
rectCenter.
scale_rect
scaleRect.
sect_rect
sectRect: the intersection of the rectangles, or None if they do not intersect ((False, (0, 0, 0, 0))).
union_rect
unionRect: the smallest rectangle containing both.
update_bounds
updateBounds: the rectangle extended to include p.
vector_length
vectorLength.

Type Aliases§

Point
A point.
Rect
A rectangle: (xMin, yMin, xMax, yMax).