From a3b89318236cc595fa9b92d841036d8fad408a8d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 21 Sep 2021 05:25:54 +0200 Subject: [PATCH] Switch TTF render to UTF-8 --- Source/DiabloUI/credits.cpp | 2 +- Source/DiabloUI/progress.cpp | 4 ++-- Source/DiabloUI/ttf_render_wrapped.cpp | 4 ++-- Source/utils/ttf_wrap.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/DiabloUI/credits.cpp b/Source/DiabloUI/credits.cpp index ac08c50db883..e98df4110c81 100644 --- a/Source/DiabloUI/credits.cpp +++ b/Source/DiabloUI/credits.cpp @@ -64,7 +64,7 @@ CachedLine PrepareLine(std::size_t index) SDLSurfaceUniquePtr surface; if (contents[0] != '\0') { const SDL_Color shadowColor = { 0, 0, 0, 0 }; - SDLSurfaceUniquePtr text = TTFWrap::RenderText_Solid(font, contents, shadowColor); + SDLSurfaceUniquePtr text = TTFWrap::RenderUTF8_Solid(font, contents, shadowColor); // Set up the target surface to have 3 colors: mask, text, and shadow. surface = SDLWrap::CreateRGBSurfaceWithFormat(0, text->w + ShadowOffsetX, text->h + ShadowOffsetY, 8, SDL_PIXELFORMAT_INDEX8); diff --git a/Source/DiabloUI/progress.cpp b/Source/DiabloUI/progress.cpp index bfbca7e97522..5fe3cb781cae 100644 --- a/Source/DiabloUI/progress.cpp +++ b/Source/DiabloUI/progress.cpp @@ -41,8 +41,8 @@ void ProgressLoad(const char *msg) SDL_Color color = { 243, 243, 243, 0 }; SDL_Color black = { 0, 0, 0, 0 }; - msgSurface = TTFWrap::RenderText_Solid(font, msg, color); - msgShadow = TTFWrap::RenderText_Solid(font, msg, black); + msgSurface = TTFWrap::RenderUTF8_Solid(font, msg, color); + msgShadow = TTFWrap::RenderUTF8_Solid(font, msg, black); } SDL_Rect rect3 = { (Sint16)(PANEL_LEFT + 265), (Sint16)(UI_OFFSET_Y + 267), SML_BUTTON_WIDTH, SML_BUTTON_HEIGHT }; vecProgress.push_back(std::make_unique(&SmlButton, _("Cancel"), &DialogActionCancel, rect3)); diff --git a/Source/DiabloUI/ttf_render_wrapped.cpp b/Source/DiabloUI/ttf_render_wrapped.cpp index 577f64f53235..df214b707603 100644 --- a/Source/DiabloUI/ttf_render_wrapped.cpp +++ b/Source/DiabloUI/ttf_render_wrapped.cpp @@ -106,7 +106,7 @@ SDLSurfaceUniquePtr RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, S } if (strLines.empty()) - return TTFWrap::RenderText_Solid(font, text, fg); + return TTFWrap::RenderUTF8_Solid(font, text, fg); /* Create the target surface */ auto textbuf = SDLWrap::CreateRGBSurface(SDL_SWSURFACE, (strLines.size() > 1) ? wrapLength : width, height * strLines.size() + (lineSpace * (strLines.size() - 1)), 8, 0, 0, 0, 0); @@ -129,7 +129,7 @@ SDLSurfaceUniquePtr RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, S dest.y += lineskip; continue; } - SDLSurfaceUniquePtr tmp = TTFWrap::RenderText_Solid(font, text, fg); + SDLSurfaceUniquePtr tmp = TTFWrap::RenderUTF8_Solid(font, text, fg); dest.w = static_cast(tmp->w); dest.h = static_cast(tmp->h); diff --git a/Source/utils/ttf_wrap.h b/Source/utils/ttf_wrap.h index db552ff795de..f16c4bd9a32e 100644 --- a/Source/utils/ttf_wrap.h +++ b/Source/utils/ttf_wrap.h @@ -15,9 +15,9 @@ namespace devilution { namespace TTFWrap { -inline SDLSurfaceUniquePtr RenderText_Solid(TTF_Font *font, const char *text, SDL_Color fg) +inline SDLSurfaceUniquePtr RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg) { - SDLSurfaceUniquePtr ret { TTF_RenderText_Solid(font, text, fg) }; + SDLSurfaceUniquePtr ret { TTF_RenderUTF8_Solid(font, text, fg) }; if (ret == nullptr) ErrTtf();