mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-03 13:51:02 +00:00
Add gfx/fonts/fonts.c.
This commit is contained in:
parent
5700febb2c
commit
7d4278a29b
56
gfx/fonts/fonts.c
Normal file
56
gfx/fonts/fonts.c
Normal file
@ -0,0 +1,56 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fonts.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
static const font_renderer_driver_t *backends[] = {
|
||||
#ifdef HAVE_FREETYPE
|
||||
&ft_font_renderer,
|
||||
#endif
|
||||
&bitmap_font_renderer,
|
||||
};
|
||||
|
||||
bool font_renderer_create_default(const font_renderer_driver_t **driver, font_renderer_t **handle)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(backends); i++)
|
||||
{
|
||||
const char *font_path = *g_settings.video.font_path ? g_settings.video.font_path : NULL;
|
||||
if (!font_path)
|
||||
font_path = backends[i]->get_default_font();
|
||||
|
||||
if (!font_path)
|
||||
continue;
|
||||
|
||||
*handle = backends[i]->init(font_path, g_settings.video.font_size);
|
||||
if (*handle)
|
||||
{
|
||||
RARCH_LOG("Using font rendering backend: %s.\n", backends[i]->ident);
|
||||
*driver = backends[i];
|
||||
return true;
|
||||
}
|
||||
else
|
||||
RARCH_ERR("Failed to create rendering backend: %s.\n", backends[i]->ident);
|
||||
}
|
||||
|
||||
*driver = NULL;
|
||||
*handle = NULL;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user