not working

This commit is contained in:
2025-02-27 01:16:07 +00:00
parent ac0b47a45c
commit 3b6e272fd2
22 changed files with 448 additions and 50 deletions
+42 -7
View File
@@ -2,12 +2,47 @@ use libm::include_font;
pub mod ibm_vga_8x16;
pub static FONT_SPLEEN_8X16: Font = Font(include_font!(
"./libk/resources/font/spleen-8x16.psf"
));
pub static FONT_SPLEEN_8X16: Font =
Font::new(include_font!("./libk/resources/font/spleen-8x16.psf"));
pub static FONT_CP850_8X16: Font = Font(include_font!(
"./libk/resources/font/cp850-8x16.psf"
));
pub static FONT_CP850_8X16: Font = Font::new(include_font!("./libk/resources/font/cp850-8x16.psf"));
pub struct Font(pub [[u8; 16]; 512]);
// pub struct Font(pub [[u8; 16]; 512]);
pub struct Font {
width: usize,
height: usize,
length: u16,
data: [[u8; 16]; 512],
}
impl Font {
pub const fn new(data: [[u8; 16]; 512]) -> Font {
Font {
width: 8,
height: 16,
length: data.len() as u16,
data,
}
}
pub const fn glyph_for(&self, c: u16) -> &[u8] {
if c > self.length {
return &self.data[0];
}
&self.data[c as usize]
}
pub const fn width(&self) -> usize {
self.width
}
pub const fn height(&self) -> usize {
self.height
}
pub const fn default() -> &'static Font {
&FONT_CP850_8X16
}
}