(gl_font_renderer_t) Add get_glyph() function pointer

This commit is contained in:
Higor Eurípedes 2014-09-12 22:39:29 -03:00
parent 0c1a2dd8d7
commit 81ff623957
2 changed files with 15 additions and 0 deletions

View File

@ -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;

View File

@ -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,
};