mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Restore 0-argument love.graphics.newFont/love.font.newRasterizer
Fix subtle bug in luax_convobj in the process, it couldn't deal with 0 arguments before.
This commit is contained in:
@@ -37,7 +37,7 @@ namespace font
|
||||
|
||||
int w_newRasterizer(lua_State *L)
|
||||
{
|
||||
if (lua_type(L, 1) == LUA_TNUMBER || lua_type(L, 2) == LUA_TNUMBER)
|
||||
if (lua_type(L, 1) == LUA_TNUMBER || lua_type(L, 2) == LUA_TNUMBER || lua_isnone(L, 1))
|
||||
{
|
||||
// First or second argument is a number: call newTrueTypeRasterizer.
|
||||
return w_newTrueTypeRasterizer(L);
|
||||
@@ -69,10 +69,10 @@ int w_newTrueTypeRasterizer(lua_State *L)
|
||||
Rasterizer *t = nullptr;
|
||||
TrueTypeRasterizer::Hinting hinting = TrueTypeRasterizer::HINTING_NORMAL;
|
||||
|
||||
if (lua_type(L, 1) == LUA_TNUMBER)
|
||||
if (lua_type(L, 1) == LUA_TNUMBER || lua_isnone(L, 1))
|
||||
{
|
||||
// First argument is a number: use the default TrueType font.
|
||||
int size = luaL_checkint(L, 1);
|
||||
int size = luaL_optint(L, 1, 12);
|
||||
|
||||
const char *hintstr = lua_isnoneornil(L, 2) ? nullptr : luaL_checkstring(L, 2);
|
||||
if (hintstr && !TrueTypeRasterizer::getConstant(hintstr, hinting))
|
||||
|
||||
Reference in New Issue
Block a user