diff --git a/Source/panels/charpanel.cpp b/Source/panels/charpanel.cpp index 85bc44f56..79d5216bf 100644 --- a/Source/panels/charpanel.cpp +++ b/Source/panels/charpanel.cpp @@ -1,6 +1,8 @@ #include "panels/charpanel.hpp" #include + +#include #include #include @@ -236,8 +238,13 @@ void DrawShadowString(const Surface &out, const PanelEntry &entry) labelPosition += Displacement { -entry.labelLength - (IsSmallFontTall() ? 2 : 3), 0 }; } - DrawString(out, text, { labelPosition + Displacement { -2, 2 }, { entry.labelLength, PanelFieldHeight } }, style | UiFlags::ColorBlack, Spacing); - DrawString(out, text, { labelPosition, { entry.labelLength, PanelFieldHeight } }, style | UiFlags::ColorWhite, Spacing); + // If the text is less tall then the field, we center it vertically relative to the field. + // Otherwise, we draw from the top of the field. + const int textHeight = (std::count(wrapped.begin(), wrapped.end(), '\n') + 1) * GetLineHeight(wrapped, GameFont12); + const int labelHeight = std::max(PanelFieldHeight, textHeight); + + DrawString(out, text, { labelPosition + Displacement { -2, 2 }, { entry.labelLength, labelHeight } }, style | UiFlags::ColorBlack, Spacing); + DrawString(out, text, { labelPosition, { entry.labelLength, labelHeight } }, style | UiFlags::ColorWhite, Spacing); } void DrawStatButtons(const Surface &out)