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

Function GetStringListWidth

src/gfx.cpp:920–927  ·  view source on GitHub ↗

* Get maximum width of a list of strings. * @param list List of strings. * @param fontsize Font size to use. * @return Width of longest string within the list. */

Source from the content-addressed store, hash-verified

918 * @return Width of longest string within the list.
919 */
920uint GetStringListWidth(std::span<const StringID> list, FontSize fontsize)
921{
922 uint width = 0;
923 for (auto str : list) {
924 width = std::max(width, GetStringBoundingBox(str, fontsize).width);
925 }
926 return width;
927}
928
929/**
930 * Get maximum dimension of a list of strings.

Callers 3

UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85

Calls 1

GetStringBoundingBoxFunction · 0.85

Tested by

no test coverage detected