diff --git a/Cargo.lock b/Cargo.lock index 4c1a99f4..07f943b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ name = "bootloader-x86_64-bios-stage-3" version = "0.11.17" dependencies = [ "bootloader-x86_64-bios-common", - "noto-sans-mono-bitmap 0.1.6", + "noto-sans-mono-bitmap", ] [[package]] @@ -149,7 +149,7 @@ dependencies = [ "bootloader_api", "conquer-once", "log", - "noto-sans-mono-bitmap 0.2.0", + "noto-sans-mono-bitmap", "rand", "rand_hc", "raw-cpuid", @@ -455,15 +455,9 @@ dependencies = [ [[package]] name = "noto-sans-mono-bitmap" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f45ec3ff6dc7bea48d52dd14a5565be0d596ac4758c9a55e42539177001a983b" - -[[package]] -name = "noto-sans-mono-bitmap" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27daf9557165efe1d09b52f97393bf6283cadb0a76fbe64a1061e15553a994a" +checksum = "09b7b72dee69e4110d1b91fb8d497c1b74a54082da5738dff84136142c4f767b" [[package]] name = "once_cell" diff --git a/Cargo.toml b/Cargo.toml index ae709d43..04cf0582 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ bootloader_api = { version = "0.11.17", path = "api" } bootloader-x86_64-common = { version = "0.11.17", path = "common" } bootloader-boot-config = { version = "0.11.17", path = "common/config" } bootloader-x86_64-bios-common = { version = "0.11.17", path = "bios/common" } +noto-sans-mono-bitmap = { version = "0.4.0", default-features = false } [features] default = ["bios", "uefi"] diff --git a/Changelog.md b/Changelog.md index 3e308d51..61d21ce9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,15 @@ (e.g., via the SIMPLE_TEXT_OUTPUT_PROTOCOL) is no longer replicated to the serial device. The bootloader's own logger now takes full ownership of the serial device, ensuring safe and reliable logging. +- The framebuffer log output uses `noto-sans-mono-bitmap` 0.4, which renders + the mono font the standard way, like terminals and editors: characters are + sharper, share a common baseline, and are no longer cut off. To keep the + text about as large as before, it uses a 20 px instead of a 16 px raster + height (a 14.7 px instead of a 14 px font) without extra spacing between + lines. The UEFI bootloader and BIOS stage 4 are about 10% smaller. +- BIOS stage 3 uses `noto-sans-mono-bitmap` 0.4 instead of 0.1 and only + compiles the one font variant it uses. This speeds up clean builds of the + `bootloader` crate by about 25% and makes BIOS stage 3 about 14% smaller. # 0.11.17 - 2026-07-27 diff --git a/bios/stage-3/Cargo.toml b/bios/stage-3/Cargo.toml index 0fe436c6..43e72504 100644 --- a/bios/stage-3/Cargo.toml +++ b/bios/stage-3/Cargo.toml @@ -11,7 +11,15 @@ description = "Third BIOS stage of the `bootloader` crate" [dependencies] bootloader-x86_64-bios-common = { workspace = true } -noto-sans-mono-bitmap = "0.1.5" + +[dependencies.noto-sans-mono-bitmap] +workspace = true +features = [ + "regular", + "size_20", + "unicode-basic-latin", + "unicode-latin-1-supplement", +] # This currently causes a cargo warning, but it is required for publishing to crates.io. # See https://github.com/rust-lang/cargo/issues/8264 for details. diff --git a/bios/stage-3/src/screen.rs b/bios/stage-3/src/screen.rs index 6cffd166..586b8751 100644 --- a/bios/stage-3/src/screen.rs +++ b/bios/stage-3/src/screen.rs @@ -1,6 +1,8 @@ use bootloader_x86_64_bios_common::{BiosFramebufferInfo, PixelFormat, racy_cell::RacyCell}; use core::{fmt, ptr}; -use noto_sans_mono_bitmap::{BitmapChar, BitmapHeight, FontWeight, get_bitmap}; +use noto_sans_mono_bitmap::{FontWeight, RasterHeight, RasterizedChar, get_raster}; + +const RASTER_HEIGHT: RasterHeight = RasterHeight::Size20; static WRITER: RacyCell> = RacyCell::new(None); pub struct Writer; @@ -46,7 +48,7 @@ impl ScreenWriter { } fn newline(&mut self) { - self.y_pos += 14 + LINE_SPACING; + self.y_pos += RASTER_HEIGHT.val() + LINE_SPACING; self.carriage_return() } @@ -74,7 +76,7 @@ impl ScreenWriter { '\n' => self.newline(), '\r' => self.carriage_return(), c => { - let bitmap_char = get_bitmap(c, FontWeight::Regular, BitmapHeight::Size14).unwrap(); + let bitmap_char = get_raster(c, FontWeight::Regular, RASTER_HEIGHT).unwrap(); if self.x_pos + bitmap_char.width() > self.width() { self.newline(); } @@ -86,8 +88,8 @@ impl ScreenWriter { } } - fn write_rendered_char(&mut self, rendered_char: BitmapChar) { - for (y, row) in rendered_char.bitmap().iter().enumerate() { + fn write_rendered_char(&mut self, rendered_char: RasterizedChar) { + for (y, row) in rendered_char.rows().enumerate() { for (x, byte) in row.iter().enumerate() { self.write_pixel(self.x_pos + x, self.y_pos + y, *byte); } diff --git a/common/Cargo.toml b/common/Cargo.toml index 6ff3aee0..746a2c46 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -23,11 +23,10 @@ uart_16550 = "0.8.0" log = "0.4.17" [dependencies.noto-sans-mono-bitmap] -version = "0.2.0" -default-features = false +workspace = true features = [ "regular", - "size_16", + "size_20", "unicode-basic-latin", # required for the fallback char '�' "unicode-specials", diff --git a/common/src/framebuffer.rs b/common/src/framebuffer.rs index 0c00b511..03041fe8 100644 --- a/common/src/framebuffer.rs +++ b/common/src/framebuffer.rs @@ -6,7 +6,7 @@ use noto_sans_mono_bitmap::{ }; /// Additional vertical space between lines -const LINE_SPACING: usize = 2; +const LINE_SPACING: usize = 0; /// Additional horizontal space between characters. const LETTER_SPACING: usize = 0; @@ -17,9 +17,9 @@ const BORDER_PADDING: usize = 1; mod font_constants { use super::*; - /// Height of each char raster. The font size is ~0.84% of this. Thus, this is the line height that + /// Height of each char raster. The font size is ~73% of this. Thus, this is the line height that /// enables multiple characters to be side-by-side and appear optically in one line in a natural way. - pub const CHAR_RASTER_HEIGHT: RasterHeight = RasterHeight::Size16; + pub const CHAR_RASTER_HEIGHT: RasterHeight = RasterHeight::Size20; /// The width of each single symbol of the mono space font. pub const CHAR_RASTER_WIDTH: usize = get_raster_width(FontWeight::Regular, CHAR_RASTER_HEIGHT); @@ -112,7 +112,7 @@ impl FrameBufferWriter { /// Prints a rendered char into the framebuffer. /// Updates `self.x_pos`. fn write_rendered_char(&mut self, rendered_char: RasterizedChar) { - for (y, row) in rendered_char.raster().iter().enumerate() { + for (y, row) in rendered_char.rows().enumerate() { for (x, byte) in row.iter().enumerate() { self.write_pixel(self.x_pos + x, self.y_pos + y, *byte); }