diff options
Diffstat (limited to 'src/user/libfont/fonts.c')
-rw-r--r-- | src/user/libfont/fonts.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/user/libfont/fonts.c b/src/user/libfont/fonts.c index 51e127b..d63a5d9 100644 --- a/src/user/libfont/fonts.c +++ b/src/user/libfont/fonts.c @@ -58,11 +58,17 @@ struct font_info *get_font(const char *name) { //pitch is in pixels void put_char(const struct font_info *font, char ch, _pixel_t *pb_ptr, uint32_t pb_pitch, _pixel_t bg, _pixel_t fg) { -//char *const msg = format("put_char(font = 0x%x, ch = '%c', pb_ptr = 0x%x, pb_pitch = %u, bg = 0x%2x, fg = 0x%2x);", font, ch, pb_ptr, pb_pitch, bg, fg); -//_system_log(msg); -//free_block(msg); const bool *const bitmap = font->bitmaps[(uint8_t)ch] ? font->bitmaps[(uint8_t)ch] : font->bitmaps[0]; for (uint32_t y = 0; y < font->char_height; ++y) for (uint32_t x = 0; x < font->char_width; ++x) pb_ptr[y * pb_pitch + x] = bitmap[y * font->char_width + x] ? fg : bg; +} + +//pitch is in pixels +void put_char_no_bg(const struct font_info *font, char ch, _pixel_t *pb_ptr, uint32_t pb_pitch, _pixel_t fg) { + const bool *const bitmap = font->bitmaps[(uint8_t)ch] ? font->bitmaps[(uint8_t)ch] : font->bitmaps[0]; + for (uint32_t y = 0; y < font->char_height; ++y) + for (uint32_t x = 0; x < font->char_width; ++x) + if (bitmap[y * font->char_width + x]) + pb_ptr[y * pb_pitch + x] = fg; }
\ No newline at end of file |