diff --git a/src/loaders.inc b/src/loaders.inc index f354906..e50458b 100644 --- a/src/loaders.inc +++ b/src/loaders.inc @@ -333,21 +333,11 @@ static int texloader(void *ud, struct ResManRes *res) { } static int fontloader(void *ud, struct ResManRes *res) { - FILE *fntf = fopen(res->name, "rb"); - fseek(fntf, 0, SEEK_END); - size_t fntfsz = ftell(fntf); - fseek(fntf, 0, SEEK_SET); - char *fntbuf = malloc(fntfsz); - fread(fntbuf, 1, fntfsz, fntf); + char namebuf[256]; + snprintf(namebuf, sizeof(namebuf), "assets/%s", res->name); struct k3Font *fnt = k3FontCreate(); - struct k3Tex *fnttexldr(struct k3Font *fnt, const char *name) { - return resman_ref(RESMAN_TEXTURE, name); - } - k3FontLoad(fnt, fntbuf, fntfsz, fnttexldr); - - free(fntbuf); - + k3FontLoad(fnt, namebuf); res->thing = fnt; return 1; diff --git a/src/luaapi.c b/src/luaapi.c index b5c8838..d5f9948 100644 --- a/src/luaapi.c +++ b/src/luaapi.c @@ -1909,7 +1909,7 @@ static int dagame_draw(lua_State *L) { float b = lua_type(L, -2) == LUA_TNUMBER ? lua_tonumber(L, -2) : 1; float a = lua_type(L, -1) == LUA_TNUMBER ? lua_tonumber(L, -1) : 1; - k3BatchAdd(tex, (struct k3RectF) {.x = sx, .y = sy, .w = sw, .h = sh}, (struct k3RectF) {.x = x, .y = y, .w = w, .h = h}, 0, (vec4) {r, g, b, a}, 0); + k3BatchAdd(tex, (struct k3RectF) {.x = sx, .y = sy, .w = sw, .h = sh}, (struct k3RectF) {.x = x, .y = y, .w = w, .h = h}, 0, (vec4) {r, g, b, a}, 0, 0); lua_pop(L, 13); } else { @@ -3373,7 +3373,8 @@ void luaapi_init() { luaL_requiref(L, LUA_STRLIBNAME, luaopen_string, 1); luaL_requiref(L, LUA_MATHLIBNAME, luaopen_math, 1); luaL_requiref(L, LUA_DBLIBNAME, luaopen_debug, 1); - lua_pop(L, 5); + luaL_requiref(L, LUA_UTF8LIBNAME, luaopen_utf8, 1); + lua_pop(L, 6); k3Log(k3_DEBUG, "Setting custom require");