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:
Alex Szpakowski
2015-05-02 18:07:35 -03:00
parent 4e1011a52e
commit a35ccb4426
4 changed files with 72 additions and 8 deletions
+13
View File
@@ -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 }
};