summaryrefslogtreecommitdiff
path: root/hw/xfree86/loader/loadfont.c
blob: 8ab5d0d6e1860a35567c7aabe0ee0ea79d4c561e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadfont.c,v 1.2 1998/12/13 12:42:41 dawes Exp $ */

/* Maybe this file belongs in lib/font/fontfile/module/ ? */

#define LOADERDECLARATIONS
#include "loaderProcs.h"
#include "misc.h"
#include "xf86.h"

FontModule *FontModuleList = NULL;
static int numFontModules = 0;


static FontModule *
NewFontModule(void)
{
	FontModule *save = FontModuleList;
	int n;

	/* Sanity check */
	if (!FontModuleList)
		numFontModules = 0;

	n = numFontModules + 1;
	FontModuleList = xrealloc(FontModuleList, (n + 1) * sizeof(FontModule));
	if (FontModuleList == NULL) {
		FontModuleList = save;
		return NULL;
	} else {
		numFontModules++;
		FontModuleList[numFontModules].name = NULL;
		return FontModuleList + (numFontModules - 1);
	}
}

void
LoadFont(FontModule *f)
{
	FontModule *newfont;

	if (f == NULL)
		return;

	if (!(newfont = NewFontModule()))
		return;

	xf86MsgVerb(X_INFO, 2, "Loading font %s\n", f->name);

	newfont->name = f->name;
	newfont->initFunc = f->initFunc;
	newfont->module = f->module;
}