diff 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
line wrap: on
line diff
--- a/nuklear_ui/font.c	Sat Apr 18 22:44:17 2020 -0700
+++ b/nuklear_ui/font.c	Sat Apr 18 23:07:44 2020 -0700
@@ -1,11 +1,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <string.h>
 #include "../util.h"
 #include "sfnt.h"
 
 char *default_font_path(void)
 {
+#ifdef FONT_PATH
+	FILE *f = fopen(FONT_PATH, "rb");
+	if (f) {
+		fclose(f);
+		return strdup(FONT_PATH);
+	}
+#endif
 	FILE *fc_pipe = popen("fc-match -f '%{file}'", "r");
 	if (!fc_pipe) {
 		return NULL;