diff options
| author | wkj <devnull@localhost> | 2004-04-21 01:15:41 +0000 |
|---|---|---|
| committer | wkj <devnull@localhost> | 2004-04-21 01:15:41 +0000 |
| commit | a31db67d14c0e50353eac3db342f3c969cabdf76 (patch) | |
| tree | 0cebd9a65bab940355f5be0751f53238366555d7 /src/cmd/tcs/font/font.c | |
| parent | ba03b8910dd07511378e6f1007faf0539ed25598 (diff) | |
| download | plan9port-a31db67d14c0e50353eac3db342f3c969cabdf76.tar.gz plan9port-a31db67d14c0e50353eac3db342f3c969cabdf76.zip | |
Add tcs; it compiles in my world, but I haven't tried it in Russ's yet.
Diffstat (limited to 'src/cmd/tcs/font/font.c')
| -rw-r--r-- | src/cmd/tcs/font/font.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cmd/tcs/font/font.c b/src/cmd/tcs/font/font.c new file mode 100644 index 00000000..75e25128 --- /dev/null +++ b/src/cmd/tcs/font/font.c @@ -0,0 +1,34 @@ +#include <u.h> +#include <libc.h> +#include <libg.h> +#include <bio.h> +#include "hdr.h" + +Subfont * +bf(int n, int size, Bitmap *b, int *done) +{ + Fontchar *fc; + int i, j; + Subfont *f; + + fc = (Fontchar *)malloc(sizeof(Fontchar)*(n+1)); + if(fc == 0){ + fprint(2, "%s: fontchar malloc(%d) failure\n", argv0, sizeof(Fontchar)*(n+1)); + exits("fontchar malloc failure"); + } + j = 0; + for(i = 0; i <= n; i++){ + fc[i] = (Fontchar){j, 0, size, 0, size}; + if(done[i]) + j += size; + else + fc[i].width = 0; + } + fc[n] = (Fontchar){j, 0, size, 0, size}; + f = subfalloc(n, size, size*7/8, fc, b, ~0, ~0); + if(f == 0){ + fprint(2, "%s: falloc failure\n", argv0); + exits("falloc failure"); + } + return(f); +} |
