plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit 96dc2330918909c925a5c3a6407116dad7f93c3a
parent a5b24c22a865f2ea3ee389b9d0a235bf7d93f5a6
Author: Xiao-Yong Jin <xjin@anl.gov>
Date:   Wed, 14 Mar 2018 22:45:33 -0500

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:
Msrc/cmd/fontsrv/osx.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 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;