aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/misc/arrayTools.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/misc/arrayTools.py')
-rw-r--r--Lib/fontTools/misc/arrayTools.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/fontTools/misc/arrayTools.py b/Lib/fontTools/misc/arrayTools.py
index f2cfac83..ed20230c 100644
--- a/Lib/fontTools/misc/arrayTools.py
+++ b/Lib/fontTools/misc/arrayTools.py
@@ -6,6 +6,7 @@
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
+from fontTools.misc.fixedTools import otRound
from numbers import Number
import math
import operator
@@ -20,10 +21,11 @@ def calcBounds(array):
ys = [y for x, y in array]
return min(xs), min(ys), max(xs), max(ys)
-def calcIntBounds(array):
+def calcIntBounds(array, round=otRound):
"""Return the integer bounding rectangle of a 2D points array as a
tuple: (xMin, yMin, xMax, yMax)
- Values are rounded to closest integer.
+ Values are rounded to closest integer towards +Infinity using otRound
+ function by default, unless an optional 'round' function is passed.
"""
return tuple(round(v) for v in calcBounds(array))