tsubfont.c - 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
---
tsubfont.c (561B)
---
1 #include <u.h>
2 #include <libc.h>
3 #include <draw.h>
4 #include <memdraw.h>
5
6 Memsubfont*
7 allocmemsubfont(char *name, int n, int height, int ascent, Fontchar *info, Memimage *i)
8 {
9 Memsubfont *f;
10
11 f = malloc(sizeof(Memsubfont));
12 if(f == 0)
13 return 0;
14 f->n = n;
15 f->height = height;
16 f->ascent = ascent;
17 f->info = info;
18 f->bits = i;
19 if(name)
20 f->name = strdup(name);
21 else
22 f->name = 0;
23 return f;
24 }
25
26 void
27 freememsubfont(Memsubfont *f)
28 {
29 if(f == 0)
30 return;
31 free(f->info); /* note: f->info must have been malloc'ed! */
32 freememimage(f->bits);
33 free(f);
34 }