diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/fontsrv | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/fontsrv')
-rw-r--r-- | src/cmd/fontsrv/mac.c (renamed from src/cmd/fontsrv/osx.c) | 28 | ||||
-rw-r--r-- | src/cmd/fontsrv/main.c | 23 | ||||
-rw-r--r-- | src/cmd/fontsrv/mkfile | 2 | ||||
-rw-r--r-- | src/cmd/fontsrv/osx-cocoa.c | 1 | ||||
-rw-r--r-- | src/cmd/fontsrv/pjw.c | 6 | ||||
-rw-r--r-- | src/cmd/fontsrv/x11.c | 2 |
6 files changed, 29 insertions, 33 deletions
diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/mac.c index c01ae6ce..b4dadd90 100644 --- a/src/cmd/fontsrv/osx.c +++ b/src/cmd/fontsrv/mac.c @@ -51,7 +51,7 @@ mac2c(CFStringRef s) char *p; int n; - n = CFStringGetLength(s)*8; + n = CFStringGetLength(s)*8; p = malloc(n); CFStringGetCString(s, p, n, kCFStringEncodingUTF8); return p; @@ -93,7 +93,7 @@ loadfonts(void) if(f == nil) continue; s = CTFontDescriptorCopyAttribute(f, kCTFontNameAttribute); - xfont[nxfont].name = mac2c(s); + xfont[nxfont].name = mac2c(s); CFRelease(s); nxfont++; } @@ -147,7 +147,7 @@ fontheight(XFont *f, int size, int *height, int *ascent) CTLineRef line; str = c2mac(lines[i]); - + // See https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/CoreText_Programming/LayoutOperations/LayoutOperations.html#//apple_ref/doc/uid/TP40005533-CH12-SW2 attrs = CFDictionaryCreate(kCFAllocatorDefault, (const void**)&keys, (const void**)&values, sizeof(keys) / sizeof(keys[0]), @@ -162,15 +162,15 @@ fontheight(XFont *f, int size, int *height, int *ascent) r.size.width += r.origin.x; r.size.height += r.origin.y; CFRelease(line); - + // fprint(2, "%s: %g %g %g %g\n", lines[i], r.origin.x, r.origin.y, r.size.width, r.size.height); - + if(i == 0) bbox = r; if(bbox.origin.x > r.origin.x) - bbox.origin.x = r.origin.x; + bbox.origin.x = r.origin.x; if(bbox.origin.y > r.origin.y) - bbox.origin.y = r.origin.y; + bbox.origin.y = r.origin.y; if(bbox.size.width < r.size.width) bbox.size.width = r.size.width; if(bbox.size.height < r.size.height) @@ -182,7 +182,7 @@ fontheight(XFont *f, int size, int *height, int *ascent) *height = bbox.size.height + 0.999999; *ascent = *height - (-bbox.origin.y + 0.999999); - + CGContextRelease(ctxt); CFRelease(font); } @@ -232,8 +232,8 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) CFRelease(desc); if(font == nil) return nil; - - + + bbox = CTFontGetBoundingBox(font); x = (int)(bbox.size.width*2 + 0.99999999); @@ -295,7 +295,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) sprint(buf, "%C", (Rune)mapUnicode(name, i)); str = c2mac(buf); - + // See https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/CoreText_Programming/LayoutOperations/LayoutOperations.html#//apple_ref/doc/uid/TP40005533-CH12-SW2 attrs = CFDictionaryCreate(kCFAllocatorDefault, (const void**)&keys, (const void**)&values, sizeof(keys) / sizeof(keys[0]), @@ -309,7 +309,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) CGContextSetTextPosition(ctxt, 0, y0); r = CTLineGetImageBounds(line, ctxt); memfillcolor(mc, DBlack); - CTLineDraw(line, ctxt); + CTLineDraw(line, ctxt); CFRelease(line); fc->x = x; @@ -324,7 +324,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) if(i == 0) { drawpjw(m, fc, x, (int)(bbox.size.width + 0.99999999), y, y - y0); x += fc->width; - } + } continue; } @@ -357,6 +357,6 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) sf->ascent = Dy(m1->r) - y0; sf->info = fc0; sf->bits = m1; - + return sf; } diff --git a/src/cmd/fontsrv/main.c b/src/cmd/fontsrv/main.c index 37f0da32..ebab6249 100644 --- a/src/cmd/fontsrv/main.c +++ b/src/cmd/fontsrv/main.c @@ -70,7 +70,7 @@ dostat(vlong path, Qid *qid, Dir *dir) vlong length; XFont *f; char buf[100]; - + q.type = 0; q.vers = 0; q.path = path; @@ -98,7 +98,7 @@ dostat(vlong path, Qid *qid, Dir *dir) snprint(buf, sizeof buf, "%lld%s", QSIZE(path), QANTIALIAS(path) ? "a" : ""); name = buf; break; - + case Qfontfile: f = &xfont[QFONT(path)]; load(f); @@ -111,7 +111,7 @@ dostat(vlong path, Qid *qid, Dir *dir) name = buf; break; } - + if(qid) *qid = q; if(dir) { @@ -214,7 +214,7 @@ fontgen(int i, Dir *d, void *v) { vlong path; Fid *f; - + f = v; path = f->qid.path; if(i >= 2*nelem(sizes)) @@ -280,7 +280,7 @@ void responderrstr(Req *r) { char err[ERRMAX]; - + rerrstr(err, sizeof err); respond(r, err); } @@ -295,7 +295,7 @@ xread(Req *r) char *data; Memsubfont *sf; Memimage *m; - + path = r->fid->qid.path; switch(QTYPE(path)) { case Qroot: @@ -377,7 +377,7 @@ static void xdestroyfid(Fid *fid) { Memsubfont *sf; - + sf = fid->aux; if(sf == nil) return; @@ -420,7 +420,7 @@ dump(char *path) // root memset(&fid, 0, sizeof fid); - dostat(0, &fid.qid, nil); + dostat(0, &fid.qid, nil); qid = fid.qid; path0 = path; @@ -440,7 +440,7 @@ dump(char *path) *p++ = '/'; path = p; } - + memset(&r, 0, sizeof r); xsrv.fake = 1; @@ -513,7 +513,7 @@ main(int argc, char **argv) default: usage(); }ARGEND - + xsrv.attach = xattach; xsrv.open = xopen; xsrv.read = xread; @@ -526,7 +526,7 @@ main(int argc, char **argv) memimageinit(); loadfonts(); qsort(xfont, nxfont, sizeof xfont[0], fontcmp); - + if(pflag) { if(argc != 1 || chatty9p || chattyfuse) usage(); @@ -600,4 +600,3 @@ dirpackage(uchar *buf, long ts, Dir **d) return nn; } - diff --git a/src/cmd/fontsrv/mkfile b/src/cmd/fontsrv/mkfile index 8ad99dbc..218b7c73 100644 --- a/src/cmd/fontsrv/mkfile +++ b/src/cmd/fontsrv/mkfile @@ -14,8 +14,6 @@ OFILES=\ <$PLAN9/src/mkone -osx-cocoa.$O: osx.c - showpjw: showpjw.c 9c showpjw.c 9l -o showpjw showpjw.o diff --git a/src/cmd/fontsrv/osx-cocoa.c b/src/cmd/fontsrv/osx-cocoa.c deleted file mode 100644 index 0e36b6e8..00000000 --- a/src/cmd/fontsrv/osx-cocoa.c +++ /dev/null @@ -1 +0,0 @@ -#include "osx.c" diff --git a/src/cmd/fontsrv/pjw.c b/src/cmd/fontsrv/pjw.c index 30ebbed2..82e8cfa1 100644 --- a/src/cmd/fontsrv/pjw.c +++ b/src/cmd/fontsrv/pjw.c @@ -96,7 +96,7 @@ drawpjw(Memimage *m, Fontchar *fc, int x, int width, int height, int ascent) Memimage *pm, *pm1, *pm2; Rectangle r; int margin; - + w = width; // assume margin below baseline is @@ -116,7 +116,7 @@ drawpjw(Memimage *m, Fontchar *fc, int x, int width, int height, int ascent) close(p[0]); if(pm == nil) goto Error; - + pm1 = allocmemimage(pm->r, GREY8); memimagedraw(pm1, pm1->r, pm, pm->r.min, nil, ZP, S); pm2 = resample(w, w, pm1); @@ -216,7 +216,7 @@ fac(int L) return f; } -/* +/* * i0(x) is the modified Bessel function, Σ (x/2)^2L / (L!)² * There are faster ways to calculate this, but we precompute * into a table so let's keep it simple. diff --git a/src/cmd/fontsrv/x11.c b/src/cmd/fontsrv/x11.c index 4137f9ca..0f6b97bb 100644 --- a/src/cmd/fontsrv/x11.c +++ b/src/cmd/fontsrv/x11.c @@ -176,7 +176,7 @@ mksubfont(XFont *xf, char *name, int lo, int hi, int size, int antialias) e = 1; k = FT_Get_Char_Index(face, i); if(k != 0) { - e = FT_Load_Glyph(face, k, FT_LOAD_RENDER|FT_LOAD_NO_HINTING|(antialias ? 0:FT_LOAD_TARGET_MONO)); + e = FT_Load_Glyph(face, k, FT_LOAD_RENDER|FT_LOAD_NO_AUTOHINT|(antialias ? 0:FT_LOAD_TARGET_MONO)); } if(e || face->glyph->advance.x <= 0) { fc->width = 0; |