From da6b7987f1738132cd629e0bb25ccb725fb75e83 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sun, 24 Jun 2018 11:00:21 -0400 Subject: [PATCH] freetype: Get DejaVuSansMono.ttf from the assets directory --- gfx/drivers_font_renderer/freetype.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gfx/drivers_font_renderer/freetype.c b/gfx/drivers_font_renderer/freetype.c index d690281e7c..73ffceacc2 100644 --- a/gfx/drivers_font_renderer/freetype.c +++ b/gfx/drivers_font_renderer/freetype.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include "../../configuration.h" #ifdef WIIU #include @@ -268,6 +270,7 @@ error: * but should hopefully work ... */ static const char *font_paths[] = { + "assets://pkg/DejaVuSansMono.ttf", #if defined(_WIN32) "C:\\Windows\\Fonts\\consola.ttf", "C:\\Windows\\Fonts\\verdana.ttf", @@ -295,9 +298,18 @@ static const char *font_renderer_ft_get_default_font(void) return ""; #else size_t i; + settings_t *settings = config_get_ptr(); + char asset_path[PATH_MAX_LENGTH]; for (i = 0; i < ARRAY_SIZE(font_paths); i++) { + /* Check if we are getting the font from the assets directory. */ + if (string_is_equal(font_paths[i], "assets://pkg/DejaVuSansMono.ttf")) + { + fill_pathname_join(asset_path, settings->paths.directory_assets, "pkg/DejaVuSansMono.ttf", PATH_MAX_LENGTH); + font_paths[i] = asset_path; + } + if (filestream_exists(font_paths[i])) return font_paths[i]; }