Skip to content

Commit 204ab38

Browse files
authored
Merge pull request #85 from Blitz54/fontin-fonts
2 parents 1096926 + bd84bf1 commit 204ab38

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

engine/render.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ enum r_fontAlign_e {
2626

2727
// Fonts
2828
enum r_fonts_e {
29-
F_FIXED, // Monospaced: Bitsteam Vera Sans Mono
30-
F_VAR, // Normal: Liberation Sans
31-
F_VAR_BOLD, // Normal: Liberation Sans Bold
29+
F_FIXED, // Monospaced: Bitsteam Vera Sans Mono
30+
F_VAR, // Normal: Liberation Sans
31+
F_VAR_BOLD, // Normal: Liberation Sans Bold
32+
F_FONTIN_SC, // Normal: Fontin Small Caps
33+
F_FONTIN_SC_ITALIC, // Normal: Fontin Small Caps Italic
34+
F_FONTIN_ITALIC, // Normal: Fontin Italic
3235
F_NUMFONTS
3336
};
3437

engine/render/r_main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,9 @@ void r_renderer_c::Init(r_featureFlag_e features)
10891089
fonts[F_FIXED] = new r_font_c(this, "Bitstream Vera Sans Mono");
10901090
fonts[F_VAR] = new r_font_c(this, "Liberation Sans");
10911091
fonts[F_VAR_BOLD] = new r_font_c(this, "Liberation Sans Bold");
1092+
fonts[F_FONTIN_SC] = new r_font_c(this, "Fontin SmallCaps");
1093+
fonts[F_FONTIN_SC_ITALIC] = new r_font_c(this, "Fontin SmallCaps Italic");
1094+
fonts[F_FONTIN_ITALIC] = new r_font_c(this, "Fontin Italic");
10921095

10931096
sys->con->Printf("Renderer initialised in %d msec.\n", timer.Get());
10941097
}

ui_api.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
** SetDrawColor(red, green, blue[, alpha]) / SetDrawColor("<escapeStr>")
6363
** DrawImage({imgHandle|nil}, left, top, width, height[, tcLeft, tcTop, tcRight, tcBottom][, stackIdx[, maskIdx]]) maskIdx: use a stack layer as multiplicative mask
6464
** DrawImageQuad({imgHandle|nil}, x1, y1, x2, y2, x3, y3, x4, y4[, s1, t1, s2, t2, s3, t3, s4, t4][, stackIdx[, maskIdx]])
65-
** DrawString(left, top, align{"LEFT"|"CENTER"|"RIGHT"|"CENTER_X"|"RIGHT_X"}, height, font{"FIXED"|"VAR"|"VAR BOLD"}, "<text>")
66-
** width = DrawStringWidth(height, font{"FIXED"|"VAR"|"VAR BOLD"}, "<text>")
67-
** index = DrawStringCursorIndex(height, font{"FIXED"|"VAR"|"VAR BOLD"}, "<text>", cursorX, cursorY)
65+
** 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>")
66+
** width = DrawStringWidth(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC|"FONTIN ITALIC"}, "<text>")
67+
** index = DrawStringCursorIndex(height, font{"FIXED"|"VAR"|"VAR BOLD"|"FONTIN SC"|"FONTIN SC ITALIC|"FONTIN ITALIC"}, "<text>", cursorX, cursorY)
6868
** str = StripEscapes("<string>")
6969
** count = GetAsyncCount()
7070
**
@@ -1068,7 +1068,7 @@ static int l_DrawString(lua_State* L)
10681068
ui->LAssert(L, lua_isstring(L, 5), "DrawString() argument 5: expected string, got %s", luaL_typename(L, 5));
10691069
ui->LAssert(L, lua_isstring(L, 6), "DrawString() argument 6: expected string, got %s", luaL_typename(L, 6));
10701070
static const char* alignMap[6] = { "LEFT", "CENTER", "RIGHT", "CENTER_X", "RIGHT_X", NULL };
1071-
static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", NULL };
1071+
static const char* fontMap[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL};
10721072
const float dpiScale = ui->renderer->VirtualScreenScaleFactor();
10731073
const float left = lua_tonumber(L, 1) * dpiScale;
10741074
const float top = lua_tonumber(L, 2) * dpiScale;
@@ -1101,7 +1101,7 @@ static int l_DrawStringWidth(lua_State* L)
11011101
ui->LAssert(L, lua_isnumber(L, 1), "DrawStringWidth() argument 1: expected number, got %s", luaL_typename(L, 1));
11021102
ui->LAssert(L, lua_isstring(L, 2), "DrawStringWidth() argument 2: expected string, got %s", luaL_typename(L, 2));
11031103
ui->LAssert(L, lua_isstring(L, 3), "DrawStringWidth() argument 3: expected string, got %s", luaL_typename(L, 3));
1104-
static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", NULL };
1104+
static const char* fontMap[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL };
11051105
const float dpiScale = ui->renderer->VirtualScreenScaleFactor();
11061106
const lua_Number logicalHeight = lua_tonumber(L, 1);
11071107
int scaledHeight = static_cast<int>(std::lround(logicalHeight * dpiScale));
@@ -1131,7 +1131,7 @@ static int l_DrawStringCursorIndex(lua_State* L)
11311131
ui->LAssert(L, lua_isstring(L, 3), "DrawStringCursorIndex() argument 3: expected string, got %s", luaL_typename(L, 3));
11321132
ui->LAssert(L, lua_isnumber(L, 4), "DrawStringCursorIndex() argument 4: expected number, got %s", luaL_typename(L, 4));
11331133
ui->LAssert(L, lua_isnumber(L, 5), "DrawStringCursorIndex() argument 5: expected number, got %s", luaL_typename(L, 5));
1134-
static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", NULL };
1134+
static const char* fontMap[7] = { "FIXED", "VAR", "VAR BOLD", "FONTIN SC", "FONTIN SC ITALIC", "FONTIN ITALIC", NULL };
11351135
const lua_Number logicalHeight = lua_tonumber(L, 1);
11361136
const lua_Number logicalCursorX = lua_tonumber(L, 4);
11371137
const lua_Number logicalCursorY = lua_tonumber(L, 5);

0 commit comments

Comments
 (0)