/* Renders a single AA2 character on the screen. 
This text rendering method used a lookup table of pre-calculated colors, and doesn't require any reads from the LCD (not all displays support reading pixels back). This offers the best performance and high-quality text, but can only be used on solid backgrounds where the bgcolor is known. */
void aafontsDrawCharAA2(uint16_t x, uint16_t y, uint16_t height, aafontsCharInfo_t character, const uint16_t *colorTable)
/* Renders a single AA2 character on the screen. 
This text rendering method used a lookup table of pre-calculated colors, and doesn't require any reads from the LCD (not all displays support reading pixels back). This offers the best performance and high-quality text, but can only be used on solid backgrounds where the bgcolor is known. */
void aafontsDrawCharAA2(uint16_t x, uint16_t y, uint16_t height, aafontsCharInfo_t character, const uint16_t *colorTable)
{
  uint16_t w, h, pos;
  uint8_t color;
  for (h = 0; h < height; h++)
  {
    pos = 0;
    for (w = 0; w < character.width; w++)
    {
      color = character.charData[h*character.bytesPerRow + w/4];
      switch (pos)
      {
        case 0:
          color = (color >> 6) & 0x03;
          break;
        case 1:
          color = (color >> 4) & 0x03;
          break;
        case 2:
          color = (color >> 2) & 0x03;
          break;
        case 3:
          color = color & 0x03;
          break;
      }
      if (color) lcdDrawPixel(x+w, y+h, colorTable[color & 0xF]);
      pos++;
      if (pos == 4) pos = 0;
    }
  }
}