@@ -35,7 +35,8 @@ use stivale_boot::v2::StivaleFramebufferTag;
35
35
36
36
use crate :: utils:: sync:: Mutex ;
37
37
38
- static FONT : & [ u8 ] = include_bytes ! ( "../../font.bin" ) ;
38
+ static FONT : & [ [ u8 ; FONT_HEIGHT ] ; FONT_GLYPHS ] =
39
+ unsafe { & core:: mem:: transmute ( * include_bytes ! ( "../../font.bin" ) ) } ;
39
40
40
41
// This is an example of how the rendered screen will look like:
41
42
//
@@ -53,6 +54,7 @@ static FONT: &[u8] = include_bytes!("../../font.bin");
53
54
54
55
const FONT_WIDTH : usize = 8 ;
55
56
const FONT_HEIGHT : usize = 16 ;
57
+ const FONT_GLYPHS : usize = 256 ;
56
58
57
59
const DEFAULT_MARGIN : usize = 64 / 2 ;
58
60
const TAB_SIZE : usize = 4 ;
@@ -553,12 +555,7 @@ impl<'this> DebugRendy<'this> {
553
555
554
556
let x = self . offset_x + x * FONT_WIDTH ;
555
557
let y = self . offset_y + y * FONT_HEIGHT ;
556
- let glyph = unsafe {
557
- core:: slice:: from_raw_parts (
558
- FONT . as_ptr ( ) . offset ( ch as isize * FONT_HEIGHT as isize ) as * const u8 ,
559
- FONT_HEIGHT ,
560
- )
561
- } ;
558
+ let glyph = & FONT [ ch as usize ] ;
562
559
563
560
// naming: fx, fy for font coordinates and gx, gy for glyph coordinates
564
561
for gy in 0 ..FONT_HEIGHT {
@@ -575,7 +572,7 @@ impl<'this> DebugRendy<'this> {
575
572
} ;
576
573
577
574
for gx in 0 ..FONT_WIDTH {
578
- let draw = glyph[ gy] & ( 1 << ( FONT_WIDTH - gx) ) != 0 ;
575
+ let draw = glyph[ gy] & ( 1 << ( FONT_WIDTH - gx - 1 ) ) != 0 ;
579
576
let color = if draw {
580
577
char. fg
581
578
} else if char. bg == u32:: MAX {
0 commit comments