mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix incorrect text width calculation of multi-line text
For text spanning multiple lines `TextWidth` only returned the length of the last line instead of the length of the longest line.
This commit is contained in:
parent
ad69d62015
commit
0ca6d06fba
|
@ -845,7 +845,7 @@ public:
|
|||
*pAlignedHeight = Cursor.m_AlignedFontSize;
|
||||
if(pMaxCharacterHeightInLine != nullptr)
|
||||
*pMaxCharacterHeightInLine = Cursor.m_MaxCharacterHeight;
|
||||
return Cursor.m_X;
|
||||
return Cursor.m_LongestLineWidth;
|
||||
}
|
||||
|
||||
int TextLineCount(float Size, const char *pText, float LineWidth) override
|
||||
|
@ -1416,8 +1416,7 @@ public:
|
|||
LastCharWidth = CharWidth;
|
||||
}
|
||||
|
||||
if(DrawX > pCursor->m_LongestLineWidth)
|
||||
pCursor->m_LongestLineWidth = DrawX;
|
||||
pCursor->m_LongestLineWidth = maximum(pCursor->m_LongestLineWidth, DrawX);
|
||||
}
|
||||
|
||||
if(NewLine)
|
||||
|
|
Loading…
Reference in a new issue