aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fontsrv
diff options
context:
space:
mode:
authorXiao-Yong Jin <xjin@anl.gov>2018-03-14 22:45:33 -0500
committerDavid du Colombier <0intro@gmail.com>2018-03-27 15:02:33 +0200
commit96dc2330918909c925a5c3a6407116dad7f93c3a (patch)
treee441dc414814b890af0d1d3feafc6069f42f9e09 /src/cmd/fontsrv
parenta5b24c22a865f2ea3ee389b9d0a235bf7d93f5a6 (diff)
downloadplan9port-96dc2330918909c925a5c3a6407116dad7f93c3a.tar.gz
plan9port-96dc2330918909c925a5c3a6407116dad7f93c3a.tar.bz2
plan9port-96dc2330918909c925a5c3a6407116dad7f93c3a.zip
fontsrv: enlarge drawing buffer for subfonts on macOS
Double the width returned by CTFontGetBoundingBox when drawing. Add box drawing characters for determining the line height. Call freememimage(1) for the character memimage. Fixes #18. Fixes #120. Fixes #146.
Diffstat (limited to 'src/cmd/fontsrv')
-rw-r--r--src/cmd/fontsrv/osx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c
index adb007c2..18197a23 100644
--- a/src/cmd/fontsrv/osx.c
+++ b/src/cmd/fontsrv/osx.c
@@ -104,6 +104,7 @@ static char *lines[] = {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"abcdefghijklmnopqrstuvwxyz",
"g",
+ "┌┬┐├┼┤└┴┘│─",
"ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.",
"私はガラスを食べられます。それは私を傷つけません。",
"Aš galiu valgyti stiklą ir jis manęs nežeidžia",
@@ -234,7 +235,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias)
bbox = CTFontGetBoundingBox(font);
- x = (int)(bbox.size.width + 0.99999999);
+ x = (int)(bbox.size.width*2 + 0.99999999);
fontheight(f, size, &height, &ascent);
y = height;
@@ -343,6 +344,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias)
m1 = allocmemimage(Rect(0, 0, x, y), antialias ? GREY8 : GREY1);
memimagedraw(m1, m1->r, m, m->r.min, memopaque, ZP, S);
freememimage(m);
+ freememimage(mc);
sf->name = nil;
sf->n = hi+1 - lo;