vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

subfont.c (560B)


      1 #include "u.h"
      2 #include "lib.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 }