diff options
author | Just <Just@4cde692c-a291-49d1-8350-778aa11640f8> | 2000-01-18 22:29:39 +0000 |
---|---|---|
committer | Just <Just@4cde692c-a291-49d1-8350-778aa11640f8> | 2000-01-18 22:29:39 +0000 |
commit | be7163c428f7a191ba92373a4b61dc00acd14e98 (patch) | |
tree | 9a0cae84165e1f046002a8af7301af9ca23c7946 /Lib/fontTools/misc/arrayTools.py | |
parent | 9682b4198b8449ba02ae2aaaa5fc76307167845d (diff) | |
download | fonttools-be7163c428f7a191ba92373a4b61dc00acd14e98.tar.gz |
added a bunch of rectangle tools that mimic some Qd.*Rect functions, like Qd.InsetRect.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@62 4cde692c-a291-49d1-8350-778aa11640f8
Diffstat (limited to 'Lib/fontTools/misc/arrayTools.py')
-rw-r--r-- | Lib/fontTools/misc/arrayTools.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/fontTools/misc/arrayTools.py b/Lib/fontTools/misc/arrayTools.py index 9792b737..220650d4 100644 --- a/Lib/fontTools/misc/arrayTools.py +++ b/Lib/fontTools/misc/arrayTools.py @@ -40,3 +40,14 @@ def scaleRect((l, t, r, b), x, y): def offsetRect((l, t, r, b), dx, dy): return l+dx, t+dy, r+dx, b+dy + +def insetRect((l, t, r, b), dx, dy): + return l+dx, t+dy, r-dx, b-dy + +def sectRect((l1, t1, r1, b1), (l2, t2, r2, b2)): + l, t, r, b = max(l1, l2), max(t1, t2), min(r1, r2), min(b1, b2) + if l >= r or t >= b: + return 0, (0, 0, 0, 0) + return 1, (l, t, r, b) + + |