diff options
author | Rich Felker <dalias@aerifal.cx> | 2006-10-05 21:10:32 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2006-10-05 21:10:32 +0000 |
commit | cffa2eeb2052df70c52fc720add9fe7e31b314e7 (patch) | |
tree | d4c80a2f080f3419959e54a462f259776bb37ab4 /font_load.c | |
parent | dc6a00a52f6df3c7e66c6535c2489f51fa1fa13a (diff) |
the big UCF-font commit!
still a little bit messy, but it works quite well already
more to come soon.
Diffstat (limited to 'font_load.c')
-rw-r--r-- | font_load.c | 18 |
1 files changed, 18 insertions, 0 deletions
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 <fcntl.h> +#include <unistd.h> +#include <sys/mman.h> + +#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); +} |