tfontsrv: enlarge drawing buffer for subfonts on macOS - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 96dc2330918909c925a5c3a6407116dad7f93c3a
DIR parent a5b24c22a865f2ea3ee389b9d0a235bf7d93f5a6
HTML 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:
M src/cmd/fontsrv/osx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
DIR diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c
t@@ -104,6 +104,7 @@ static char *lines[] = {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"abcdefghijklmnopqrstuvwxyz",
"g",
+ "┌┬┐├┼┤└┴┘│─",
"ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.",
"私はガラスを食べられます。それは私を傷つけません。",
"Aš galiu valgyti stiklą ir jis manęs nežeidžia",
t@@ -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;
t@@ -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;