mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 11:18:25 +00:00
b719c98db6
This commit fixes build issues for frontends that wish to use freetype2 or that do not want to use the built-in bitmap font: * Having HAVE_FREETYPE without DONT_HAVE_BITMAPFONT makes griffin.c include both freetype.c and bitmapfont.c resulting in a redefinition of 'struct font_renderer' (freetype.c:25 and bitmapfont.c:24). * Having both HAVE_FREETYPE and DONT_HAVE_BITMAPFONT resulted in linkage problems because griffin.c does not include fonts.c in this case and thus font_renderer_create_default() implementation is missing. If fonts.c is included, the linker complains about undefined reference to bitmap_font_renderer in fonts.c:27.
61 lines
1.8 KiB
C
61 lines
1.8 KiB
C
/* RetroArch - A frontend for libretro.
|
|
* Copyright (C) 2010-2014 - 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 *font_backends[] = {
|
|
#ifdef HAVE_FREETYPE
|
|
&ft_font_renderer,
|
|
#endif
|
|
#if !defined(DONT_HAVE_BITMAPFONTS)
|
|
&bitmap_font_renderer,
|
|
#endif
|
|
NULL
|
|
};
|
|
|
|
bool font_renderer_create_default(const font_renderer_driver_t **driver, void **handle)
|
|
{
|
|
unsigned i;
|
|
for (i = 0; font_backends[i]; i++)
|
|
{
|
|
const char *font_path = *g_settings.video.font_path ? g_settings.video.font_path : NULL;
|
|
if (!font_path)
|
|
font_path = font_backends[i]->get_default_font();
|
|
|
|
if (!font_path)
|
|
continue;
|
|
|
|
*handle = font_backends[i]->init(font_path, g_settings.video.font_size);
|
|
if (*handle)
|
|
{
|
|
RARCH_LOG("Using font rendering backend: %s.\n", font_backends[i]->ident);
|
|
*driver = font_backends[i];
|
|
return true;
|
|
}
|
|
else
|
|
RARCH_ERR("Failed to create rendering backend: %s.\n", font_backends[i]->ident);
|
|
}
|
|
|
|
*driver = NULL;
|
|
*handle = NULL;
|
|
return false;
|
|
}
|
|
|