]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libdraw/subfont.c
vncs: silence devdraw debug prints
[plan9front.git] / sys / src / libdraw / subfont.c
1 #include <u.h>
2 #include <libc.h>
3 #include <draw.h>
4
5 Subfont*
6 allocsubfont(char *name, int n, int height, int ascent, Fontchar *info, Image *i)
7 {
8         Subfont *f;
9
10         assert(height != 0 /* allocsubfont */);
11
12         f = malloc(sizeof(Subfont));
13         if(f == nil)
14                 return nil;
15         f->n = n;
16         f->height = height;
17         f->ascent = ascent;
18         f->info = info;
19         f->bits = i;
20         f->ref = 1;
21         if(name){
22                 f->name = strdup(name);
23                 if(f->name == nil){
24                         free(f);
25                         return nil;
26                 }
27                 installsubfont(name, f);
28         }else
29                 f->name = nil;
30         return f;
31 }