MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetStringLineCount

Function GetStringLineCount

src/gfx.cpp:739–743  ·  view source on GitHub ↗

* Calculates number of lines of string. The string is changed to a multiline string if needed. * @param str string to check * @param maxw maximum string width * @return number of lines of string when it is drawn */

Source from the content-addressed store, hash-verified

737 * @return number of lines of string when it is drawn
738 */
739int GetStringLineCount(std::string_view str, int maxw)
740{
741 Layouter layout(str, maxw);
742 return (uint)layout.size();
743}
744
745/**
746 * Calculate string bounding box for multi-line strings.

Callers 2

OnPaintMethod · 0.85
NetworkDrawChatMessageFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected