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

Function GetDigitWidth

src/gfx.cpp:1286–1293  ·  view source on GitHub ↗

* Return the maximum width of single digit. * @param size Font of the digit * @return Width of the digit. */

Source from the content-addressed store, hash-verified

1284 * @return Width of the digit.
1285 */
1286uint8_t GetDigitWidth(FontSize size)
1287{
1288 uint8_t width = 0;
1289 for (char c = '0'; c <= '9'; c++) {
1290 width = std::max(GetCharacterWidth(size, c), width);
1291 }
1292 return width;
1293}
1294
1295/**
1296 * Determine the broadest digits for guessing the maximum width of a n-digit number.

Callers 1

UpdateWidgetSizeMethod · 0.85

Calls 1

GetCharacterWidthFunction · 0.85

Tested by

no test coverage detected