2011-03-30 15:46:40 +03:00
|
|
|
#include <u.h>
|
|
|
|
#include <libc.h>
|
|
|
|
#include <draw.h>
|
|
|
|
|
|
|
|
Subfont*
|
|
|
|
allocsubfont(char *name, int n, int height, int ascent, Fontchar *info, Image *i)
|
|
|
|
{
|
|
|
|
Subfont *f;
|
|
|
|
|
|
|
|
assert(height != 0 /* allocsubfont */);
|
|
|
|
|
|
|
|
f = malloc(sizeof(Subfont));
|
2015-03-02 11:01:12 +01:00
|
|
|
if(f == nil)
|
|
|
|
return nil;
|
2011-03-30 15:46:40 +03:00
|
|
|
f->n = n;
|
|
|
|
f->height = height;
|
|
|
|
f->ascent = ascent;
|
|
|
|
f->info = info;
|
|
|
|
f->bits = i;
|
|
|
|
f->ref = 1;
|
|
|
|
if(name){
|
|
|
|
f->name = strdup(name);
|
2015-03-02 11:01:12 +01:00
|
|
|
if(f->name == nil){
|
|
|
|
free(f);
|
|
|
|
return nil;
|
|
|
|
}
|
2011-09-05 18:34:46 +02:00
|
|
|
installsubfont(name, f);
|
2011-03-30 15:46:40 +03:00
|
|
|
}else
|
2015-03-02 11:01:12 +01:00
|
|
|
f->name = nil;
|
2011-03-30 15:46:40 +03:00
|
|
|
return f;
|
|
|
|
}
|