Mercurial > repos > blastem
changeset 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 | 16a795cababd |
children | f23e70fb6607 |
files | Makefile nuklear_ui/font.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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;