Update members of FontStyle

This commit is contained in:
Gymnasiast committed 2025-11-03 23:25:30 +01:00
1 parent 124352c922
commit 0ec4e3353b
52 files changed
+140 -140

No files matched your search

+2 -2
View File
@@ -37,7 +37,7 @@ namespace OpenRCT2::Graph
char buffer[64]{};
FormatStringToBuffer(buffer, sizeof(buffer), fmt, curLabel);
DrawText(
rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::Small, TextAlignment::right },
rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::small, TextAlignment::right },
buffer);
// Draw Y label tick mark
Rectangle::fill(
@@ -69,7 +69,7 @@ namespace OpenRCT2::Graph
ft.Add<StringId>(DateGameShortMonthNames[DateGetMonth((yearOver32 / 4) + MONTH_COUNT)]);
DrawTextBasic(
rt, screenCoords - ScreenCoordsXY{ 0, 14 }, STR_GRAPH_LABEL, ft,
{ FontStyle::Small, TextAlignment::centre });
{ FontStyle::small, TextAlignment::centre });
// Draw month tick mark
Rectangle::fill(
rt, { screenCoords - ScreenCoordsXY{ 0, 4 }, screenCoords - ScreenCoordsXY{ 0, 1 } }, PaletteIndex::pi10);
+1 -1
View File
@@ -35,7 +35,7 @@ static InGameConsole _inGameConsole;
static FontStyle InGameConsoleGetFontStyle()
{
return (Config::Get().interface.consoleSmallFont ? FontStyle::Small : FontStyle::Medium);
return (Config::Get().interface.consoleSmallFont ? FontStyle::small : FontStyle::medium);
}
static int32_t InGameConsoleGetLineHeight()
+5 -5
View File
@@ -500,7 +500,7 @@ namespace OpenRCT2::Ui
auto ft = Formatter();
ft.Add<utf8*>(buffer);
DrawTextBasic(rt, { l, t }, STR_STRING, ft, { colour });
textRight = l + GfxGetStringWidth(buffer, FontStyle::Medium) + 1;
textRight = l + GfxGetStringWidth(buffer, FontStyle::medium) + 1;
}
// Border
@@ -1173,7 +1173,7 @@ namespace OpenRCT2::Ui
if (widget.text != 0)
{
u8string wrappedString;
GfxWrapString(widget.string, bottomRight.x - topLeft.x - 5, FontStyle::Medium, &wrappedString, nullptr);
GfxWrapString(widget.string, bottomRight.x - topLeft.x - 5, FontStyle::medium, &wrappedString, nullptr);
DrawText(rt, { topLeft.x + 2, topLeft.y }, { w.colours[1] }, wrappedString.c_str(), true);
}
return;
@@ -1182,7 +1182,7 @@ namespace OpenRCT2::Ui
// String length needs to add 12 either side of box
// +13 for cursor when max length.
u8string wrappedString;
GfxWrapString(*textInput->Buffer, bottomRight.x - topLeft.x - 5 - 6, FontStyle::Medium, &wrappedString, nullptr);
GfxWrapString(*textInput->Buffer, bottomRight.x - topLeft.x - 5 - 6, FontStyle::medium, &wrappedString, nullptr);
DrawText(rt, { topLeft.x + 2, topLeft.y }, { w.colours[1] }, wrappedString.c_str(), true);
@@ -1190,7 +1190,7 @@ namespace OpenRCT2::Ui
int32_t curX = topLeft.x
+ GfxGetStringWidthNoFormatting(
u8string_view{ wrappedString.c_str(), std::min(wrappedString.length(), textInput->SelectionStart) },
FontStyle::Medium)
FontStyle::medium)
+ 3;
int32_t width = 6;
@@ -1199,7 +1199,7 @@ namespace OpenRCT2::Ui
// Make a new 1 character wide string for measuring the width
// of the character that the cursor is under. (NOTE: this is broken for multi byte utf8 codepoints)
width = std::max(
GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::Medium)
GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::medium)
- 2,
4);
}
+1 -1
View File
@@ -729,7 +729,7 @@ void CustomListView::PaintSeparator(RenderTarget& rt, const ScreenCoordsXY& pos,
// Get string dimensions
utf8 stringBuffer[512]{};
FormatStringLegacy(stringBuffer, sizeof(stringBuffer), STR_STRING, ft.Data());
int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::Medium) / 2) + 4;
int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::medium) / 2) + 4;
int32_t strLeft = centreX - categoryStringHalfWidth;
int32_t strRight = centreX + categoryStringHalfWidth;
@@ -159,8 +159,8 @@ namespace OpenRCT2::Scripting
DukValue measureText(const std::string& text)
{
auto width = GfxGetStringWidth(text, FontStyle::Medium);
auto height = StringGetHeightRaw(text.c_str(), FontStyle::Medium);
auto width = GfxGetStringWidth(text, FontStyle::medium);
auto height = StringGetHeightRaw(text.c_str(), FontStyle::medium);
return ToDuk<ScreenSize>(_ctx, { width, height });
}
+1 -1
View File
@@ -232,7 +232,7 @@ namespace OpenRCT2::Ui::Windows
const auto& versionWidget = widgets[WIDX_VERSION];
auto centreX = versionWidget.midX();
auto centreY = versionWidget.midY() - FontGetLineHeight(FontStyle::Medium) / 2;
auto centreY = versionWidget.midY() - FontGetLineHeight(FontStyle::medium) / 2;
auto centrePos = windowPos + ScreenCoordsXY(centreX, centreY);
DrawTextWrapped(rt, centrePos, versionWidget.width(), STR_STRING, ft, { colours[1], TextAlignment::centre });
+3 -3
View File
@@ -177,7 +177,7 @@ namespace OpenRCT2::Ui::Windows
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
{
const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
const int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
ScreenCoordsXY screenCoords(3, 3 - lineHeight);
for (const auto& line : _changelogLines)
@@ -194,7 +194,7 @@ namespace OpenRCT2::Ui::Windows
{
return ScreenSize(
_changelogLongestLineWidth + 4,
static_cast<int32_t>(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium));
static_cast<int32_t>(_changelogLines.size()) * FontGetLineHeight(FontStyle::medium));
}
private:
@@ -271,7 +271,7 @@ namespace OpenRCT2::Ui::Windows
_changelogLongestLineWidth = 0;
for (const auto& line : _changelogLines)
{
int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::Medium);
int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::medium);
_changelogLongestLineWidth = std::max(linewidth, _changelogLongestLineWidth);
}
}
+1 -1
View File
@@ -124,7 +124,7 @@ namespace OpenRCT2::Ui::Windows
const auto& stringIdx = widgets[widgetIndex].text;
auto string = ls.GetString(stringIdx);
Guard::ArgumentNotNull(string);
const auto strWidth = GfxGetStringWidth(string, FontStyle::Medium);
const auto strWidth = GfxGetStringWidth(string, FontStyle::medium);
newWidth = std::max<int16_t>(strWidth, newWidth);
}
+1 -1
View File
@@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows
int32_t maxStringWidth = 0;
for (size_t i = 0; i < num_items; i++)
{
int32_t stringWidth = GfxGetStringWidth(gDropdown.items[i].text, FontStyle::Medium);
int32_t stringWidth = GfxGetStringWidth(gDropdown.items[i].text, FontStyle::medium);
if (gDropdown.items[i].type != Dropdown::ItemType::plain)
stringWidth += kDropdownItemLeftPadding;
maxStringWidth = std::max(stringWidth, maxStringWidth);
@@ -312,7 +312,7 @@ namespace OpenRCT2::Ui::Windows
// TODO: this parameter by itself produces very light text.
// It needs a {BLACK} token in the string to work properly.
ColourWithFlags colour = { COLOUR_BLACK };
FontStyle fontStyle = FontStyle::Medium;
FontStyle fontStyle = FontStyle::medium;
auto darkness = TextDarkness::regular;
if (researchItem.IsAlwaysResearched())
@@ -766,7 +766,7 @@ namespace OpenRCT2::Ui::Windows
if (*listItem.flags & (ObjectSelectionFlags::InUse | ObjectSelectionFlags::AlwaysRequired))
colour2.setFlag(ColourFlag::inset, true);
DrawText(rt, screenCoords, { colour2, FontStyle::Medium, darkness }, kCheckMarkString);
DrawText(rt, screenCoords, { colour2, FontStyle::medium, darkness }, kCheckMarkString);
}
screenCoords.x = gLegacyScene == LegacyScene::trackDesignsManager ? 0 : 15;
@@ -794,7 +794,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
ft.Add<const char*>(itemBuffer);
DrawTextEllipsised(
rt, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
rt, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::medium, darkness });
screenCoords.x = widgets[WIDX_LIST_SORT_RIDE].left - widgets[WIDX_LIST].left;
}
@@ -809,7 +809,7 @@ namespace OpenRCT2::Ui::Windows
}
auto ft = Formatter();
ft.Add<const char*>(itemBuffer);
DrawTextEllipsised(rt, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
DrawTextEllipsised(rt, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::medium, darkness });
}
screenCoords.y += kScrollableRowHeight;
}
@@ -2370,7 +2370,7 @@ namespace OpenRCT2::Ui::Windows
{
auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::extraDark : TextDarkness::dark;
DrawText(
rt, { 2, y }, { colours[1].withFlag(ColourFlag::translucent, false), FontStyle::Medium, darkness },
rt, { 2, y }, { colours[1].withFlag(ColourFlag::translucent, false), FontStyle::medium, darkness },
kCheckMarkString);
}
+4 -4
View File
@@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows
WindowDrawWidgets(*this, rt);
auto screenCoords = windowPos + ScreenCoordsXY{ (width + 1) / 2 - 1, kPadding - 1 };
DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::Medium);
DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::medium);
}
void onPeriodicUpdate() override
@@ -126,13 +126,13 @@ namespace OpenRCT2::Ui::Windows
windowMgr->CloseByClass(WindowClass::error);
// How wide is the error string?
int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::Medium);
int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::medium);
width = std::clamp(width + 2 * kPadding, kMinWidth, kMaxWidth);
// How high is the error string?
int32_t numLines{};
GfxWrapString(buffer, width + 1, FontStyle::Medium, &buffer, &numLines);
int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::Medium) + (2 * kPadding);
GfxWrapString(buffer, width + 1, FontStyle::medium, &buffer, &numLines);
int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::medium) + (2 * kPadding);
// Position error message around the cursor
const CursorState* state = ContextGetCursorState();
+1 -1
View File
@@ -831,7 +831,7 @@ namespace OpenRCT2::Ui::Windows
// dynamic padding for long axis labels:
char buffer[64]{};
FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{CURRENCY2DP}", centredGraph ? -max : max);
int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1;
int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1;
const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y };
_graphBounds = { windowPos + ScreenCoordsXY{ graphPageWidget->left + 4, graphPageWidget->top + 15 },
@@ -100,7 +100,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::FillMode::none);
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
auto& gameState = getGameState();
@@ -203,7 +203,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre });
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
// Temperature
screenCoords = { windowPos.x + rightPanelWidget.left + 15, static_cast<int32_t>(screenCoords.y + line_height + 1) };
@@ -363,7 +363,7 @@ namespace OpenRCT2::Ui::Windows
colours[0], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::none);
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
ScreenCoordsXY middleWidgetCoords(
windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1);
@@ -508,7 +508,7 @@ namespace OpenRCT2::Ui::Windows
void onPrepareDraw() override
{
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
// Reset dimensions as appropriate -- in case we're switching languages.
height = line_height * 2 + 12;
@@ -695,7 +695,7 @@ namespace OpenRCT2::Ui::Windows
int32_t screenHeight = ContextGetHeight();
// Figure out how much line height we have to work with.
uint32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
uint32_t lineHeight = FontGetLineHeight(FontStyle::medium);
int32_t toolbarHeight = lineHeight * 2 + 12;
auto* windowMgr = GetWindowManager();
+2 -2
View File
@@ -853,7 +853,7 @@ namespace OpenRCT2::Ui::Windows
{
auto ft = Formatter();
PeepThoughtSetFormatArgs(&peep->Thoughts[i], ft);
DrawTextBasic(rtMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::Small });
DrawTextBasic(rtMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::small });
}
}
@@ -1588,7 +1588,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
PeepThoughtSetFormatArgs(&thought, ft);
screenCoords.y += DrawTextWrapped(rt, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::Small });
screenCoords.y += DrawTextWrapped(rt, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::small });
// If this is the last visible line end drawing.
if (screenCoords.y > windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 32)
+2 -2
View File
@@ -699,7 +699,7 @@ namespace OpenRCT2::Ui::Windows
ft = Formatter();
PeepThoughtSetFormatArgs(&thought, ft);
DrawTextEllipsised(rt, { 118, y }, 329, format, ft, { FontStyle::Small });
DrawTextEllipsised(rt, { 118, y }, 329, format, ft, { FontStyle::small });
break;
}
break;
@@ -744,7 +744,7 @@ namespace OpenRCT2::Ui::Windows
// Draw small font if displaying guests
if (_selectedView == GuestViewType::Thoughts)
{
DrawTextEllipsised(rt, { 0, y }, 414, format, ft, { FontStyle::Small });
DrawTextEllipsised(rt, { 0, y }, 414, format, ft, { FontStyle::small });
}
else
{
+6 -6
View File
@@ -319,7 +319,7 @@ namespace OpenRCT2::Ui::Windows
// Check how this date is represented (e.g. 2000-02-20, or 00/02/20)
std::string date = Platform::FormatShortDate(long_time);
maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::Medium) + kDateTimeGap;
maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap;
// Some locales do not use leading zeros for months and days, so let's try October, too.
tm.tm_mon = 10;
@@ -328,12 +328,12 @@ namespace OpenRCT2::Ui::Windows
// Again, check how this date is represented (e.g. 2000-10-20, or 00/10/20)
date = Platform::FormatShortDate(long_time);
maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::Medium) + kDateTimeGap);
maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap);
// Time appears to be universally represented with two digits for minutes, so 12:00 or 00:00 should be
// representable.
std::string time = Platform::FormatTime(long_time);
maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::Medium) + kDateTimeGap;
maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::medium) + kDateTimeGap;
}
void LoadPreview()
@@ -705,7 +705,7 @@ namespace OpenRCT2::Ui::Windows
// Get 'Save' button string width
auto saveLabel = LanguageGetString(STR_FILEBROWSER_SAVE_BUTTON);
auto saveLabelWidth = GfxGetStringWidth(saveLabel, FontStyle::Medium) + 12;
auto saveLabelWidth = GfxGetStringWidth(saveLabel, FontStyle::medium) + 12;
widgets[WIDX_SAVE].type = WidgetType::button;
widgets[WIDX_SAVE].top = height - paddingBottom - 15;
@@ -715,7 +715,7 @@ namespace OpenRCT2::Ui::Windows
// Get 'Filename:' string width
auto filenameLabel = LanguageGetString(STR_FILENAME_LABEL);
auto filenameLabelWidth = GfxGetStringWidth(filenameLabel, FontStyle::Medium);
auto filenameLabelWidth = GfxGetStringWidth(filenameLabel, FontStyle::medium);
widgets[WIDX_FILENAME_TEXTBOX].type = WidgetType::textBox;
widgets[WIDX_FILENAME_TEXTBOX].top = height - paddingBottom - 15;
@@ -740,7 +740,7 @@ namespace OpenRCT2::Ui::Windows
{
const auto& widget = widgets[WIDX_PARENT_FOLDER];
const auto pathWidth = widget.left - 8;
const auto shortPath = ShortenPath(_directory, pathWidth, FontStyle::Medium);
const auto shortPath = ShortenPath(_directory, pathWidth, FontStyle::medium);
// Format text
std::string buffer;
+2 -2
View File
@@ -1233,7 +1233,7 @@ namespace OpenRCT2::Ui::Windows
for (uint32_t i = 0; i < 4; i++)
{
const auto* labelStr = LanguageGetString(MapLabels[i]);
_firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium), _firstColumnWidth);
_firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium), _firstColumnWidth);
}
textOffset += _firstColumnWidth + 4;
@@ -1242,7 +1242,7 @@ namespace OpenRCT2::Ui::Windows
{
const auto* labelStr = LanguageGetString(MapLabels[i]);
minWidth = std::max(
static_cast<int16_t>(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium)), minWidth);
static_cast<int16_t>(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium)), minWidth);
}
width = std::max(minWidth, width);
_recalculateScrollbars = true;
+5 -5
View File
@@ -289,7 +289,7 @@ namespace OpenRCT2::Ui::Windows
_buffer += Network::GetPlayerName(player);
}
screenCoords.x = 0;
GfxClipString(_buffer.data(), 230, FontStyle::Medium);
GfxClipString(_buffer.data(), 230, FontStyle::medium);
DrawText(rt, screenCoords, { colour }, _buffer.c_str());
// Draw group name
@@ -300,7 +300,7 @@ namespace OpenRCT2::Ui::Windows
_buffer += "{BLACK}";
screenCoords.x = 173;
_buffer += Network::GetGroupName(group);
GfxClipString(_buffer.data(), 80, FontStyle::Medium);
GfxClipString(_buffer.data(), 80, FontStyle::medium);
DrawText(rt, screenCoords, { colour }, _buffer.c_str());
}
@@ -465,7 +465,7 @@ namespace OpenRCT2::Ui::Windows
{
assert(!_windowInformationSize.has_value());
int32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
// Base dimensions.
const int32_t baseWidth = 450;
@@ -474,7 +474,7 @@ namespace OpenRCT2::Ui::Windows
// Server name is displayed word-wrapped, so figure out how high it will be.
{
int32_t numLines;
GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines);
GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::medium, nullptr, &numLines);
baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2);
}
@@ -483,7 +483,7 @@ namespace OpenRCT2::Ui::Windows
if (!descString.empty())
{
int32_t numLines;
GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines);
GfxWrapString(descString, baseWidth, FontStyle::medium, nullptr, &numLines);
baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2);
}
+2 -2
View File
@@ -93,10 +93,10 @@ namespace OpenRCT2::Ui::Windows
_buffer.assign("{WHITE}");
_buffer += _windowNetworkStatusText;
GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::Medium);
GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::medium);
ScreenCoordsXY screenCoords(windowPos.x + (width / 2), windowPos.y + (height / 2));
screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::Medium) / 2;
screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::medium) / 2;
DrawText(rt, screenCoords, { COLOUR_BLACK }, _buffer.c_str());
}
+1 -1
View File
@@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows
const auto& ls = OpenRCT2::GetContext()->GetLocalisationService();
auto string = ls.GetString(STR_GROUP_BY_TRACK_TYPE);
auto strWidth = GfxGetStringWidth(string, FontStyle::Medium);
auto strWidth = GfxGetStringWidth(string, FontStyle::medium);
auto localizedGroupByTrackTypeWidth = strWidth + 14;
widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth;
}
+4 -4
View File
@@ -113,7 +113,7 @@ namespace OpenRCT2::Ui::Windows
static int32_t CalculateNewsItemHeight()
{
return 4 * FontGetLineHeight(FontStyle::Small) + 2;
return 4 * FontGetLineHeight(FontStyle::small) + 2;
}
void initNewsWidgets()
@@ -443,7 +443,7 @@ namespace OpenRCT2::Ui::Windows
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
{
int32_t lineHeight = FontGetLineHeight(FontStyle::Small);
int32_t lineHeight = FontGetLineHeight(FontStyle::small);
int32_t itemHeight = CalculateNewsItemHeight();
int32_t y = 0;
int32_t i = 0;
@@ -476,7 +476,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
ft.Add<StringId>(DateDayNames[newsItem.day - 1]);
ft.Add<StringId>(DateGameMonthNames[DateGetMonth(newsItem.monthYear)]);
DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small });
DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::small });
}
// Item text
{
@@ -484,7 +484,7 @@ namespace OpenRCT2::Ui::Windows
ft.Add<const char*>(newsItem.text.c_str());
DrawTextWrapped(
rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft,
{ COLOUR_BRIGHT_GREEN, FontStyle::Small });
{ COLOUR_BRIGHT_GREEN, FontStyle::small });
}
// Subject button
if ((newsItem.typeHasSubject()) && !(newsItem.hasButton()))
+3 -3
View File
@@ -2187,7 +2187,7 @@ namespace OpenRCT2::Ui::Windows
// Get 'Clear' button string width
auto clearLabel = LanguageGetString(STR_CLEAR_BUTTON);
auto clearLabelWidth = GfxGetStringWidth(clearLabel, FontStyle::Medium) + 12;
auto clearLabelWidth = GfxGetStringWidth(clearLabel, FontStyle::medium) + 12;
widgets[WIDX_PATH_TO_RCT1_CLEAR].right = widgets[WIDX_PAGE_BACKGROUND].right - 12;
widgets[WIDX_PATH_TO_RCT1_CLEAR].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - clearLabelWidth;
@@ -2200,7 +2200,7 @@ namespace OpenRCT2::Ui::Windows
// Get 'Browse' button string width
auto browseLabel = LanguageGetString(STR_BROWSE);
auto browseLabelWidth = GfxGetStringWidth(browseLabel, FontStyle::Medium) + 12;
auto browseLabelWidth = GfxGetStringWidth(browseLabel, FontStyle::medium) + 12;
widgets[WIDX_PATH_TO_RCT1_BROWSE].right = widgets[WIDX_PAGE_BACKGROUND].right - 12;
widgets[WIDX_PATH_TO_RCT1_BROWSE].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - browseLabelWidth;
@@ -2241,7 +2241,7 @@ namespace OpenRCT2::Ui::Windows
int32_t widgetHeight = pathWidget.bottom - pathWidget.top;
// Apply vertical alignment if font height requires it
int32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
int32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0;
auto screenCoords = windowPos + ScreenCoordsXY{ pathWidget.left + 1, pathWidget.top + padding };
+2 -2
View File
@@ -692,7 +692,7 @@ namespace OpenRCT2::Ui::Windows
char buffer[64]{};
FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{COMMA32}", _ratingProps.max);
int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1;
int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1;
const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y };
_ratingProps.RecalculateLayout(
@@ -773,7 +773,7 @@ namespace OpenRCT2::Ui::Windows
char buffer[64]{};
FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{COMMA32}", _guestProps.max);
int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1;
int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1;
const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y };
_guestProps.RecalculateLayout(
+6 -6
View File
@@ -2898,7 +2898,7 @@ namespace OpenRCT2::Ui::Windows
// Intensity Factor
if (rideEntry->intensity_multiplier != 0)
{
int32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
if (lineHeight != 10)
screenCoords.x += 150;
else
@@ -5155,8 +5155,8 @@ namespace OpenRCT2::Ui::Windows
if (track->Name.empty())
continue;
auto nameWidth = GfxGetStringWidth(track->Name.c_str(), FontStyle::Small);
auto composerWidth = GfxGetStringWidth(track->Composer.c_str(), FontStyle::Small);
auto nameWidth = GfxGetStringWidth(track->Name.c_str(), FontStyle::small);
auto composerWidth = GfxGetStringWidth(track->Composer.c_str(), FontStyle::small);
newWidth = std::max(newWidth, nameWidth + composerWidth + 24);
}
@@ -5307,7 +5307,7 @@ namespace OpenRCT2::Ui::Windows
: STR_MUSIC_OBJECT_TRACK_LIST_ITEM_WITH_COMPOSER;
// Draw the track
DrawTextBasic(rt, { 0, y }, stringId, ft, { FontStyle::Small });
DrawTextBasic(rt, { 0, y }, stringId, ft, { FontStyle::small });
y += kScrollableRowHeight;
}
}
@@ -6124,7 +6124,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
ft.Add<int16_t>(scaled_yUnit);
DrawTextBasic(rt, { scrolls[0].contentOffsetX + 1, y - 4 }, stringID, ft, { FontStyle::Small });
DrawTextBasic(rt, { scrolls[0].contentOffsetX + 1, y - 4 }, stringID, ft, { FontStyle::small });
}
// Time marks
@@ -6134,7 +6134,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
ft.Add<int32_t>(time);
if (x + 80 >= rt.x)
DrawTextBasic(rt, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::Small });
DrawTextBasic(rt, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::small });
time += 5;
}
+9 -9
View File
@@ -306,12 +306,12 @@ namespace OpenRCT2::Ui::Windows
drawWidgets(rt);
StringId format = STR_WINDOW_COLOUR_2_STRINGID;
FontStyle fontStyle = FontStyle::Medium;
FontStyle fontStyle = FontStyle::medium;
if (ScenarioSelectUseSmallFont())
{
format = STR_SMALL_WINDOW_COLOUR_2_STRINGID;
fontStyle = FontStyle::Small;
fontStyle = FontStyle::small;
}
// Text for each tab
@@ -359,7 +359,7 @@ namespace OpenRCT2::Ui::Windows
// Scenario path
if (Config::Get().general.debuggingTools)
{
const auto shortPath = ShortenPath(scenario->Path, width - 6 - kTabWidth, FontStyle::Medium);
const auto shortPath = ShortenPath(scenario->Path, width - 6 - kTabWidth, FontStyle::medium);
auto ft = Formatter();
ft.Add<utf8*>(shortPath.c_str());
@@ -558,7 +558,7 @@ namespace OpenRCT2::Ui::Windows
const int32_t scenarioItemHeight = GetScenarioListItemSize();
// Scenario title
int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::Medium);
int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::medium);
int32_t y = 0;
for (const auto& listItem : _listItems)
@@ -604,7 +604,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(
rt, { scrollCentre, y + 1 }, format, ft,
{ colour, FontStyle::Medium, TextAlignment::centre, darkness });
{ colour, FontStyle::medium, TextAlignment::centre, darkness });
// Check if scenario is completed
if (isCompleted)
@@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows
ft.Add<const char*>(completedByName.c_str());
DrawTextBasic(
rt, { scrollCentre, y + scenarioTitleHeight + 1 }, format, ft,
{ FontStyle::Small, TextAlignment::centre });
{ FontStyle::small, TextAlignment::centre });
}
y += scenarioItemHeight;
@@ -649,7 +649,7 @@ namespace OpenRCT2::Ui::Windows
utf8 buffer[512];
auto bufferPtr = buffer;
OpenRCT2::FormatStringLegacy(bufferPtr, sizeof(buffer), stringId, nullptr);
int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::Medium) / 2) + 4;
int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::medium) / 2) + 4;
int32_t strLeft = centreX - categoryStringHalfWidth;
int32_t strRight = centreX + categoryStringHalfWidth;
@@ -848,10 +848,10 @@ namespace OpenRCT2::Ui::Windows
return kTrueFontSize;
// Scenario title
int32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
// 'Completed by' line
lineHeight += FontGetLineHeight(FontStyle::Small);
lineHeight += FontGetLineHeight(FontStyle::small);
return lineHeight;
}
+1 -1
View File
@@ -371,7 +371,7 @@ namespace OpenRCT2::Ui::Windows
{
snprintf(players, sizeof(players), "%d/%d", serverDetails.Players, serverDetails.MaxPlayers);
}
const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::Medium);
const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::medium);
// How much space we have for the server info depends on the size of everything rendered after.
const int16_t spaceAvailableForInfo = listWidgetWidth - numPlayersStringWidth - kScrollBarWidth - 35;
+5 -5
View File
@@ -223,7 +223,7 @@ namespace OpenRCT2::Ui::Windows
// +13 for cursor when max length.
u8string wrappedString;
GfxWrapString(
u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::Medium,
u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::medium,
&wrappedString, &no_lines);
Rectangle::fillInset(
@@ -245,7 +245,7 @@ namespace OpenRCT2::Ui::Windows
for (int32_t line = 0; line <= no_lines; line++)
{
screenCoords.x = windowPos.x + 12;
DrawText(rt, screenCoords, { colours[1], FontStyle::Medium, TextAlignment::left }, wrapPointer, true);
DrawText(rt, screenCoords, { colours[1], FontStyle::medium, TextAlignment::left }, wrapPointer, true);
size_t string_length = GetStringSize(wrapPointer) - 1;
if (!cur_drawn && (textInput->SelectionStart <= char_count + string_length))
@@ -253,7 +253,7 @@ namespace OpenRCT2::Ui::Windows
// Make a view of the string for measuring the width.
cursorX = windowPos.x + 13
+ GfxGetStringWidthNoFormatting(
u8string_view{ wrapPointer, textInput->SelectionStart - char_count }, FontStyle::Medium);
u8string_view{ wrapPointer, textInput->SelectionStart - char_count }, FontStyle::medium);
cursorY = screenCoords.y;
int32_t textWidth = 6;
@@ -264,7 +264,7 @@ namespace OpenRCT2::Ui::Windows
utf8 tmp[5] = {}; // This is easier than setting temp_string[0..5]
uint32_t codepoint = UTF8GetNext(_buffer.data() + textInput->SelectionStart, nullptr);
UTF8WriteCodepoint(tmp, codepoint);
textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::Medium) - 2, 4);
textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::medium) - 2, 4);
}
if (_cursorBlink > 15)
@@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows
{
// String length needs to add 12 either side of box +13 for cursor when max length.
int32_t numLines{};
GfxWrapString(text, kWindowSize.width - (24 + 13), FontStyle::Medium, nullptr, &numLines);
GfxWrapString(text, kWindowSize.width - (24 + 13), FontStyle::medium, nullptr, &numLines);
const auto textHeight = numLines * 10;
return kWindowSize.height + textHeight + getTitleBarDiffNormal();
+2 -2
View File
@@ -802,7 +802,7 @@ namespace OpenRCT2::Ui::Windows
if (colour.hasFlag(ColourFlag::translucent))
{
DrawText(
rt, topLeft, { colours[1].colour, FontStyle::Medium, TextDarkness::dark }, kCheckMarkString);
rt, topLeft, { colours[1].colour, FontStyle::medium, TextDarkness::dark }, kCheckMarkString);
}
}
}
@@ -863,7 +863,7 @@ namespace OpenRCT2::Ui::Windows
std::string str = FormatStringIDLegacy(format, args);
return GfxGetStringWidth(str, FontStyle::Medium);
return GfxGetStringWidth(str, FontStyle::medium);
}
int8_t GetTotalColoursUpTo(int8_t index)
+1 -1
View File
@@ -1595,7 +1595,7 @@ static uint64_t PageDisabledWidgets[] = {
{
auto& listWidget = widgets[WIDX_LIST];
auto centrePos = ScreenCoordsXY{ listWidget.width() / 2,
(listWidget.height() - FontGetLineHeight(FontStyle::Medium)) / 2 };
(listWidget.height() - FontGetLineHeight(FontStyle::medium)) / 2 };
auto ft = Formatter{};
auto textPaint = TextPaint{ colours[1], TextAlignment::centre };
DrawTextWrapped(rt, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint);
+2 -2
View File
@@ -28,12 +28,12 @@ namespace OpenRCT2::Ui::Windows
// Write name and version information
const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true);
DrawText(rt, windowPos, { whiteOutline }, gVersionInfoFull);
width = GfxGetStringWidth(gVersionInfoFull, FontStyle::Medium);
width = GfxGetStringWidth(gVersionInfoFull, FontStyle::medium);
// Write platform information
constexpr const char platformInfo[] = OPENRCT2_PLATFORM " (" OPENRCT2_ARCHITECTURE ")";
DrawText(rt, windowPos + ScreenCoordsXY(0, kListRowHeight), { whiteOutline }, platformInfo);
width = std::max<int16_t>(width, GfxGetStringWidth(platformInfo, FontStyle::Medium)) + kTextOffset;
width = std::max<int16_t>(width, GfxGetStringWidth(platformInfo, FontStyle::medium)) + kTextOffset;
}
};
+4 -4
View File
@@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows
TooltipWindow(const OpenRCT2String& message, ScreenCoordsXY screenCoords)
{
_textWidth = FormatTextForTooltip(message);
_textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::Small));
_textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::small));
width = _textWidth + 5;
height = _textHeight + 4;
@@ -130,7 +130,7 @@ namespace OpenRCT2::Ui::Windows
// Text
left = windowPos.x + ((width + 1) / 2) - 1;
top = windowPos.y + 1;
DrawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::Small);
DrawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::small);
}
private:
@@ -143,11 +143,11 @@ namespace OpenRCT2::Ui::Windows
formattedMessage.args.Add<const char*>(tempString.c_str());
const u8string tooltipTextUnwrapped = FormatStringIDLegacy(formattedMessage.str, formattedMessage.args.Data());
auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::Small);
auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::small);
textWidth = std::min(textWidth, 196);
int32_t numLines;
textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::Small, &_tooltipText, &numLines);
textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::small, &_tooltipText, &numLines);
_tooltipNumLines = numLines;
return textWidth;
}
@@ -189,7 +189,7 @@ namespace OpenRCT2::Ui::Windows
const auto titleBarBottom = widgets[WIDX_TITLE].bottom;
const auto buttonTop = widgets[WIDX_PROMPT_DELETE].top;
const auto fontHeight = FontGetLineHeight(FontStyle::Medium);
const auto fontHeight = FontGetLineHeight(FontStyle::medium);
const auto maxMessageHeight = buttonTop - titleBarBottom;
const auto messageTop = titleBarBottom + (maxMessageHeight - fontHeight) / 2;
+1 -1
View File
@@ -476,7 +476,7 @@ namespace OpenRCT2::Ui::Windows
// Show track file path (in debug mode)
if (Config::Get().general.debuggingTools)
{
const auto shortPath = ShortenPath(path, width, FontStyle::Medium);
const auto shortPath = ShortenPath(path, width, FontStyle::medium);
auto ft = Formatter();
ft.Add<utf8*>(shortPath.c_str());
DrawTextBasic(
+17 -17
View File
@@ -264,7 +264,7 @@ void GfxDrawStringLeftCentred(
char buffer[512];
auto bufferPtr = buffer;
FormatStringLegacy(bufferPtr, sizeof(buffer), format, args);
int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::Medium);
int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::medium);
DrawText(rt, coords - ScreenCoordsXY{ 0, (height / 2) }, { colour }, bufferPtr);
}
@@ -350,9 +350,9 @@ void DrawStringCentredRaw(
int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle)
{
int32_t height = 0;
if (fontStyle <= FontStyle::Medium)
if (fontStyle <= FontStyle::medium)
height += 10;
else if (fontStyle == FontStyle::Tiny)
else if (fontStyle == FontStyle::tiny)
height += 6;
FmtString fmt(text);
@@ -361,13 +361,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle)
switch (token.kind)
{
case FormatToken::newline:
if (fontStyle == FontStyle::Small || fontStyle == FontStyle::Medium)
if (fontStyle == FontStyle::small || fontStyle == FontStyle::medium)
{
height += 10;
break;
}
if (fontStyle == FontStyle::Tiny)
if (fontStyle == FontStyle::tiny)
{
height += 6;
break;
@@ -375,13 +375,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle)
height += 18;
break;
case FormatToken::newlineSmall:
if (fontStyle == FontStyle::Small || fontStyle == FontStyle::Medium)
if (fontStyle == FontStyle::small || fontStyle == FontStyle::medium)
{
height += 5;
break;
}
if (fontStyle == FontStyle::Tiny)
if (fontStyle == FontStyle::tiny)
{
height += 3;
break;
@@ -389,13 +389,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle)
height += 9;
break;
case FormatToken::fontTiny:
fontStyle = FontStyle::Tiny;
fontStyle = FontStyle::tiny;
break;
case FormatToken::fontMedium:
fontStyle = FontStyle::Medium;
fontStyle = FontStyle::medium;
break;
case FormatToken::fontSmall:
fontStyle = FontStyle::Small;
fontStyle = FontStyle::small;
break;
default:
break;
@@ -427,8 +427,8 @@ void DrawNewsTicker(
DrawText(rt, screenCoords, { colour }, "");
u8string wrappedString;
GfxWrapString(FormatStringID(format, args), width, FontStyle::Small, &wrappedString, &numLines);
lineHeight = FontGetLineHeight(FontStyle::Small);
GfxWrapString(FormatStringID(format, args), width, FontStyle::small, &wrappedString, &numLines);
lineHeight = FontGetLineHeight(FontStyle::small);
int32_t numCharactersDrawn = 0;
int32_t numCharactersToDraw = ticks;
@@ -437,7 +437,7 @@ void DrawNewsTicker(
lineY = coords.y - ((numLines * lineHeight) / 2);
for (int32_t line = 0; line <= numLines; line++)
{
int32_t halfWidth = GfxGetStringWidth(buffer, FontStyle::Small) / 2;
int32_t halfWidth = GfxGetStringWidth(buffer, FontStyle::small) / 2;
FmtString fmt(buffer);
for (const auto& token : fmt)
@@ -463,7 +463,7 @@ void DrawNewsTicker(
}
screenCoords = { coords.x - halfWidth, lineY };
DrawText(rt, screenCoords, { kTextColour254, FontStyle::Small }, buffer);
DrawText(rt, screenCoords, { kTextColour254, FontStyle::small }, buffer);
if (numCharactersDrawn > numCharactersToDraw)
{
@@ -558,13 +558,13 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token
info->y += FontGetLineHeightSmall(info->fontStyle);
break;
case FormatToken::fontTiny:
info->fontStyle = FontStyle::Tiny;
info->fontStyle = FontStyle::tiny;
break;
case FormatToken::fontSmall:
info->fontStyle = FontStyle::Small;
info->fontStyle = FontStyle::small;
break;
case FormatToken::fontMedium:
info->fontStyle = FontStyle::Medium;
info->fontStyle = FontStyle::medium;
break;
case FormatToken::outlineEnable:
info->flags |= TEXT_DRAW_FLAG_OUTLINE;
+2 -2
View File
@@ -1139,8 +1139,8 @@ void DebugDPI(RenderTarget& rt)
GfxDrawLine(rt, { topLeft, topLeft + ScreenCoordsXY{ 4, 0 } }, PaletteIndex::pi136);
const auto str = std::to_string(rt.x);
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::Tiny }, str.c_str());
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::tiny }, str.c_str());
const auto str2 = std::to_string(rt.y);
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::Tiny }, str2.c_str());
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::tiny }, str2.c_str());
}
+4 -4
View File
@@ -18,13 +18,13 @@ constexpr uint16_t kSpriteFontGlyphCount = 224;
enum class FontStyle : uint8_t
{
Small = 0,
Medium = 1,
Tiny = 2,
small = 0,
medium = 1,
tiny = 2,
};
constexpr uint8_t FontStyleCount = 3;
constexpr std::array<FontStyle, FontStyleCount> FontStyles = { FontStyle::Small, FontStyle::Medium, FontStyle::Tiny };
constexpr std::array<FontStyle, FontStyleCount> FontStyles = { FontStyle::small, FontStyle::medium, FontStyle::tiny };
#ifndef DISABLE_TTF
+3 -3
View File
@@ -59,7 +59,7 @@ static void ScrollingTextInitialiseCharacterBitmaps(uint32_t glyphStart, uint16_
for (int32_t i = 0; i < count; i++)
{
std::fill_n(drawingSurface, sizeof(drawingSurface), 0x00);
GfxDrawSpriteSoftware(rt, ImageId(glyphStart + (EnumValue(FontStyle::Tiny) * count) + i), { -1, 0 });
GfxDrawSpriteSoftware(rt, ImageId(glyphStart + (EnumValue(FontStyle::tiny) * count) + i), { -1, 0 });
for (int32_t x = 0; x < 8; x++)
{
@@ -1493,7 +1493,7 @@ static void ScrollingTextSetBitmapForSprite(
CodepointView codepoints(token.text);
for (auto codepoint : codepoints)
{
auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::Tiny, codepoint);
auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::tiny, codepoint);
auto characterBitmap = FontSpriteGetCodepointBitmap(codepoint);
for (; characterWidth != 0; characterWidth--, characterBitmap++)
{
@@ -1541,7 +1541,7 @@ static void ScrollingTextSetBitmapForTTF(
std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour)
{
#ifndef DISABLE_TTF
auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::Tiny);
auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::tiny);
if (fontDesc->font == nullptr)
{
ScrollingTextSetBitmapForSprite(text, scroll, bitmap, scrollPositionOffsets, colour);
+1 -1
View File
@@ -44,7 +44,7 @@ enum class TextDarkness
struct TextPaint
{
ColourWithFlags Colour = { COLOUR_BLACK };
::FontStyle FontStyle = FontStyle::Medium;
::FontStyle FontStyle = FontStyle::medium;
TextUnderline UnderlineText = TextUnderline::off;
TextAlignment Alignment = TextAlignment::left;
TextDarkness Darkness = TextDarkness::regular;
+1 -1
View File
@@ -108,7 +108,7 @@ void MoneyEffect::SetValue(money64 value)
auto [stringId, newValue] = GetStringId();
char buffer[128];
OpenRCT2::FormatStringLegacy(buffer, 128, stringId, &newValue);
offsetX = -(GfxGetStringWidth(buffer, FontStyle::Medium) / 2);
offsetX = -(GfxGetStringWidth(buffer, FontStyle::medium) / 2);
}
OffsetX = offsetX;
Wiggle = 0;
+6 -6
View File
@@ -198,10 +198,10 @@ void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColor)
GfxSetDirtyBlocks({ screenCoords, { screenCoords + ScreenCoordsXY{ _chatWidth, inputLineHeight + 15 } } });
// TODO: Show caret if the input text has multiple lines
if (_chatCaretTicks < 15 && GfxGetStringWidth(lineBuffer, FontStyle::Medium) < (_chatWidth - 10))
if (_chatCaretTicks < 15 && GfxGetStringWidth(lineBuffer, FontStyle::medium) < (_chatWidth - 10))
{
lineBuffer.assign(_chatCurrentLine.c_str(), _chatTextInputSession->SelectionStart);
int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::Medium);
int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::medium);
int32_t caretY = screenCoords.y + 14;
Rectangle::fill(rt, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PaletteIndex::pi56);
@@ -292,8 +292,8 @@ static int32_t ChatHistoryDrawString(RenderTarget& rt, const char* text, const S
{
int32_t numLines;
u8string wrappedString;
GfxWrapString(FormatString("{OUTLINE}{WHITE}{STRING}", text), width, FontStyle::Medium, &wrappedString, &numLines);
auto lineHeight = FontGetLineHeight(FontStyle::Medium);
GfxWrapString(FormatString("{OUTLINE}{WHITE}{STRING}", text), width, FontStyle::medium, &wrappedString, &numLines);
auto lineHeight = FontGetLineHeight(FontStyle::medium);
int32_t expectedY = screenCoords.y - (numLines * lineHeight);
if (expectedY < 50)
@@ -317,7 +317,7 @@ static int32_t ChatHistoryDrawString(RenderTarget& rt, const char* text, const S
int32_t ChatStringWrappedGetHeight(u8string_view args, int32_t width)
{
int32_t numLines;
GfxWrapString(FormatStringID(STR_STRING, args), width, FontStyle::Medium, nullptr, &numLines);
const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium);
GfxWrapString(FormatStringID(STR_STRING, args), width, FontStyle::medium, nullptr, &numLines);
const int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
return lineHeight * (numLines + 1);
}
+2 -2
View File
@@ -193,7 +193,7 @@ void TryLoadFonts(LocalisationService& localisationService)
return;
}
TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)];
TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::small)];
LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name);
}
@@ -208,7 +208,7 @@ void TryLoadFonts(LocalisationService& localisationService)
return;
}
TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)];
TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::small)];
LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name);
}
+1 -1
View File
@@ -419,7 +419,7 @@ namespace OpenRCT2
// Currency symbol
auto symbol = currencyDesc->symbol_unicode;
auto affix = currencyDesc->affix_unicode;
if (!FontSupportsString(symbol, FontStyle::Medium))
if (!FontSupportsString(symbol, FontStyle::medium))
{
symbol = currencyDesc->symbol_ascii;
affix = currencyDesc->affix_ascii;
+1 -1
View File
@@ -68,7 +68,7 @@ namespace OpenRCT2
ft.Add<uint16_t>(dist[i] * 100 / totalSize);
DrawTextEllipsised(
rt, coords + ScreenCoordsXY{ 12, 22 }, 35, STR_CLIMATE_WEATHER_PERCENT, ft,
{ FontStyle::Small, TextAlignment::centre });
{ FontStyle::small, TextAlignment::centre });
}
}
+1 -1
View File
@@ -1098,6 +1098,6 @@ void PaintDrawMoneyStructs(RenderTarget& rt, PaintStringStruct* ps)
GfxDrawStringWithYOffsets(
rt, buffer, { COLOUR_BLACK }, ps->ScreenPos, reinterpret_cast<int8_t*>(ps->y_offsets), forceSpriteFont,
FontStyle::Medium);
FontStyle::medium);
} while ((ps = ps->NextEntry) != nullptr);
}
+2 -2
View File
@@ -88,7 +88,7 @@ void Painter::PaintReplayNotice(RenderTarget& rt, const char* text)
char buffer[64]{};
FormatStringToBuffer(buffer, sizeof(buffer), "{OUTLINE}{RED}{STRING}", text);
auto stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium);
auto stringWidth = GfxGetStringWidth(buffer, FontStyle::medium);
screenCoords.x = screenCoords.x - stringWidth;
if (((getGameState().currentTicks >> 1) & 0xF) > 4)
@@ -116,7 +116,7 @@ void Painter::PaintFPS(RenderTarget& rt)
char buffer[64]{};
FormatStringToBuffer(buffer, sizeof(buffer), "{OUTLINE}{WHITE}{INT32}", _currentFPS);
const int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium);
const int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::medium);
// Figure out where counter should be rendered
ScreenCoordsXY screenCoords(_uiContext.GetWidth() / 2, 2);
@@ -67,7 +67,7 @@ static void PaintBannerScrollingText(
OpenRCT2::FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data());
}
auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny);
auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny);
auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0;
auto imageId = ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK);
PaintAddImageAsChild(session, imageId, { 0, 0, height + 22 }, { bbOffset, { 1, 1, 21 } });
@@ -75,7 +75,7 @@ static void PaintRideEntranceExitScrollingText(
{
FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data());
}
auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny);
auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny);
auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0;
PaintAddImageAsChild(
@@ -257,7 +257,7 @@ static void PaintParkEntranceScrollingText(
FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data());
}
auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny);
auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny);
auto scroll = stringWidth > 0 ? (gameState.currentTicks / 2) % stringWidth : 0;
auto imageIndex = ScrollingTextSetup(
session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode + direction / 2, COLOUR_BLACK);
@@ -327,7 +327,7 @@ static void PaintLargeSceneryScrollingText(
}
auto scrollMode = sceneryEntry.scrolling_mode + ((direction + 1) & 3);
auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny);
auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny);
auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0;
auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollMode, textPaletteIndex);
PaintAddImageAsChild(session, imageId, { 0, 0, height + 25 }, { bbOffset, { 1, 1, 21 } });
@@ -175,7 +175,7 @@ static void PathPaintQueueBanner(
FormatStringLegacy(bannerBuffer, sizeof(bannerBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
}
uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::Tiny);
uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::tiny);
uint16_t scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0;
PaintAddImageAsChild(
@@ -184,7 +184,7 @@ static void PaintWallScrollingText(
OpenRCT2::FormatStringLegacy(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, ft.Data());
}
auto stringWidth = GfxGetStringWidth(signString, FontStyle::Tiny);
auto stringWidth = GfxGetStringWidth(signString, FontStyle::tiny);
auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0;
auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollingMode, textPaletteIndex);
PaintAddImageAsChild(session, imageId, { 0, 0, height + 8 }, { boundsOffset, { 1, 1, 13 } });