From 89db16393ea33e74f4cd7502210dcb752b4a14aa Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 12 Jul 2019 20:09:15 +0200 Subject: [PATCH] - offset notification messages so that the accents do not get cut off. This essentially means that the tallest character in a font determines positioning. --- src/c_console.cpp | 5 +++-- src/gamedata/fonts/font.cpp | 7 +++++++ src/gamedata/fonts/v_font.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index 7965a66432..7b9a0ae583 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1061,10 +1061,11 @@ void FNotifyBuffer::Draw() if (gamestate == GS_FULLCONSOLE || gamestate == GS_DEMOSCREEN/* || menuactive != MENU_Off*/) return; - line = Top; + FFont* font = generic_ui ? NewSmallFont : AlternativeSmallFont; + + line = Top + font->GetDisplacement(); canskip = true; - FFont *font = generic_ui ? NewSmallFont : AlternativeSmallFont; lineadv = font->GetHeight (); for (unsigned i = 0; i < Text.Size(); ++ i) diff --git a/src/gamedata/fonts/font.cpp b/src/gamedata/fonts/font.cpp index 09423933fd..c35f933e9a 100644 --- a/src/gamedata/fonts/font.cpp +++ b/src/gamedata/fonts/font.cpp @@ -357,6 +357,8 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla } if (!noTranslate) LoadTranslations(); + + } void FFont::ReadSheetFont(TArray &folderdata, int width, int height, const DVector2 &Scale) @@ -1191,6 +1193,11 @@ void FFont::FixXMoves() } Chars[i].XMove = SpaceWidth; } + if (Chars[i].OriginalPic) + { + int ofs = Chars[i].OriginalPic->GetScaledTopOffset(0); + if (ofs > Displacement) Displacement = ofs; + } } } diff --git a/src/gamedata/fonts/v_font.h b/src/gamedata/fonts/v_font.h index 312e379000..caaa0f27a1 100644 --- a/src/gamedata/fonts/v_font.h +++ b/src/gamedata/fonts/v_font.h @@ -127,6 +127,7 @@ public: virtual void SetDefaultTranslation(uint32_t *colors); void CheckCase(); + int GetDisplacement() const { return Displacement; } protected: @@ -147,6 +148,7 @@ protected: int FontHeight; int GlobalKerning; int TranslationType = 0; + int Displacement = 0; char Cursor; bool noTranslate; bool translateUntranslated;