(svn r25313) -Fix: Do not assume '8' to be the broadest digit, but test all of them.

This commit is contained in:
frosch
2013-06-01 14:33:48 +00:00
parent f292a87dc4
commit ce110eed32
9 changed files with 32 additions and 11 deletions

View File

@@ -1689,6 +1689,24 @@ byte GetDigitWidth(FontSize size)
return width;
}
/**
* Return the digit with the biggest width.
* @param size Font of the digit
* @return Broadest digit.
*/
uint GetBroadestDigit(FontSize size)
{
uint digit = 0;
byte width = 0;
for (char c = '0'; c <= '9'; c++) {
byte w = GetCharacterWidth(size, c);
if (w > width) {
width = w;
digit = c - '0';
}
}
return digit;
}
void ScreenSizeChanged()
{