cfb: Skip non-existent font glyphs
The change ensures that returned glyph exists in the current font. Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
This commit is contained in:
committed by
Anas Nashif
parent
c5d7f93b0a
commit
1eaceb448f
@@ -69,6 +69,10 @@ static struct char_framebuffer char_fb;
|
||||
|
||||
static inline uint8_t *get_glyph_ptr(const struct cfb_font *fptr, uint8_t c)
|
||||
{
|
||||
if (c < fptr->first_char || c > fptr->last_char) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (uint8_t *)fptr->data +
|
||||
(c - fptr->first_char) *
|
||||
(fptr->width * fptr->height / 8U);
|
||||
|
||||
Reference in New Issue
Block a user