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

Function GetStringHeight

src/gfx.cpp:715–720  ·  view source on GitHub ↗

* Calculates height of string (in pixels). The string is changed to a multiline string if needed. * @param str string to check * @param maxw maximum string width * @return height of pixels of string when it is drawn */

Source from the content-addressed store, hash-verified

713 * @return height of pixels of string when it is drawn
714 */
715int GetStringHeight(std::string_view str, int maxw, FontSize fontsize)
716{
717 assert(maxw > 0);
718 Layouter layout(str, maxw, fontsize);
719 return layout.GetBounds().height;
720}
721
722/**
723 * Calculates height of string (in pixels). The string is changed to a multiline string if needed.

Callers 15

GetMaxHelpHeightMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
GetDesiredInfoHeightMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
OnResizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
GetHeadHeightMethod · 0.85
GetPageElementHeightMethod · 0.85

Calls 2

GetStringFunction · 0.70
GetBoundsMethod · 0.45

Tested by

no test coverage detected