freetype: Get DejaVuSansMono.ttf from the assets directory

This commit is contained in:
Rob Loach 2018-06-24 11:00:21 -04:00
parent c10aab9830
commit da6b7987f1
No known key found for this signature in database
GPG Key ID: 627C60834A74A21A

View File

@ -24,6 +24,8 @@
#include <file/file_path.h>
#include <streams/file_stream.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include "../../configuration.h"
#ifdef WIIU
#include <wiiu/os.h>
@ -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];
}