aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fontsrv
diff options
context:
space:
mode:
authorDan Cross <cross@gajendra.net>2020-01-10 14:44:21 +0000
committerDan Cross <cross@gajendra.net>2020-01-10 14:54:30 +0000
commitfa325e9b42b0bdfb48857d1958d9fb7ceac55151 (patch)
tree81d26256d152435135bcb1ae43121979a49f5f2b /src/cmd/fontsrv
parent77a0a5b5194d4441c86de097f2aae297cb75e2c2 (diff)
downloadplan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.gz
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.bz2
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.zip
Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
Diffstat (limited to 'src/cmd/fontsrv')
-rw-r--r--src/cmd/fontsrv/main.c23
-rw-r--r--src/cmd/fontsrv/osx.c28
-rw-r--r--src/cmd/fontsrv/pjw.c6
3 files changed, 28 insertions, 29 deletions
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/osx.c b/src/cmd/fontsrv/osx.c
index c01ae6ce..b4dadd90 100644
--- a/src/cmd/fontsrv/osx.c
+++ b/src/cmd/fontsrv/osx.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/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.