diff --git a/gfx/fonts/bitmapfont.c b/gfx/fonts/bitmapfont.c index 7edf681cef..b7e25a36df 100644 --- a/gfx/fonts/bitmapfont.c +++ b/gfx/fonts/bitmapfont.c @@ -17,6 +17,8 @@ #include "bitmap.h" #include #include +#include +#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; diff --git a/gfx/fonts/fonts.h b/gfx/fonts/fonts.h index 32b4f5143e..eb6d746632 100644 --- a/gfx/fonts/fonts.h +++ b/gfx/fonts/fonts.h @@ -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); diff --git a/gfx/fonts/freetype.c b/gfx/fonts/freetype.c index 1721be717c..9d5acddd49 100644 --- a/gfx/fonts/freetype.c +++ b/gfx/fonts/freetype.c @@ -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; diff --git a/gfx/fonts/gl_font.c b/gfx/fonts/gl_font.c index 6c5490c587..2b75590b6f 100644 --- a/gfx/fonts/gl_font.c +++ b/gfx/fonts/gl_font.c @@ -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++) { diff --git a/gfx/fonts/gl_font.h b/gfx/fonts/gl_font.h index a9d79d965c..5566f0f15e 100644 --- a/gfx/fonts/gl_font.h +++ b/gfx/fonts/gl_font.h @@ -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 diff --git a/gfx/fonts/gl_raster_font.c b/gfx/fonts/gl_raster_font.c index 9fac55f1a5..c0490e4e74 100644 --- a/gfx/fonts/gl_raster_font.c +++ b/gfx/fonts/gl_raster_font.c @@ -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)) diff --git a/gfx/fonts/ps_libdbgfont.c b/gfx/fonts/ps_libdbgfont.c index 1e20f9774a..90174972a7 100644 --- a/gfx/fonts/ps_libdbgfont.c +++ b/gfx/fonts/ps_libdbgfont.c @@ -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;