diff options
author | cflip <cflip@cflip.net> | 2023-01-12 14:14:17 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2023-01-12 14:14:17 -0700 |
commit | 9e97d9b80dbe0786fedfa46942bd9308a47bc9be (patch) | |
tree | 518fc1d43247ccf115cad480e9d00739875b38e2 /window.c | |
parent | b9558f6a53213089372e0aa9795745332cd6209d (diff) |
Big improvements to font rendering
The previous rasterizing code relied on each row in the font being 8
bits wide, which is not the case with any font wider than 8 pixels.
These changes make it possible to properly load the 24px Terminus font,
and somehow also fixes incorrect characters in the 12px font.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -19,7 +19,7 @@ void window_init(const char *title, int rows, int cols) if (SDL_Init(SDL_INIT_VIDEO) != 0) fatal_error("Failed to init SDL: %s\n", SDL_GetError()); - font = font_load("terminus/ter-u12n.psf"); + font = font_load("terminus/ter-u24n.psf"); int window_width = cols * font.width; int window_height = rows * font.height; @@ -82,7 +82,7 @@ static void draw_font_text(struct append_buffer *buffer) dstrect.w = font.width; dstrect.h = font.height; - srcrect.x = glyph_index * 8; + srcrect.x = glyph_index * font.width; srcrect.y = 0; srcrect.w = font.width; srcrect.h = font.height; |