mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge pull request #6915 from RobLoach/osd-font
freetype: Allow getting OSD Font from Assets Directory
This commit is contained in:
commit
3bdc7ca352
@ -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,8 @@ error:
|
||||
* but should hopefully work ... */
|
||||
|
||||
static const char *font_paths[] = {
|
||||
/* Assets directory OSD Font, @see font_renderer_ft_get_default_font() */
|
||||
"assets://pkg/osd-font.ttf",
|
||||
#if defined(_WIN32)
|
||||
"C:\\Windows\\Fonts\\consola.ttf",
|
||||
"C:\\Windows\\Fonts\\verdana.ttf",
|
||||
@ -295,9 +299,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/osd-font.ttf"))
|
||||
{
|
||||
fill_pathname_join(asset_path, settings->paths.directory_assets, "pkg/osd-font.ttf", PATH_MAX_LENGTH);
|
||||
font_paths[i] = asset_path;
|
||||
}
|
||||
|
||||
if (filestream_exists(font_paths[i]))
|
||||
return font_paths[i];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user