/* Returns the width in pixels of a string when it is rendered. 
This function only applied to bitmap fonts (which can have variable widths). All smallfonts (if available) are fixed width and can easily have their width calculated without costly functions like this one. */
uint16_t fontsGetStringWidth(const FONT_INFO *fontInfo, char *str)
/* Returns the width in pixels of a string when it is rendered. 
This function only applied to bitmap fonts (which can have variable widths). All smallfonts (if available) are fixed width and can easily have their width calculated without costly functions like this one. */
uint16_t fontsGetStringWidth(const FONT_INFO *fontInfo, char *str)
{
  uint16_t width = 0;
  uint32_t currChar;
  uint32_t startChar = fontInfo->startChar;
  for (currChar = *str; currChar; currChar = *(++str))
  {
    if (fontInfo->charInfo != NULL)
    {
      width += fontInfo->charInfo[currChar - startChar].widthBits + 1;
    }
    else
    {
      width += 5 + 1;
    }
  }
  return width > 0 ? width - 1 : width;
}