Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed missing first line of custom font #404

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Adafruit_GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
// drawChar() directly with 'bad' characters of font may cause mayhem!

c -= (uint8_t)pgm_read_byte(&gfxFont->first);
uint8_t yAdvance = (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
GFXglyph *glyph = pgm_read_glyph_ptr(gfxFont, c);
uint8_t *bitmap = pgm_read_bitmap_ptr(gfxFont);

Expand Down Expand Up @@ -1220,10 +1221,11 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
}
if (bits & 0x80) {
if (size_x == 1 && size_y == 1) {
writePixel(x + xo + xx, y + yo + yy, color);
writePixel(x + xo + xx, y + yo + yy + yAdvance, color);
} else {
writeFillRect(x + (xo16 + xx) * size_x, y + (yo16 + yy) * size_y,
size_x, size_y, color);
writeFillRect(x + (xo16 + xx) * size_x,
y + (yo16 + yy) * size_y + yAdvance * size_y, size_x,
size_y, color);
}
}
bits <<= 1;
Expand Down