mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Added Font:setFallbacks(otherfont, ...). Resolves issue #1041.
Note that general font metrics are largely still based on the original (non-fallback) font, whereas glyph sizes are based on the fallback fonts when those are used to get the glyph.
This commit is contained in:
@@ -172,6 +172,18 @@ int w_Font_hasGlyphs(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Font_setFallbacks(lua_State *L)
|
||||
{
|
||||
Font *t = luax_checkfont(L, 1);
|
||||
std::vector<Font *> fallbacks;
|
||||
|
||||
for (int i = 2; i <= lua_gettop(L); i++)
|
||||
fallbacks.push_back(luax_checkfont(L, i));
|
||||
|
||||
luax_catchexcept(L, [&](){ t->setFallbacks(fallbacks); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getHeight", w_Font_getHeight },
|
||||
@@ -185,6 +197,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getDescent", w_Font_getDescent },
|
||||
{ "getBaseline", w_Font_getBaseline },
|
||||
{ "hasGlyphs", w_Font_hasGlyphs },
|
||||
{ "setFallbacks", w_Font_setFallbacks },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user