diff --git a/gfx/fonts/gl_font.h b/gfx/fonts/gl_font.h index 259f16c8d6..8986510813 100644 --- a/gfx/fonts/gl_font.h +++ b/gfx/fonts/gl_font.h @@ -19,6 +19,8 @@ #include "../../driver.h" #include "../../boolean.h" +struct font_glyph; + typedef struct gl_font_renderer { void *(*init)(void *data, const char *font_path, float font_size); @@ -26,6 +28,8 @@ typedef struct gl_font_renderer void (*render_msg)(void *data, const char *msg, const struct font_params *parms); const char *ident; + + const struct font_glyph *(*get_glyph)(void *data, uint32_t code); } gl_font_renderer_t; extern gl_font_renderer_t gl_raster_font; diff --git a/gfx/fonts/gl_raster_font.c b/gfx/fonts/gl_raster_font.c index 1d8a48e668..41dff670ba 100644 --- a/gfx/fonts/gl_raster_font.c +++ b/gfx/fonts/gl_raster_font.c @@ -265,9 +265,20 @@ static void gl_render_msg(void *data, const char *msg, gl_set_viewport(gl, gl->win_width, gl->win_height, false, true); } +static const struct font_glyph *gl_get_glyph(void *data, uint32_t code) +{ + gl_raster_t *font = (gl_raster_t*)data; + + if (!font) + return NULL; + + return font->font_driver->get_glyph(font->font_driver, code); +} + gl_font_renderer_t gl_raster_font = { gl_init_font, gl_free_font, gl_render_msg, "GL raster", + gl_get_glyph, };