# HG changeset patch # User Michael Pavone # Date 1587276464 25200 # Node ID 253c62b7144ebd7245ef195734d8e45be11c810c # Parent 16a795cababdec474c254725aeb743a1dfa5726f Allow specifying a default font path at build time diff -r 16a795cababd -r 253c62b7144e Makefile --- a/Makefile Sat Apr 18 22:44:17 2020 -0700 +++ b/Makefile Sat Apr 18 23:07:44 2020 -0700 @@ -255,6 +255,10 @@ CFLAGS+= -DDATA_PATH='"'$(DATA_PATH)'"' endif +ifdef FONT_PATH +CFLAGS+= -DFONT_PATH='"'$(FONT_PATH)'"' +endif + ALL=dis$(EXE) zdis$(EXE) stateview$(EXE) vgmplay$(EXE) blastem$(EXE) ifneq ($(OS),Windows) ALL+= termhelper diff -r 16a795cababd -r 253c62b7144e nuklear_ui/font.c --- 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 #include #include +#include #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;