Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tangara-fw/lib/luavgl/src/font.c

23 lines
514 B

#include "luavgl.h"
#include "private.h"
static int luavgl_font_create(lua_State *L)
{
if (!lua_isstring(L, 1)) {
return luaL_argerror(L, 1, "expect string");
}
if (!lua_isfunction(L, 2)) {
return luaL_argerror(L, 1, "expect function");
}
luavgl_ctx_t *ctx = luavgl_context(L);
if (!ctx->make_font) {
return luaL_error(L, "cannot create font");
}
const char *name = lua_tostring(L, 1);
int cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
ctx->make_font(L, name, cb_ref);
return 0;
}