Skip to content

Commit

Permalink
Added cre.setAsPreferredFontWithBias() (#505)
Browse files Browse the repository at this point in the history
Will allow crengine to use new default fonts when dealing with
css font-family.
  • Loading branch information
poire-z authored and Frenzie committed Sep 1, 2017
1 parent c4a9cc8 commit 5811241
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,20 @@ static int setFontFace(lua_State *L) {
return 0;
}

static int setAsPreferredFontWithBias(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
const char *face = luaL_checkstring(L, 2);
int bias = luaL_checkint(L, 3);
bool clearOthersBias = true;
if (lua_isboolean(L,4)) {
clearOthersBias = lua_toboolean(L, 4);
}

fontMan->SetAsPreferredFontWithBias(lString8(face), bias, clearOthersBias);

return 0;
}

static int gotoPage(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
int pageno = luaL_checkint(L, 2);
Expand Down Expand Up @@ -1529,6 +1543,7 @@ static const struct luaL_Reg credocument_meth[] = {
{"setHeaderInfo", setHeaderInfo},
{"setHeaderFont", setHeaderFont},
{"setFontFace", setFontFace},
{"setAsPreferredFontWithBias", setAsPreferredFontWithBias},
{"setFontSize", setFontSize},
{"setDefaultInterlineSpace", setDefaultInterlineSpace},
{"setStyleSheet", setStyleSheet},
Expand Down

0 comments on commit 5811241

Please sign in to comment.