aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fontsrv
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2012-11-25 22:45:32 -0500
committerRuss Cox <rsc@swtch.com>2012-11-25 22:45:32 -0500
commite19fde358468d55bc60664691978ae86c7641015 (patch)
treede490d402868c4cb4fdd0cb05d1fe676e9cc57b0 /src/cmd/fontsrv
parentc6d1f20537c9bbe0a49e89f81d4b70368ba4172f (diff)
downloadplan9port-e19fde358468d55bc60664691978ae86c7641015.tar.gz
plan9port-e19fde358468d55bc60664691978ae86c7641015.tar.bz2
plan9port-e19fde358468d55bc60664691978ae86c7641015.zip
fontsrv: work around a few crashes
Probably not the right fix, but gets us going. R=rsc http://codereview.appspot.com/6782113
Diffstat (limited to 'src/cmd/fontsrv')
-rw-r--r--src/cmd/fontsrv/osx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c
index 94190d19..b00698a8 100644
--- a/src/cmd/fontsrv/osx.c
+++ b/src/cmd/fontsrv/osx.c
@@ -183,10 +183,10 @@ mksubfont(char *name, int lo, int hi, int size, int antialias)
x = (int)(bbox.size.width * size / unit + 0.99999999);
y = bbox.size.height * size/unit + 0.99999999;
y0 = (int)(-bbox.origin.y * size/unit + 0.99999999);
- m = allocmemimage(Rect(0, 0, x*(hi+1-lo), y), GREY8);
+ m = allocmemimage(Rect(0, 0, x*(hi+1-lo)+1, y+1), GREY8);
if(m == nil)
return nil;
- mc = allocmemimage(Rect(0, 0, x, y), GREY8);
+ mc = allocmemimage(Rect(0, 0, x+1, y+1), GREY8);
if(mc == nil)
return nil;
memfillcolor(m, DBlack);
@@ -272,6 +272,10 @@ mksubfont(char *name, int lo, int hi, int size, int antialias)
// round up to 32-bit boundary
// so that in-memory data is same
// layout as in-file data.
+ if(x == 0)
+ x = 1;
+ if(y == 0)
+ y = 1;
if(antialias)
x += -x & 3;
else