Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions engine/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ enum r_fontAlign_e {

// Fonts
enum r_fonts_e {
F_FIXED, // Monospaced: Bitsteam Vera Sans Mono
F_VAR, // Normal: Liberation Sans
F_VAR_BOLD, // Normal: Liberation Sans Bold
F_FIXED, // Monospaced: Bitsteam Vera Sans Mono
F_VAR, // Normal: Liberation Sans
F_VAR_BOLD, // Normal: Liberation Sans Bold
F_FONTIN_SC, // Normal: Fontin Small Caps
F_FONTIN_SC_ITALIC, // Normal: Fontin Small Caps Italic
F_FONTIN_ITALIC, // Normal: Fontin Italic
F_NUMFONTS
};

Expand Down
3 changes: 3 additions & 0 deletions engine/render/r_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,9 @@ void r_renderer_c::Init(r_featureFlag_e features)
fonts[F_FIXED] = new r_font_c(this, "Bitstream Vera Sans Mono");
fonts[F_VAR] = new r_font_c(this, "Liberation Sans");
fonts[F_VAR_BOLD] = new r_font_c(this, "Liberation Sans Bold");
fonts[F_FONTIN_SC] = new r_font_c(this, "Fontin SmallCaps");
fonts[F_FONTIN_SC_ITALIC] = new r_font_c(this, "Fontin SmallCaps Italic");
fonts[F_FONTIN_ITALIC] = new r_font_c(this, "Fontin Italic");

sys->con->Printf("Renderer initialised in %d msec.\n", timer.Get());
}
Expand Down
12 changes: 6 additions & 6 deletions ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
** SetDrawColor(red, green, blue[, alpha]) / SetDrawColor("<escapeStr>")
** DrawImage({imgHandle|nil}, left, top, width, height[, tcLeft, tcTop, tcRight, tcBottom][, stackIdx[, maskIdx]]) maskIdx: use a stack layer as multiplicative mask
** DrawImageQuad({imgHandle|nil}, x1, y1, x2, y2, x3, y3, x4, y4[, s1, t1, s2, t2, s3, t3, s4, t4][, stackIdx[, maskIdx]])
** DrawString(left, top, align{"LEFT"|"CENTER"|"RIGHT"|"CENTER_X"|"RIGHT_X"}, height, font{"FIXED"|"VAR"|"VAR BOLD"}, "<text>")
** width = DrawStringWidth(height, font{"FIXED"|"VAR"|"VAR BOLD"}, "<text>")
** index = DrawStringCursorIndex(height, font{"FIXED"|"VAR"|"VAR BOLD"}, "<text>", cursorX, cursorY)
** DrawString(left, top, align{"LEFT"|"CENTER"|"RIGHT"|"CENTER_X"|"RIGHT_X"}, height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC"|"FONTIN ITALIC"}, "<text>")
** width = DrawStringWidth(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC|"FONTIN ITALIC"}, "<text>")
** index = DrawStringCursorIndex(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC|"FONTIN ITALIC"}, "<text>", cursorX, cursorY)
** str = StripEscapes("<string>")
** count = GetAsyncCount()
**
Expand Down Expand Up @@ -1068,7 +1068,7 @@ static int l_DrawString(lua_State* L)
ui->LAssert(L, lua_isstring(L, 5), "DrawString() argument 5: expected string, got %s", luaL_typename(L, 5));
ui->LAssert(L, lua_isstring(L, 6), "DrawString() argument 6: expected string, got %s", luaL_typename(L, 6));
static const char* alignMap[6] = { "LEFT", "CENTER", "RIGHT", "CENTER_X", "RIGHT_X", NULL };
static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", NULL };
static const char* fontMap[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL};
const float dpiScale = ui->renderer->VirtualScreenScaleFactor();
const float left = lua_tonumber(L, 1) * dpiScale;
const float top = lua_tonumber(L, 2) * dpiScale;
Expand Down Expand Up @@ -1101,7 +1101,7 @@ static int l_DrawStringWidth(lua_State* L)
ui->LAssert(L, lua_isnumber(L, 1), "DrawStringWidth() argument 1: expected number, got %s", luaL_typename(L, 1));
ui->LAssert(L, lua_isstring(L, 2), "DrawStringWidth() argument 2: expected string, got %s", luaL_typename(L, 2));
ui->LAssert(L, lua_isstring(L, 3), "DrawStringWidth() argument 3: expected string, got %s", luaL_typename(L, 3));
static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", NULL };
static const char* fontMap[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL };
const float dpiScale = ui->renderer->VirtualScreenScaleFactor();
const lua_Number logicalHeight = lua_tonumber(L, 1);
int scaledHeight = static_cast<int>(std::lround(logicalHeight * dpiScale));
Expand Down Expand Up @@ -1131,7 +1131,7 @@ static int l_DrawStringCursorIndex(lua_State* L)
ui->LAssert(L, lua_isstring(L, 3), "DrawStringCursorIndex() argument 3: expected string, got %s", luaL_typename(L, 3));
ui->LAssert(L, lua_isnumber(L, 4), "DrawStringCursorIndex() argument 4: expected number, got %s", luaL_typename(L, 4));
ui->LAssert(L, lua_isnumber(L, 5), "DrawStringCursorIndex() argument 5: expected number, got %s", luaL_typename(L, 5));
static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", NULL };
static const char* fontMap[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL };
const lua_Number logicalHeight = lua_tonumber(L, 1);
const lua_Number logicalCursorX = lua_tonumber(L, 4);
const lua_Number logicalCursorY = lua_tonumber(L, 5);
Expand Down
Loading