Add new anti-aliased (smooth) font examples + bug fixes

Four new examples have been added to show different methods of rendering
the anta-aliased fonts.  A few minor bugs have been corrected associated
with the font rendering. drawNumber and drawFloat handle fixed width
mono fonts with no digit movement.
This commit is contained in:
Bodmer
2018-10-21 17:53:27 +01:00
parent 22177cf29a
commit 1a0b37097a
29 changed files with 1034 additions and 42 deletions
+7 -6
View File
@@ -1473,10 +1473,10 @@ void TFT_eSprite::drawGlyph(uint16_t code)
if (code == '\n') {
if (_created)
{
this->cursor_x = 0;
this->cursor_y += this->gFont.yAdvance;
if (this->cursor_y >= _height) this->cursor_y = 0;
return;
this->cursor_x = 0;
this->cursor_y += this->gFont.yAdvance;
if (this->cursor_y >= _height) this->cursor_y = 0;
return;
}
else
{
@@ -1511,7 +1511,7 @@ void TFT_eSprite::drawGlyph(uint16_t code)
uint8_t pbuffer[this->gWidth[gNum]];
uint16_t xs = 0;
int16_t xs = 0;
uint16_t dl = 0;
for (int y = 0; y < this->gHeight[gNum]; y++)
@@ -1525,7 +1525,8 @@ void TFT_eSprite::drawGlyph(uint16_t code)
if (pixel != 0xFF)
{
if (dl) { drawFastHLine( xs, y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], dl, fg); dl = 0; }
if (pixel>127) drawPixel(x + this->cursor_x + this->gdX[gNum], y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], alphaBlend(pixel, fg, bg));
if (_bpp != 1) drawPixel(x + this->cursor_x + this->gdX[gNum], y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], alphaBlend(pixel, fg, bg));
else if (pixel>127) drawPixel(x + this->cursor_x + this->gdX[gNum], y + this->cursor_y + this->gFont.maxAscent - this->gdY[gNum], fg);
}
else
{