Skip to content

Commit 6709e67

Browse files
committed
rendy: Fix a rather nasty bug in bitmap font rendering
A few commits back I introduced a bug where bitmap font rendering would omit the first column of the rendered glyph: We use the following code to loop over the columns in the glyph and determine which pixels should be filled in: ```rs for gx in 0..FONT_WIDTH { let draw = glyph[gy] & (1 << (FONT_WIDTH - gx)) != 0; // ... } ``` And I've noticed that following code will only perform bit mask check on bits (zero based) 1 through 8 which effectively omits the first column of the glyph (bit 0) and checks the non existent column 9 (bit 8). Thanks for coming to my TED talk :^) ~~and shame on andy for not catching that (jk, it's fine!)~~
1 parent 421d981 commit 6709e67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/aero_kernel/src/rendy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ impl<'this> DebugRendy<'this> {
572572
};
573573

574574
for gx in 0..FONT_WIDTH {
575-
let draw = glyph[gy] & (1 << (FONT_WIDTH - gx)) != 0;
575+
let draw = glyph[gy] & (1 << (FONT_WIDTH - gx - 1)) != 0;
576576
let color = if draw {
577577
char.fg
578578
} else if char.bg == u32::MAX {

0 commit comments

Comments
 (0)