diff options
author | Russ Cox <rsc@swtch.com> | 2015-02-16 23:58:22 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2015-02-17 05:00:09 +0000 |
commit | 32dc15fa62d94c88f0b62bfe4d64ba60fe1733a6 (patch) | |
tree | 4cf16da305ff7a0b30b0896a6ff79b0e9ea65bac /src/cmd/fontsrv/main.c | |
parent | 5d86ecd4b7fd8bccc88a06803c7f8ace26a88788 (diff) | |
download | plan9port-32dc15fa62d94c88f0b62bfe4d64ba60fe1733a6.tar.gz plan9port-32dc15fa62d94c88f0b62bfe4d64ba60fe1733a6.tar.bz2 plan9port-32dc15fa62d94c88f0b62bfe4d64ba60fe1733a6.zip |
fontsrv: use CoreText API on OS X
This gets us font fallback for free and avoids use of a
deprecated API that might go away some day.
Change-Id: I4b9b1a1ce3e6d98bfb407e3baea13f4adfe2c26a
Reviewed-on: https://plan9port-review.googlesource.com/1160
Reviewed-by: Russ Cox <rsc@swtch.com>
Diffstat (limited to 'src/cmd/fontsrv/main.c')
-rw-r--r-- | src/cmd/fontsrv/main.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/cmd/fontsrv/main.c b/src/cmd/fontsrv/main.c index 93eb39e2..5a43ef15 100644 --- a/src/cmd/fontsrv/main.c +++ b/src/cmd/fontsrv/main.c @@ -144,7 +144,7 @@ xwalk1(Fid *fid, char *name, Qid *qid) switch(QTYPE(path)) { default: NotFound: - return "file not found"; + return "file not found"; case Qroot: if(dotdot) @@ -313,10 +313,18 @@ xread(Req *r) fmtstrinit(&fmt); f = &xfont[QFONT(path)]; load(f); - if(f->unit == 0) + if(f->unit == 0 && f->loadheight == nil) { + readstr(r, "font missing\n"); break; - height = f->height * (int)QSIZE(path)/f->unit + 0.99999999; - ascent = height - (int)(-f->originy * (int)QSIZE(path)/f->unit + 0.99999999); + } + height = 0; + ascent = 0; + if(f->unit > 0) { + height = f->height * (int)QSIZE(path)/f->unit + 0.99999999; + ascent = height - (int)(-f->originy * (int)QSIZE(path)/f->unit + 0.99999999); + } + if(f->loadheight != nil) + f->loadheight(f, QSIZE(path), &height, &ascent); fmtprint(&fmt, "%11d %11d\n", height, ascent); for(i=0; i<nelem(f->range); i++) { if(f->range[i] == 0) @@ -331,7 +339,7 @@ xread(Req *r) f = &xfont[QFONT(path)]; load(f); if(r->fid->aux == nil) { - r->fid->aux = mksubfont(f->name, QRANGE(path)<<8, (QRANGE(path)<<8)+0xFF, QSIZE(path), QANTIALIAS(path)); + r->fid->aux = mksubfont(f, f->name, QRANGE(path)<<8, (QRANGE(path)<<8)+0xFF, QSIZE(path), QANTIALIAS(path)); if(r->fid->aux == nil) { responderrstr(r); return; |