mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 21:40:40 +00:00
Pass float font sizes to cores.
This commit is contained in:
parent
7d1571e637
commit
88df35578d
@ -17,6 +17,8 @@
|
|||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "../../msvc/msvc_compat.h"
|
||||||
#include "../../boolean.h"
|
#include "../../boolean.h"
|
||||||
|
|
||||||
struct font_renderer
|
struct font_renderer
|
||||||
@ -45,13 +47,13 @@ static void char_to_texture(font_renderer_t *handle, uint8_t letter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *font_renderer_init(const char *font_path, unsigned font_size)
|
static void *font_renderer_init(const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
font_renderer_t *handle = (font_renderer_t*)calloc(1, sizeof(*handle));
|
font_renderer_t *handle = (font_renderer_t*)calloc(1, sizeof(*handle));
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
handle->scale_factor = font_size / FONT_HEIGHT;
|
handle->scale_factor = (unsigned)round(font_size / FONT_HEIGHT);
|
||||||
if (!handle->scale_factor)
|
if (!handle->scale_factor)
|
||||||
handle->scale_factor = 1;
|
handle->scale_factor = 1;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ struct font_output_list
|
|||||||
|
|
||||||
typedef struct font_renderer_driver
|
typedef struct font_renderer_driver
|
||||||
{
|
{
|
||||||
void *(*init)(const char *font_path, unsigned font_size);
|
void *(*init)(const char *font_path, float font_size);
|
||||||
void (*render_msg)(void *data, const char *msg, struct font_output_list *output);
|
void (*render_msg)(void *data, const char *msg, struct font_output_list *output);
|
||||||
void (*free_output)(void *data, struct font_output_list *list);
|
void (*free_output)(void *data, struct font_output_list *list);
|
||||||
void (*free)(void *data);
|
void (*free)(void *data);
|
||||||
|
@ -41,7 +41,7 @@ static void ft_renderer_free(void *data)
|
|||||||
free(handle);
|
free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *ft_renderer_init(const char *font_path, unsigned font_size)
|
static void *ft_renderer_init(const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
(void)font_size;
|
(void)font_size;
|
||||||
FT_Error err;
|
FT_Error err;
|
||||||
|
@ -25,7 +25,7 @@ static const gl_font_renderer_t *gl_font_backends[] = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const gl_font_renderer_t *gl_font_init_first(void *data, const char *font_path, unsigned font_size)
|
const gl_font_renderer_t *gl_font_init_first(void *data, const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < ARRAY_SIZE(gl_font_backends); i++)
|
for (unsigned i = 0; i < ARRAY_SIZE(gl_font_backends); i++)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
typedef struct gl_font_renderer
|
typedef struct gl_font_renderer
|
||||||
{
|
{
|
||||||
bool (*init)(void *data, const char *font_path, unsigned font_size);
|
bool (*init)(void *data, const char *font_path, float font_size);
|
||||||
void (*deinit)(void *data);
|
void (*deinit)(void *data);
|
||||||
void (*render_msg)(void *data, const char *msg);
|
void (*render_msg)(void *data, const char *msg);
|
||||||
void (*render_msg_place)(void *data, float x, float y,
|
void (*render_msg_place)(void *data, float x, float y,
|
||||||
@ -33,7 +33,7 @@ extern const gl_font_renderer_t gl_raster_font;
|
|||||||
extern const gl_font_renderer_t libdbg_font;
|
extern const gl_font_renderer_t libdbg_font;
|
||||||
|
|
||||||
const gl_font_renderer_t *gl_font_init_first(void *data,
|
const gl_font_renderer_t *gl_font_init_first(void *data,
|
||||||
const char *font_path, unsigned font_size);
|
const char *font_path, float font_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -16,11 +16,12 @@
|
|||||||
|
|
||||||
#include "../gl_common.h"
|
#include "../gl_common.h"
|
||||||
|
|
||||||
static bool gl_init_font(void *data, const char *font_path, unsigned font_size)
|
static bool gl_init_font(void *data, const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
if (!g_settings.video.font_enable)
|
if (!g_settings.video.font_enable)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
(void)font_size;
|
||||||
gl_t *gl = (gl_t*)data;
|
gl_t *gl = (gl_t*)data;
|
||||||
|
|
||||||
if (font_renderer_create_default(&gl->font_driver, &gl->font))
|
if (font_renderer_create_default(&gl->font_driver, &gl->font))
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#define DbgFontDraw cellDbgFontDraw
|
#define DbgFontDraw cellDbgFontDraw
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool gl_init_font(void *data, const char *font_path, unsigned font_size)
|
static bool gl_init_font(void *data, const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
(void)font_path;
|
(void)font_path;
|
||||||
(void)font_size;
|
(void)font_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user