* Determine the broadest digits for guessing the maximum width of a n-digit number. * @param size Font of the digit * @returns Broadest digits, first which is not 0 (use this digit as first digit for numbers with more than one * digit.), second including 0 (use this digit for all digits, except the first one; or for numbers with * only one digit.) */
| 1300 | * only one digit.) |
| 1301 | */ |
| 1302 | std::pair<uint8_t, uint8_t> GetBroadestDigit(FontSize size) |
| 1303 | { |
| 1304 | uint8_t front = 0; |
| 1305 | uint8_t next = 0; |
| 1306 | int width = -1; |
| 1307 | for (char c = '9'; c >= '0'; c--) { |
| 1308 | int w = GetCharacterWidth(size, c); |
| 1309 | if (w <= width) continue; |
| 1310 | |
| 1311 | width = w; |
| 1312 | next = c - '0'; |
| 1313 | if (c != '0') front = c - '0'; |
| 1314 | } |
| 1315 | return {front, next}; |
| 1316 | } |
| 1317 | |
| 1318 | void ScreenSizeChanged() |
| 1319 | { |
no test coverage detected