From fe4442f6922f339c0c6ebc3923f77e0f71f75500 Mon Sep 17 00:00:00 2001 From: Blitz54 Date: Thu, 30 Oct 2025 11:35:56 -0500 Subject: [PATCH] Add regular fontin --- engine/render.h | 1 + engine/render/r_main.cpp | 1 + ui_api.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/engine/render.h b/engine/render.h index 6f19795..7ec2505 100644 --- a/engine/render.h +++ b/engine/render.h @@ -31,6 +31,7 @@ enum r_fonts_e { 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, // Normal: Fontin F_FONTIN_ITALIC, // Normal: Fontin Italic F_NUMFONTS }; diff --git a/engine/render/r_main.cpp b/engine/render/r_main.cpp index 93cad0a..7d22a37 100644 --- a/engine/render/r_main.cpp +++ b/engine/render/r_main.cpp @@ -1091,6 +1091,7 @@ void r_renderer_c::Init(r_featureFlag_e features) 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] = new r_font_c(this, "Fontin"); fonts[F_FONTIN_ITALIC] = new r_font_c(this, "Fontin Italic"); sys->con->Printf("Renderer initialised in %d msec.\n", timer.Get()); diff --git a/ui_api.cpp b/ui_api.cpp index 657b470..887c314 100644 --- a/ui_api.cpp +++ b/ui_api.cpp @@ -62,9 +62,9 @@ ** SetDrawColor(red, green, blue[, alpha]) / SetDrawColor("") ** 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"|"FONTIN SC"|"FONTIN SC ITALIC"|"FONTIN ITALIC"}, "") -** width = DrawStringWidth(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC|"FONTIN ITALIC"}, "") -** index = DrawStringCursorIndex(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC|"FONTIN ITALIC"}, "", 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"|"FONTIN ITALIC"}, "") +** width = DrawStringWidth(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC"|"FONTIN"|"FONTIN ITALIC"}, "") +** index = DrawStringCursorIndex(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC"|"FONTIN"|"FONTIN ITALIC"}, "", cursorX, cursorY) ** str = StripEscapes("") ** count = GetAsyncCount() ** @@ -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[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL}; + static const char* fontMap[8] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN", "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; @@ -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[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL }; + static const char* fontMap[8] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN", "FONTIN ITALIC", NULL }; const float dpiScale = ui->renderer->VirtualScreenScaleFactor(); const lua_Number logicalHeight = lua_tonumber(L, 1); int scaledHeight = static_cast(std::lround(logicalHeight * dpiScale)); @@ -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[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL }; + static const char* fontMap[8] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN", "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);