aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/misc/arrayTools.py
diff options
context:
space:
mode:
authorJust <Just@4cde692c-a291-49d1-8350-778aa11640f8>2000-01-23 19:10:27 +0000
committerJust <Just@4cde692c-a291-49d1-8350-778aa11640f8>2000-01-23 19:10:27 +0000
commit02a739a0d5f110c15fdb6a13237089e143250471 (patch)
tree8734cfa005802ab1ba369dca50a4b4cd67ea59b6 /Lib/fontTools/misc/arrayTools.py
parentb3026bad35efd0fc4f3be5fc40f08b48840329f4 (diff)
downloadfonttools-02a739a0d5f110c15fdb6a13237089e143250471.tar.gz
new functions: unionRect() and rectCenter()
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@67 4cde692c-a291-49d1-8350-778aa11640f8
Diffstat (limited to 'Lib/fontTools/misc/arrayTools.py')
-rw-r--r--Lib/fontTools/misc/arrayTools.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/fontTools/misc/arrayTools.py b/Lib/fontTools/misc/arrayTools.py
index f56f93f3..9e8d59fc 100644
--- a/Lib/fontTools/misc/arrayTools.py
+++ b/Lib/fontTools/misc/arrayTools.py
@@ -50,6 +50,13 @@ def sectRect((l1, t1, r1, b1), (l2, t2, r2, b2)):
return 0, (0, 0, 0, 0)
return 1, (l, t, r, b)
+def unionRect((l1, t1, r1, b1), (l2, t2, r2, b2)):
+ l, t, r, b = min(l1, l2), min(t1, t2), max(r1, r2), max(b1, b2)
+ return (l, t, r, b)
+
+def rectCenter((l, t, r, b)):
+ return (l+r)/2, (t+b)/2
+
def intRect(rect):
rect = Numeric.array(rect)
l, t = Numeric.floor(rect[:2])