mirror of
https://github.com/love2d/love.git
synced 2026-08-12 00:20:52 +02:00
Revert change that added codepoint variant of Font:getWidth.
It could break code that relied on Lua's implicit conversion from numbers to strings.
This commit is contained in:
@@ -5,7 +5,6 @@ Released: N/A
|
||||
|
||||
* Added Body:getLocalPoints.
|
||||
* Added Font:getKerning.
|
||||
* Added a variant of Font:getWidth which takes a codepoint number argument.
|
||||
* Added support for r16, rg16, and rgba16 pixel formats in Canvases.
|
||||
* Added Shader:send(name, matrixlayout, data, ...) variant, whose argument order is more consistent than Shader:send(name, data, matrixlayout, ...).
|
||||
|
||||
|
||||
@@ -86,16 +86,8 @@ int w_Font_getHeight(lua_State *L)
|
||||
int w_Font_getWidth(lua_State *L)
|
||||
{
|
||||
Font *t = luax_checkfont(L, 1);
|
||||
if (lua_type(L, 2) == LUA_TSTRING)
|
||||
{
|
||||
const char *str = luaL_checkstring(L, 2);
|
||||
luax_catchexcept(L, [&](){ lua_pushinteger(L, t->getWidth(str)); });
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 glyph = (uint32) luaL_checknumber(L, 2);
|
||||
luax_catchexcept(L, [&](){ lua_pushinteger(L, t->getWidth(glyph)); });
|
||||
}
|
||||
const char *str = luaL_checkstring(L, 2);
|
||||
luax_catchexcept(L, [&](){ lua_pushinteger(L, t->getWidth(str)); });
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user