From 3eaf3418928e9e9eac271961a983b720a7989972 Mon Sep 17 00:00:00 2001 From: cflip Date: Tue, 10 Jan 2023 17:31:27 -0700 Subject: Parse unicode tables in PSF fonts --- window.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 1e6d5f2..7f29abe 100644 --- a/window.c +++ b/window.c @@ -97,15 +97,21 @@ static void draw_font_text(struct append_buffer *buffer) for (int i = 0; i < buffer->length; i++) { const char letter = buffer->buffer[i]; - if (letter > 128) { - printf("TODO: Non-ASCII characters are not currently supported.\n"); + if (letter == ' ') { + dstrect.x += font.width; continue; } + + int glyph_index = letter; + if (font.unicode_desc != NULL) { + glyph_index = font.unicode_desc[glyph_index]; + } + dstrect.w = font.width; dstrect.h = font.height; - srcrect.x = letter * 8; + srcrect.x = glyph_index * 8; srcrect.y = 0; srcrect.w = font.width; srcrect.h = font.height; -- cgit v1.2.3