aboutsummaryrefslogtreecommitdiffstats
path: root/libskrift_open_font_file.c
blob: 2a122ef524779fd9c34535458686cd910c20083d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* See LICENSE file for copyright and license details. */
#include "common.h"

int
libskrift_open_font_file(LIBSKRIFT_FONT **fontp, const char *path)
{
	*fontp = calloc(1, sizeof(**fontp));
	if (!*fontp)
		return -1;
	(*fontp)->refcount = 1;
	(*fontp)->font = sft_loadfile(path);
	if (!(*fontp)->font) {
		free(*fontp);
		*fontp = NULL;
		return -1;
	}
	return 0;
}