From 50d06345810cf849548b95e92973f8466b7d5754 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Tue, 19 Sep 2023 21:17:56 +0100 Subject: COnfigurable width and hegith --- src/text.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/text.c') diff --git a/src/text.c b/src/text.c index 6cec4ad..9946c74 100644 --- a/src/text.c +++ b/src/text.c @@ -1,21 +1,25 @@ #include #include "ubox_vga.h" +#include "ubox_text.h" static const uint8_t *font; +static uint8_t w, h; -void ubox_set_font(const uint8_t *pixdata) +void ubox_set_font(const uint8_t *pixdata, uint8_t width, uint8_t height) { font = pixdata; + w = width; + h = height; } void ubox_put_text(uint16_t x, uint16_t y, const char *text, uint8_t color) { - ubox_rect dst = { x, y, 8, 8}; + ubox_rect dst = { x, y, w, h}; while (*text) { - ubox_blit_c(font + ((*text++ - ' ') << 6), &dst, color); - dst.x += 8; + ubox_blit_c(font + ((*text++ - ' ') * w * h), &dst, color); + dst.x += w; } } -- cgit v1.2.3