base/terminal/font.rs
1/// Height of each char raster. The font size is ~0.84% of this. Thus, this is the line height that
2/// enables multiple characters to be side-by-side and appear optically in one line in a natural way.
3pub const CHAR_RASTER_HEIGHT: RasterHeight = RasterHeight::Size16;
4
5/// The width of each single symbol of the mono space font.
6pub const CHAR_RASTER_WIDTH: usize = get_raster_width(FontWeight::Regular, CHAR_RASTER_HEIGHT);
7
8/// Backup character if a desired symbol is not available by the font.
9/// The '�' character requires the feature "unicode-specials".
10pub const BACKUP_CHAR: char = '�';
11
12pub const FONT_WEIGHT: FontWeight = FontWeight::Regular;
13
14extern "C" {
15 pub static mut _binary_font_psf_start: u64;
16 pub static mut _binary_font_psf_end: u64;
17}
18
19/// The PC Screen Font header.
20pub struct ScreenFontHeader {
21 /// Magic bytes for font identification.
22 pub magic: u16,
23 /// The PSF font mode.
24 pub font_mode: u8,
25 /// The PSF character size.
26 pub size: u8,
27}
28
29pub struct ScreenFont {
30 /// Magic bytes to identify PSF.
31 pub magic: u32,
32 /// Zero, and nothing else.
33 pub version: u32,
34 /// Offset of bitmaps in file, `32`.
35 pub header_size: u32,
36 /// `0` if there is no unicode table.
37 pub flags: u32,
38 /// The number of glyphs.
39 pub glyph_count: u32,
40 /// THe size of each glyph.
41 pub bytes_per_glyph: u32,
42 /// The height in pixels of a glyph.
43 pub height: u32,
44 /// The width in pixels of a glyph.
45 pub width: u32,
46}
47
48// IMPORTS //
49
50use noto_sans_mono_bitmap::{
51 FontWeight, RasterHeight, RasterizedChar,
52 get_raster, get_raster_width,
53};