summaryrefslogtreecommitdiff
path: root/src/user/libfont/fonts.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-03-05 18:07:48 -0500
committerBenji Dial <benji6283@gmail.com>2021-03-05 18:07:48 -0500
commit76e39eac8cee2175ec62a191f7c91ca53857e80c (patch)
tree156946f6e8f491235453aa3cbecfda43d6baa2a7 /src/user/libfont/fonts.c
parent5e5e524f08ad653a7bf5d6e97f3a49f6c27d08fa (diff)
downloadportland-os-76e39eac8cee2175ec62a191f7c91ca53857e80c.tar.gz
more raleigh, including button and vbox widgets
Diffstat (limited to 'src/user/libfont/fonts.c')
-rw-r--r--src/user/libfont/fonts.c12
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