Mercurial > repos > blastem
comparison nuklear_ui/font.c @ 1934:253c62b7144e
Allow specifying a default font path at build time
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 18 Apr 2020 23:07:44 -0700 |
parents | 24508cb54f87 |
children | 3dd9c68472fb |
comparison
equal
deleted
inserted
replaced
1933:16a795cababd | 1934:253c62b7144e |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <stdint.h> | 3 #include <stdint.h> |
4 #include <string.h> | |
4 #include "../util.h" | 5 #include "../util.h" |
5 #include "sfnt.h" | 6 #include "sfnt.h" |
6 | 7 |
7 char *default_font_path(void) | 8 char *default_font_path(void) |
8 { | 9 { |
10 #ifdef FONT_PATH | |
11 FILE *f = fopen(FONT_PATH, "rb"); | |
12 if (f) { | |
13 fclose(f); | |
14 return strdup(FONT_PATH); | |
15 } | |
16 #endif | |
9 FILE *fc_pipe = popen("fc-match -f '%{file}'", "r"); | 17 FILE *fc_pipe = popen("fc-match -f '%{file}'", "r"); |
10 if (!fc_pipe) { | 18 if (!fc_pipe) { |
11 return NULL; | 19 return NULL; |
12 } | 20 } |
13 size_t buf_size = 128; | 21 size_t buf_size = 128; |