diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index ceffb380..a87d8a35 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -3580,7 +3580,7 @@ int UIBookWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intp file.Close(); this->m_lines.clear(); - WrapPixelText(*this->geometry.surface, this->m_book->text.list.codePage, text, this->m_lines, this->m_viewer->geometry.width - 10); + this->WrapPixelText(text, this->m_lines, this->m_viewer->geometry.width - 10); this->m_lineCount = static_cast(this->m_lines.size()); if (text[0] == '%') { this->m_red = g_hexDigits[text[1]] * 16 + g_hexDigits[text[2]]; diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 5dc08a04..ddcb8df1 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -1927,7 +1927,7 @@ void UIListBoxNavi::Paint() { } const auto& line = this->lines[index]; - DrawColoredText(*this, owner.codePage, 3 - this->horizontalOffset, this->lineHeight * row, line.c_str(), static_cast(line.size()), color, 0, 12, false); + DrawColoredText(*this, 3 - this->horizontalOffset, this->lineHeight * row, line.c_str(), static_cast(line.size()), color, 0, 12, false); if (this->lineColors[index] == 1) { color = 0; @@ -3061,7 +3061,7 @@ void UIListBoxID::Paint() { } DrawColoredText( - *this, static_cast(g_textCodePage), 3 - this->horizontalOffset, (index - first) * this->lineHeight, this->lines[index].text.c_str(), + *this, 3 - this->horizontalOffset, (index - first) * this->lineHeight, this->lines[index].text.c_str(), static_cast(this->lines[index].text.size()), color, 0, 12, false ); } @@ -3098,7 +3098,7 @@ void UIListBoxTitle::Paint() { } DrawColoredText( - *this, static_cast(g_textCodePage), 3 - this->horizontalOffset, (index - first) * this->lineHeight, this->lines[index].text.c_str(), + *this, 3 - this->horizontalOffset, (index - first) * this->lineHeight, this->lines[index].text.c_str(), static_cast(this->lines[index].text.size()), color, 0, 12, false ); } @@ -3216,7 +3216,7 @@ void UIListBox2::Paint() { const std::string& line = this->lines[index]; DrawStyledColoredText( - *this, owner.codePage, x, y, line.c_str(), static_cast(line.size()), color, this->fontFamily, this->fontHeight, this->bold, this->italic, false + *this, x, y, line.c_str(), static_cast(line.size()), color, this->fontFamily, this->fontHeight, this->bold, this->italic, false ); } } @@ -3539,9 +3539,9 @@ void UIString::Paint() { while (cur < end) { cur = ParseColorCode(SegmentEnd(cur, end), color); } - DrawColoredText(*this, 0, 24, 7, this->unknown_00DC.c_str(), static_cast(this->unknown_00DC.size()), color, 0, 12, false); + DrawColoredText(*this, 24, 7, this->unknown_00DC.c_str(), static_cast(this->unknown_00DC.size()), color, 0, 12, false); } else { - DrawColoredText(*this, 0, 0, 0, this->unknown_00DC.c_str(), static_cast(this->unknown_00DC.size()), color, 0, 12, false); + DrawColoredText(*this, 0, 0, this->unknown_00DC.c_str(), static_cast(this->unknown_00DC.size()), color, 0, 12, false); } } diff --git a/Source/UI/Chat/UISubChatHisWnd.cpp b/Source/UI/Chat/UISubChatHisWnd.cpp index 87b294f2..2399a348 100644 --- a/Source/UI/Chat/UISubChatHisWnd.cpp +++ b/Source/UI/Chat/UISubChatHisWnd.cpp @@ -95,7 +95,7 @@ void UISubChatHisWnd::Paint() { std::uint32_t color = 0xFFFFFF; const TextLocale locale = {}; this->DrawTextAt(5, 4, this->m_name.c_str(), 0, 0, 12, 0, 0, 0); - DrawColoredText(*this, static_cast(g_textCodePage), 4, 3, this->m_name.c_str(), 0, color, 0, 12, false); + DrawColoredText(*this, 4, 3, this->m_name.c_str(), 0, color, 0, 12, false); this->FillRegion(2, 0, this->m_inputWidth - 5, 1, color); this->FillRegion(1, 1, 1, 1, color); this->FillRegion(0, 2, 1, this->geometry.height - 4, color); diff --git a/Source/UI/Lists/UIListBox.cpp b/Source/UI/Lists/UIListBox.cpp index 595845de..d73103da 100644 --- a/Source/UI/Lists/UIListBox.cpp +++ b/Source/UI/Lists/UIListBox.cpp @@ -148,7 +148,7 @@ void UIChatHisBox::AddTextWrapped(const char* text, int color, const char* style } std::vector lines; - WrapPixelText(*this->geometry.surface, this->m_listContext->codePage, text, lines, width); + this->WrapPixelText(text, lines, width); for (const std::string& line : lines) { char* copy = static_cast(std::malloc(line.size() + 1)); @@ -355,7 +355,7 @@ void UIListBox::Paint() { y = static_cast(static_cast((this->lineHeight - height)) * 0.5f + static_cast(y)); } - DrawColoredText(*this, owner.codePage, x, y, line.c_str(), static_cast(line.size()), color, 0, 12, false); + DrawColoredText(*this, x, y, line.c_str(), static_cast(line.size()), color, 0, 12, false); } } diff --git a/Source/UI/Lists/UIListBoxEx.cpp b/Source/UI/Lists/UIListBoxEx.cpp index 66e1bb47..0ca1da79 100644 --- a/Source/UI/Lists/UIListBoxEx.cpp +++ b/Source/UI/Lists/UIListBoxEx.cpp @@ -179,7 +179,7 @@ void UIListBoxEx::Paint() { auto& line = this->lines[index]; auto color = line.color; DrawColoredText( - *this, owner.codePage, (3 - this->horizontalOffset), y, line.text.c_str(), static_cast(line.text.size()), color, 0, + *this, (3 - this->horizontalOffset), y, line.text.c_str(), static_cast(line.text.size()), color, 0, 12, false ); } diff --git a/Source/UI/Lists/UITagListBox.cpp b/Source/UI/Lists/UITagListBox.cpp index ea060011..42b60373 100644 --- a/Source/UI/Lists/UITagListBox.cpp +++ b/Source/UI/Lists/UITagListBox.cpp @@ -19,35 +19,6 @@ #include #include -namespace { -// INLINED -const char* SegmentEnd(const char* text, const char* end, unsigned short codePage) { - const char* current = text; - - while (current < end) { - if (*current == '^' && end - current >= 6) { - bool color = true; - - for (int index = 1; index <= 6; ++index) { - const unsigned char digit = static_cast(current[index]); - if (!((digit >= '0' && digit <= '9') || (digit >= 'a' && digit <= 'f') || (digit >= 'A' && digit <= 'F'))) { - color = false; - break; - } - } - - if (color) { - return current; - } - } - - current = CharNextExA(codePage, current, 0); - } - - return current; -} -} - // OFFSET: 0x009B7A10 // FUNCTION: fn_13869 void UITagListBox::AddLine(const char* text) { @@ -102,7 +73,7 @@ void UITagListBox::Paint() { const char* endText = text + line.size(); while (text < endText) { - text = ParseColorCode(SegmentEnd(text, endText, owner.codePage), color); + text = ParseColorCode(SegmentEnd(text, endText), color); } } @@ -112,7 +83,7 @@ void UITagListBox::Paint() { const std::string& line = this->lines[index]; const int y = (index - first) * this->lineHeight + 4; DrawColoredText( - *this, owner.codePage, 3, y, line.c_str(), static_cast(line.size()), color, 0, 12, false + *this, 3, y, line.c_str(), static_cast(line.size()), color, 0, 12, false ); } } else { @@ -414,7 +385,7 @@ void UITagListBox::sub_9B9EA0(std::intptr_t argument1, std::intptr_t argument2, if (argument3 != 0) { extra = this->verticalBar->geometry.width + 2; } - WrapPixelText(*this->geometry.surface, owner.codePage, text, lines, this->geometry.width - extra - 4); + this->WrapPixelText(text, lines, this->geometry.width - extra - 4); for (std::size_t index = 0; index < lines.size(); ++index) { this->AddLine(lines[index].c_str()); diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index 86bb43f0..e894722c 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -805,28 +805,28 @@ void UIMemorialDunWnd::Paint() { sprintf(name, "%s[%s]%s", nameColor, g_session.unknown_5950.c_str(), endColor); sprintf(title, LookupMessage(g_session.unknown_5948 + 0x539), name); const int width = this->ColoredTextWidth(title, 0, 0, 12, 0); - DrawColoredText(*this, codePage, (this->geometry.width - width) / 2, 30, title, 0, color, 0, 12, false); + DrawColoredText(*this, (this->geometry.width - width) / 2, 30, title, 0, color, 0, 12, false); } if (g_session.unknown_5948 == 0) { sprintf(text, LookupMessage(0x53E), g_session.unknown_5968); const int width = this->ColoredTextWidth(text, 0, 0, 12, 0); - DrawColoredText(*this, codePage, (this->geometry.width - width) / 2, (this->geometry.height - 17) / 2, text, 0, color, 0, 12, false); + DrawColoredText(*this, (this->geometry.width - width) / 2, (this->geometry.height - 17) / 2, text, 0, color, 0, 12, false); } else if (g_session.unknown_5948 == 1) { if (g_session.unknown_5970) { strftime(timeText, 128, LookupMessage(0x4EC), _localtime32(reinterpret_cast(&g_session.unknown_5970))); sprintf(text, LookupMessage(0x53F), timeText); std::vector lines; - WrapPixelText(*this->geometry.surface, codePage, text, lines, this->geometry.width - 20); + this->WrapPixelText(text, lines, this->geometry.width - 20); if (lines.size() > 1) { int y = static_cast((this->geometry.height - lines.size() * 17 - 72) / 2) + 40; for (unsigned int index = 0; index < lines.size(); ++index) { - DrawColoredText(*this, codePage, 10, y, lines[index].c_str(), 0, color, 0, 12, false); + DrawColoredText(*this, 10, y, lines[index].c_str(), 0, color, 0, 12, false); y += 17; } } else { const int width = this->ColoredTextWidth(text, 0, 0, 12, 0); - DrawColoredText(*this, codePage, (this->geometry.width - width) / 2, 55, lines[0].c_str(), 0, color, 0, 12, false); + DrawColoredText(*this, (this->geometry.width - width) / 2, 55, lines[0].c_str(), 0, color, 0, 12, false); } } } else if (g_session.unknown_5948 == 2) { @@ -835,21 +835,21 @@ void UIMemorialDunWnd::Paint() { strftime(timeText, 128, LookupMessage(0x4EC), _localtime32(reinterpret_cast(&g_session.unknown_596C))); sprintf(text, "^ff0000%s^ffffff", timeText); const int width = this->ColoredTextWidth(text, 0, 0, 12, 0); - DrawColoredText(*this, codePage, (this->geometry.width - width) / 2, 75, text, 0, color, 0, 12, false); + DrawColoredText(*this, (this->geometry.width - width) / 2, 75, text, 0, color, 0, 12, false); } } else if (g_session.unknown_5948 == 3) { std::vector lines; - WrapPixelText(*this->geometry.surface, codePage, LookupMessage(0x53C), lines, this->geometry.width - 20); + this->WrapPixelText(LookupMessage(0x53C), lines, this->geometry.width - 20); int y = 55; for (unsigned int index = 0; index < lines.size(); ++index) { - DrawColoredText(*this, codePage, 5, y, lines[index].c_str(), 0, color, 0, 12, false); + DrawColoredText(*this, 5, y, lines[index].c_str(), 0, color, 0, 12, false); y += 15; } - WrapPixelText(*this->geometry.surface, codePage, LookupMessage(0x53D), lines, this->geometry.width - 20); + this->WrapPixelText(LookupMessage(0x53D), lines, this->geometry.width - 20); y = 70; for (unsigned int index = 0; index < lines.size(); ++index) { - DrawColoredText(*this, codePage, 10, y, lines[index].c_str(), 0, color, 0, 12, false); + DrawColoredText(*this, 10, y, lines[index].c_str(), 0, color, 0, 12, false); y += 15; } } diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index 1ec3dad3..e536c895 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -1777,7 +1777,7 @@ void UIShowInfoWnd::DrawPayments() { if (this->unknown_00A0 == 1) { std::vector lines; - WrapPixelText(*this->geometry.surface, *this->m_context->locale.serverLanguage, LookupMessage(2835), lines, this->geometry.width - 20); + this->WrapPixelText(LookupMessage(2835), lines, this->geometry.width - 20); for (unsigned int i = 0; i < lines.size(); ++i) { this->DrawTextAt(20, positions[i][1], lines[i].c_str(), 0, 0, 11, 0, 0, 0); } diff --git a/Source/UI/Text/ColoredText.cpp b/Source/UI/Text/ColoredText.cpp index da04a1e5..66353db8 100644 --- a/Source/UI/Text/ColoredText.cpp +++ b/Source/UI/Text/ColoredText.cpp @@ -45,32 +45,33 @@ namespace { return 0; } - // OFFSET: 0x00A7CA20 - // FUNCTION: fn_16948 - const char* SegmentEnd(const char* text, const char* end, unsigned short codePage) { - const char* current = text; +} - while (current < end) { - if (*current == '^' && end - current >= 6) { - bool color = true; +// OFFSET: 0x00A7CA20 +// FUNCTION: fn_16948 +const char* SegmentEnd(const char* text, const char* end) { + const char* current = text; - for (unsigned index = 1; index <= 6; ++index) { - if (!Hex(static_cast(current[index]))) { - color = false; - break; - } - } + while (current < end) { + if (*current == '^' && end - current >= 6) { + bool color = true; - if (color) { - return current; + for (unsigned index = 1; index <= 6; ++index) { + if (!Hex(static_cast(current[index]))) { + color = false; + break; } } - current = CharNextExA(codePage, current, 0); + if (color) { + return current; + } } - return current; + current = CharNextExA(static_cast(g_textCodePage), current, 0); } + + return current; } // OFFSET: 0x00A81BA0 @@ -94,7 +95,7 @@ const char* ParseColorCode(const char* text, std::uint32_t& color) { // OFFSET: 0x00A84E30 // FUNCTION: fn_17015 void DrawColoredText( - UIWindow& window, unsigned short codePage, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, + UIWindow& window, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, int family, int height, bool shadow ) { if (bytes == 0) { @@ -118,7 +119,7 @@ void DrawColoredText( current += 7; } - const char* next = SegmentEnd(current, end, codePage); + const char* next = SegmentEnd(current, end); std::string segment(current, next); if (*marker != '\0') { @@ -147,7 +148,7 @@ void DrawColoredText( // OFFSET: 0x00A84B80 // FUNCTION: fn_17014 void DrawStyledColoredText( - UIWindow& window, unsigned short codePage, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, + UIWindow& window, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, int family, int height, unsigned char bold, unsigned char italic, bool shadow ) { if (bytes == 0) { @@ -171,7 +172,7 @@ void DrawStyledColoredText( current += 7; } - const char* next = SegmentEnd(current, end, codePage); + const char* next = SegmentEnd(current, end); std::string segment(current, next); if (marker && *marker != '\0') { @@ -230,7 +231,7 @@ void DrawOutlinedText( // OFFSET: 0x00A848B0 // FUNCTION: fn_17013 void DrawOutlinedColoredText( - UIWindow& window, unsigned short codePage, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, + UIWindow& window, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, std::uint32_t outline, int family, int height, unsigned char bold ) { if (bytes == 0) { @@ -250,7 +251,7 @@ void DrawOutlinedColoredText( current += 7; } - const char* next = SegmentEnd(current, end, codePage); + const char* next = SegmentEnd(current, end); std::string segment(current, next); if (*marker != '\0') { @@ -285,7 +286,7 @@ std::string StripColorCodes(const char* text, unsigned bytes) { text += 7; } - const char* const next = SegmentEnd(text, end, static_cast(g_textCodePage)); + const char* const next = SegmentEnd(text, end); std::string segment(text, next); if (marker != nullptr && *marker != '\0') { diff --git a/Source/UI/Text/ColoredText.h b/Source/UI/Text/ColoredText.h index e8774ba1..862e5a15 100644 --- a/Source/UI/Text/ColoredText.h +++ b/Source/UI/Text/ColoredText.h @@ -14,12 +14,12 @@ const char* SegmentEnd(const char* text, const char* end); const char* ParseColorCode(const char* text, std::uint32_t& color); void DrawColoredText( - UIWindow& window, unsigned short codePage, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, + UIWindow& window, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, int family, int height, bool shadow ); void DrawStyledColoredText( - UIWindow& window, unsigned short codePage, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, + UIWindow& window, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, int family, int height, unsigned char bold, unsigned char italic, bool shadow ); @@ -28,7 +28,7 @@ void DrawOutlinedText( int family, int height, unsigned char bold, unsigned char italic ); void DrawOutlinedColoredText( - UIWindow& window, unsigned short codePage, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, + UIWindow& window, int x, int y, const char* text, unsigned bytes, std::uint32_t& color, std::uint32_t outline, int family, int height, unsigned char bold ); diff --git a/Source/UI/Text/PixelTextWrapping.cpp b/Source/UI/Text/PixelTextWrapping.cpp index efc4b1e9..b6e74415 100644 --- a/Source/UI/Text/PixelTextWrapping.cpp +++ b/Source/UI/Text/PixelTextWrapping.cpp @@ -1,3 +1,4 @@ +#include "Client/Input/InputCharset.h" #include "Render/Text/TextContext.h" #include "UI/Text/PixelTextWrapping.h" #include "UI/Window/UIWindow.h" @@ -27,9 +28,7 @@ namespace { // OFFSET: 0x00A82310 // FUNCTION: fn_16993 -void WrapPixelText( - CDC& surface, unsigned short codePage, const char* text, std::vector& lines, int width -) { +void UIWindow::WrapPixelText(const char* text, std::vector& lines, int width) { if (!text || *text == '\0') { return; } @@ -43,7 +42,7 @@ void WrapPixelText( return 0; } - TextContext context(surface); + TextContext context(*this->geometry.surface); context.SetFont(0, 12, 0, 0); return static_cast(context.Measure(part, bytes).cx); }; @@ -74,7 +73,7 @@ void WrapPixelText( } const int previous = count; - const char* next = CharNextExA(codePage, current, 0); + const char* next = g_serverLanguage->NextChar(current, static_cast(end - current)); const int length = static_cast(next - current); extent = (extent + measure(current, length)); @@ -146,7 +145,7 @@ void WrapPixelText( void UIWindow::sub_8932D0(int* kind, std::vector* lines, const std::string& text) { const char* characters = text.c_str(); if (*kind != 3) { - WrapPixelText(*this->geometry.surface, static_cast(g_textCodePage), characters, *lines, this->geometry.width - 16); + this->WrapPixelText(characters, *lines, this->geometry.width - 16); return; } diff --git a/Source/UI/Text/PixelTextWrapping.h b/Source/UI/Text/PixelTextWrapping.h index 2000f577..772f2dcb 100644 --- a/Source/UI/Text/PixelTextWrapping.h +++ b/Source/UI/Text/PixelTextWrapping.h @@ -8,8 +8,5 @@ class CDC; class FontCache; struct TextLocale; -void WrapPixelText( - CDC& surface, unsigned short codePage, const char* text, std::vector& lines, int width -); #endif diff --git a/Source/UI/Text/UITextViewer.cpp b/Source/UI/Text/UITextViewer.cpp index 3fd518b5..fe42e054 100644 --- a/Source/UI/Text/UITextViewer.cpp +++ b/Source/UI/Text/UITextViewer.cpp @@ -244,9 +244,9 @@ void UITextViewer::Paint() { if ((this->unknown_00BC & 255) != 0) { DrawOutlinedText(*this, 3, y, line.c_str(), bytes, 0, 0xFFFFFF, 0, 12, 0, 0); } else if (this->outline != 0) { - DrawOutlinedColoredText(*this, owner.codePage, 3, y, line.c_str(), bytes, color, this->backgroundColor, 0, 12, this->bold); + DrawOutlinedColoredText(*this, 3, y, line.c_str(), bytes, color, this->backgroundColor, 0, 12, this->bold); } else { - DrawColoredText(*this, owner.codePage, 3, y, line.c_str(), bytes, color, 0, 12, false); + DrawColoredText(*this, 3, y, line.c_str(), bytes, color, 0, 12, false); } } } diff --git a/Source/UI/Text/UITextViewerMessages.cpp b/Source/UI/Text/UITextViewerMessages.cpp index b233e746..10c522ae 100644 --- a/Source/UI/Text/UITextViewerMessages.cpp +++ b/Source/UI/Text/UITextViewerMessages.cpp @@ -151,7 +151,7 @@ void UITextViewer::AppendText(char* text, int width, bool carriageReturns, bool if (pixels) { const int scrollWidth = carriageReturns ? this->verticalBar->geometry.width + 2 : 0; - WrapPixelText(*this->geometry.surface, owner.codePage, display.c_str(), wrapped, this->geometry.width - scrollWidth - 4); + this->WrapPixelText(display.c_str(), wrapped, this->geometry.width - scrollWidth - 4); } else { WrapRichText( display.c_str(), wrapped, width == 0 ? 35 : width, carriageReturns, this->m_text->items.descriptions diff --git a/Source/UI/Text/UITransBalloonText.cpp b/Source/UI/Text/UITransBalloonText.cpp index 3325b847..4b8dc61b 100644 --- a/Source/UI/Text/UITransBalloonText.cpp +++ b/Source/UI/Text/UITransBalloonText.cpp @@ -154,7 +154,7 @@ void UITransBalloonText::Paint() { if (this->m_richText != 0) { DrawColoredText( - *this, this->m_textContext->codePage, 6, y, line.c_str(), 0, color, family, height, true + *this, 6, y, line.c_str(), 0, color, family, height, true ); } else { TextContext context(*this->geometry.surface); @@ -182,7 +182,7 @@ void UITransBalloonText::Paint() { void UIColorTransBalloonText::Paint() { this->ClearSurface(0xFFFF00FF); std::uint32_t color = 0xFFFFFF; - DrawColoredText(*this, this->m_textContext->codePage, 6, 4, this->m_lines[0].c_str(), 0, color, 0, 12, false); + DrawColoredText(*this, 6, 4, this->m_lines[0].c_str(), 0, color, 0, 12, false); } // OFFSET: 0x0085B010 diff --git a/Source/UI/UIRoundBoxTooltipWnd.cpp b/Source/UI/UIRoundBoxTooltipWnd.cpp index 8687f497..f3845b4d 100644 --- a/Source/UI/UIRoundBoxTooltipWnd.cpp +++ b/Source/UI/UIRoundBoxTooltipWnd.cpp @@ -71,7 +71,7 @@ void UIColoringTextViewer::Paint() { auto& owner = *this->m_listContext; for (int index = first; index < end; ++index) { const auto& line = this->lines[index]; - DrawColoredText(*this, owner.codePage, 3, this->lineHeight * (index - first) + 4, line.c_str(), static_cast(line.size()), this->color, 0, 12, false); + DrawColoredText(*this, 3, this->lineHeight * (index - first) + 4, line.c_str(), static_cast(line.size()), this->color, 0, 12, false); } } diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 14d72354..e0be9a2b 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -2329,7 +2329,7 @@ void UIListBox_NaviSearch::Paint() { } const std::string& line = this->lines[index]; - DrawColoredText(*this, this->m_listContext->codePage, x, y, line.c_str(), static_cast(line.size()), color, 0, 12, false); + DrawColoredText(*this, x, y, line.c_str(), static_cast(line.size()), color, 0, 12, false); } } diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index 190e7caf..8c2b1c48 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -149,6 +149,7 @@ public: void sub_A85850(int x, int y, std::string text, int width, int align, std::uint32_t color, int arg7, int arg8, int arg9, int arg10, unsigned char bold); void FillRegion(int x, int y, int width, int height, std::uint32_t color); int TextWidth(const char* text, unsigned bytes, int family, int height, unsigned char bold, unsigned char italic); + void WrapPixelText(const char* text, std::vector& lines, int width); int ColoredTextWidth(const char* text, unsigned bytes, int family, int height, unsigned char bold); void DrawTextAt(int x, int y, const char* text, int bytes, int family, int height, std::uint32_t color, unsigned char bold, unsigned char italic