/* Draws a string using the supplied anti-aliased font.  */
void aafontsDrawString(uint16_t x, uint16_t y, const uint16_t *colorTable, const aafontsFont_t *font, char *str)
/* Draws a string using the supplied anti-aliased font.  */
void aafontsDrawString(uint16_t x, uint16_t y, const uint16_t *colorTable, const aafontsFont_t *font, char *str)
{
  uint16_t currentX, charWidth, characterToOutput;
  const aafontsCharInfo_t *charInfo;
  currentX = x;
  while (*str != '\0')
  {
    characterToOutput = *str;
    if ((characterToOutput > font->lastChar) || (characterToOutput < font->firstChar))
    {
      charWidth = font->unknownCharWidth;
    }
    else
    {
      charInfo = &(font->charTable[characterToOutput - font->firstChar]);
      charWidth = charInfo->width;
      switch (font->fontType)
      {
        case AAFONTS_FONTTYPE_AA2:
          aafontsDrawCharAA2(currentX, y, font->fontHeight, *charInfo, &colorTable[0]);
          break;
        case AAFONTS_FONTTYPE_AA4:
          aafontsDrawCharAA4(currentX, y, font->fontHeight, *charInfo, &colorTable[0]);
          break;
      }
    }
    currentX += charWidth;
    str++;
  }
}