From b3026bad35efd0fc4f3be5fc40f08b48840329f4 Mon Sep 17 00:00:00 2001 From: Just Date: Sat, 22 Jan 2000 00:26:07 +0000 Subject: [PATCH] added intRect() function. Turn any rect into a rect using ints only. git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@66 4cde692c-a291-49d1-8350-778aa11640f8 --- Lib/fontTools/misc/arrayTools.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/fontTools/misc/arrayTools.py b/Lib/fontTools/misc/arrayTools.py index 220650d49..f56f93f3e 100644 --- a/Lib/fontTools/misc/arrayTools.py +++ b/Lib/fontTools/misc/arrayTools.py @@ -50,4 +50,9 @@ def sectRect((l1, t1, r1, b1), (l2, t2, r2, b2)): return 0, (0, 0, 0, 0) return 1, (l, t, r, b) +def intRect(rect): + rect = Numeric.array(rect) + l, t = Numeric.floor(rect[:2]) + r, b = Numeric.ceil(rect[2:]) + return tuple(Numeric.array((l, t, r, b)).astype(Numeric.Int))