summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-10 17:31:27 -0700
committercflip <cflip@cflip.net>2023-01-10 17:31:27 -0700
commit3eaf3418928e9e9eac271961a983b720a7989972 (patch)
treebc2c4995aadbf5c1d0a8bf9f6df628d0b4647823 /window.c
parent0cd5d2b28f7529f4f9f7b31b9f54e76ada76d9b7 (diff)
Parse unicode tables in PSF fonts
Diffstat (limited to 'window.c')
-rw-r--r--window.c12
1 files changed, 9 insertions, 3 deletions
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;