Pass float font sizes to cores.

This commit is contained in:
Themaister 2013-01-12 00:11:41 +01:00
parent 7d1571e637
commit 88df35578d
7 changed files with 12 additions and 9 deletions

View File

@ -17,6 +17,8 @@
#include "bitmap.h"
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "../../msvc/msvc_compat.h"
#include "../../boolean.h"
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));
if (!handle)
return NULL;
handle->scale_factor = font_size / FONT_HEIGHT;
handle->scale_factor = (unsigned)round(font_size / FONT_HEIGHT);
if (!handle->scale_factor)
handle->scale_factor = 1;

View File

@ -40,7 +40,7 @@ struct font_output_list
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 (*free_output)(void *data, struct font_output_list *list);
void (*free)(void *data);

View File

@ -41,7 +41,7 @@ static void ft_renderer_free(void *data)
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;
FT_Error err;

View File

@ -25,7 +25,7 @@ static const gl_font_renderer_t *gl_font_backends[] = {
#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++)
{

View File

@ -21,7 +21,7 @@
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 (*render_msg)(void *data, const char *msg);
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;
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

View File

@ -16,11 +16,12 @@
#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)
return false;
(void)font_size;
gl_t *gl = (gl_t*)data;
if (font_renderer_create_default(&gl->font_driver, &gl->font))

View File

@ -33,7 +33,7 @@
#define DbgFontDraw cellDbgFontDraw
#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_size;