From cffa2eeb2052df70c52fc720add9fe7e31b314e7 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 5 Oct 2006 21:10:32 +0000 Subject: the big UCF-font commit! still a little bit messy, but it works quite well already more to come soon. --- font_load.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 font_load.c (limited to 'font_load.c') diff --git a/font_load.c b/font_load.c new file mode 100644 index 0000000..33f92dd --- /dev/null +++ b/font_load.c @@ -0,0 +1,18 @@ +#include +#include +#include + +#include "ucf.h" + +int ucf_load(struct ucf *f, const char *filename) +{ + int fd = open(filename, O_RDONLY); + unsigned char *map; + size_t l; + + if (fd < 0) return -1; + map = mmap(0, l=lseek(fd, 0, SEEK_END), PROT_READ, MAP_SHARED, fd, 0); + close(fd); + if (map == MAP_FAILED) return -1; + return ucf_init(f, map, l); +} -- cgit v1.2.1