From c4bcf3d628fba27a9f4313574d4949acbae7c78e Mon Sep 17 00:00:00 2001 From: def Date: Sat, 21 May 2022 11:38:28 +0200 Subject: [PATCH] Render full text when it still fits --- src/engine/client/text.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index 3288198c6..de3664cc8 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -1256,7 +1256,8 @@ public: if((RenderFlags & TEXT_RENDER_FLAG_KERNING) != 0) CharKerningEllipsis = Kerning(TextContainer.m_pFont, pChr->m_GlyphIndex, pEllipsisChr->m_GlyphIndex) * Scale * Size; - if(DrawX + CharKerning + Advance + CharKerningEllipsis + AdvanceEllipsis - pCursor->m_StartX > pCursor->m_LineWidth) + const int WidthOfRemainingText = CalculateTextWidth(pTmp, str_length(pTmp), 0, 100); + if(DrawX + CharKerning + Advance + WidthOfRemainingText - pCursor->m_StartX > pCursor->m_LineWidth && DrawX + CharKerning + Advance + CharKerningEllipsis + AdvanceEllipsis - pCursor->m_StartX > pCursor->m_LineWidth) { // we hit the end, only render ellipsis and finish pTmp = pEllipsis;