MCPcopy Create free account
hub / github.com/ddnet/ddnet / TextWidth

Method TextWidth

src/engine/client/text.cpp:1358–1374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1356 }
1357
1358 float TextWidth(float FontSize, const char *pText, int StrLength = -1, float LineWidth = -1.0f, int Flags = 0, const STextSizeProperties &TextSizeProps = {}) override
1359 {
1360 CTextCursor Cursor;
1361 Cursor.m_FontSize = FontSize;
1362 Cursor.m_Flags = Flags;
1363 Cursor.m_LineWidth = LineWidth;
1364 TextEx(&Cursor, pText, StrLength);
1365 if(TextSizeProps.m_pHeight != nullptr)
1366 *TextSizeProps.m_pHeight = Cursor.Height();
1367 if(TextSizeProps.m_pAlignedFontSize != nullptr)
1368 *TextSizeProps.m_pAlignedFontSize = Cursor.m_AlignedFontSize;
1369 if(TextSizeProps.m_pMaxCharacterHeightInLine != nullptr)
1370 *TextSizeProps.m_pMaxCharacterHeightInLine = Cursor.m_MaxCharacterHeight;
1371 if(TextSizeProps.m_pLineCount != nullptr)
1372 *TextSizeProps.m_pLineCount = Cursor.m_LineCount;
1373 return Cursor.m_LongestLineWidth;
1374 }
1375
1376 STextBoundingBox TextBoundingBox(float FontSize, const char *pText, int StrLength = -1, float LineWidth = -1.0f, float LineSpacing = 0.0f, int Flags = 0) override
1377 {

Callers 15

RenderCandidatesMethod · 0.80
DoEditBox_SearchMethod · 0.80
RenderTimeMethod · 0.80
ShowPopupMessageMethod · 0.80
ShowPopupConfirmMethod · 0.80
RenderServerBroadcastMethod · 0.80
RenderGameTimerMethod · 0.80
RenderSuddenDeathMethod · 0.80
RenderScoreHudMethod · 0.80

Calls 1

HeightMethod · 0.80

Tested by

no test coverage detected