Render full text when it still fits

This commit is contained in:
def 2022-05-21 11:38:28 +02:00
parent 2818c6e17c
commit c4bcf3d628

View file

@ -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;