From c0a25eceb89cfdc146c8ade1f4b6c5d47b958471 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Tue, 1 Dec 2026 23:08:40 +0100 Subject: [PATCH 1/5] common: bump noto-sans-mono-bitmap to 0.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version 0.4 renders the mono font the standard way, like terminal emulators and editors do: the raster height is the font's line height, all characters share a common baseline aligned to the pixel grid, and the outlines are hinted. Characters are sharper and no longer cut off. Version 0.2 used a font size that did not fit into the raster. For example, the dots of 'Ä' were squashed into the top row and the descender of 'g' was cut off. With 0.4, the same 16 px raster holds an 11.75 px font instead of a 14 px one, and characters are 7 instead of 9 px wide. A later commit switches to a larger raster. The crate now stores the glyphs as flat byte blobs instead of per-row slices, which drops the per-row pointers. This shrinks the UEFI bootloader by ~24 KiB (-14%) and BIOS stage 4 by ~21 KiB (-14%). --- Cargo.lock | 6 +++--- Changelog.md | 4 ++++ common/Cargo.toml | 2 +- common/src/framebuffer.rs | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c1a99f4..c4d0be5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,7 +149,7 @@ dependencies = [ "bootloader_api", "conquer-once", "log", - "noto-sans-mono-bitmap 0.2.0", + "noto-sans-mono-bitmap 0.4.0", "rand", "rand_hc", "raw-cpuid", @@ -461,9 +461,9 @@ 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/Changelog.md b/Changelog.md index 3e308d51..6d76c782 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,10 @@ (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. The UEFI + bootloader and BIOS stage 4 are about 14% smaller. # 0.11.17 - 2026-07-27 diff --git a/common/Cargo.toml b/common/Cargo.toml index 6ff3aee0..ac7dfd90 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -23,7 +23,7 @@ uart_16550 = "0.8.0" log = "0.4.17" [dependencies.noto-sans-mono-bitmap] -version = "0.2.0" +version = "0.4.0" default-features = false features = [ "regular", diff --git a/common/src/framebuffer.rs b/common/src/framebuffer.rs index 0c00b511..47da22fa 100644 --- a/common/src/framebuffer.rs +++ b/common/src/framebuffer.rs @@ -17,7 +17,7 @@ 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; @@ -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); } From 71bdf6ac0b7de5f030ee0d3d679825a63e481484 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Tue, 1 Dec 2026 23:08:50 +0100 Subject: [PATCH 2/5] stage-3: bump noto-sans-mono-bitmap from 0.1 to 0.4 Stage 3 still used version 0.1, whose default `all` feature compiles all 24 font variants (3 weights, 8 sizes). This alone took ~7 s on the critical path of every clean build. We now enable only the variant we use, like `common` does. A clean build of the `bootloader` crate drops from ~25 s to ~19 s and the stage 3 binary shrinks by ~28 KiB (-24%). Only one version of the crate remains in the dependency tree. Version 0.4 has no 14 px raster height anymore, so stage 3 now uses 16 px like the rest of the bootloader. The font size stays about the same (12 px before, 11.75 px now). Latin-1 stays enabled to keep the previous character coverage. --- Cargo.lock | 10 ++-------- Changelog.md | 3 +++ bios/stage-3/Cargo.toml | 11 ++++++++++- bios/stage-3/src/screen.rs | 12 +++++++----- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4d0be5d..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.4.0", + "noto-sans-mono-bitmap", "rand", "rand_hc", "raw-cpuid", @@ -453,12 +453,6 @@ dependencies = [ "thiserror", ] -[[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.4.0" diff --git a/Changelog.md b/Changelog.md index 6d76c782..156088c8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,9 @@ the mono font the standard way, like terminals and editors: characters are sharper, share a common baseline, and are no longer cut off. The UEFI bootloader and BIOS stage 4 are about 14% 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 24% smaller. # 0.11.17 - 2026-07-27 diff --git a/bios/stage-3/Cargo.toml b/bios/stage-3/Cargo.toml index 0fe436c6..fd7e5afc 100644 --- a/bios/stage-3/Cargo.toml +++ b/bios/stage-3/Cargo.toml @@ -11,7 +11,16 @@ 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] +version = "0.4.0" +default-features = false +features = [ + "regular", + "size_16", + "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..6ddf6f6b 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::Size16; 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); } From 1ca9a828af7410c59051745df8e04ecab09e9123 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Tue, 1 Dec 2026 14:57:01 +0100 Subject: [PATCH 3/5] deps: make noto-sans-mono-bitmap a workspace dependency Both `common` and BIOS stage 3 use the crate, so a single version in the workspace keeps them in sync and avoids pulling in two versions again. Each crate still selects its own features, as they need different unicode ranges. --- Cargo.toml | 1 + bios/stage-3/Cargo.toml | 3 +-- common/Cargo.toml | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) 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/bios/stage-3/Cargo.toml b/bios/stage-3/Cargo.toml index fd7e5afc..a5fba2d2 100644 --- a/bios/stage-3/Cargo.toml +++ b/bios/stage-3/Cargo.toml @@ -13,8 +13,7 @@ description = "Third BIOS stage of the `bootloader` crate" bootloader-x86_64-bios-common = { workspace = true } [dependencies.noto-sans-mono-bitmap] -version = "0.4.0" -default-features = false +workspace = true features = [ "regular", "size_16", diff --git a/common/Cargo.toml b/common/Cargo.toml index ac7dfd90..1157a42b 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -23,8 +23,7 @@ uart_16550 = "0.8.0" log = "0.4.17" [dependencies.noto-sans-mono-bitmap] -version = "0.4.0" -default-features = false +workspace = true features = [ "regular", "size_16", From 617a4accbecb4f5fcdafd5f73f81f0f9cd99ac8f Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Tue, 1 Dec 2026 23:09:17 +0100 Subject: [PATCH 4/5] common, stage-3: use a 20 px raster height With noto-sans-mono-bitmap 0.4, the raster height is the font's line height, so the font size is ~73% of it. With the 16 px raster, the text became visibly smaller than with 0.2 (an 11.75 px instead of a 14 px font). A 20 px raster holds a 14.7 px font with 9 px wide characters. In `common`, this keeps the number of characters per line from 0.2 and makes the characters slightly larger. Stage 3 uses the same size, so that the text of both stages looks the same. The larger glyphs grow the UEFI bootloader and BIOS stage 4 by ~5.5 KiB and stage 3 by ~12 KiB. All three are still 10-14% smaller than before the bump to 0.4. --- Changelog.md | 8 +++++--- bios/stage-3/Cargo.toml | 2 +- bios/stage-3/src/screen.rs | 2 +- common/Cargo.toml | 2 +- common/src/framebuffer.rs | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 156088c8..6d4b2dab 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,11 +6,13 @@ 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. The UEFI - bootloader and BIOS stage 4 are about 14% smaller. + 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). 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 24% smaller. + `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 a5fba2d2..43e72504 100644 --- a/bios/stage-3/Cargo.toml +++ b/bios/stage-3/Cargo.toml @@ -16,7 +16,7 @@ bootloader-x86_64-bios-common = { workspace = true } workspace = true features = [ "regular", - "size_16", + "size_20", "unicode-basic-latin", "unicode-latin-1-supplement", ] diff --git a/bios/stage-3/src/screen.rs b/bios/stage-3/src/screen.rs index 6ddf6f6b..586b8751 100644 --- a/bios/stage-3/src/screen.rs +++ b/bios/stage-3/src/screen.rs @@ -2,7 +2,7 @@ use bootloader_x86_64_bios_common::{BiosFramebufferInfo, PixelFormat, racy_cell: use core::{fmt, ptr}; use noto_sans_mono_bitmap::{FontWeight, RasterHeight, RasterizedChar, get_raster}; -const RASTER_HEIGHT: RasterHeight = RasterHeight::Size16; +const RASTER_HEIGHT: RasterHeight = RasterHeight::Size20; static WRITER: RacyCell> = RacyCell::new(None); pub struct Writer; diff --git a/common/Cargo.toml b/common/Cargo.toml index 1157a42b..746a2c46 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -26,7 +26,7 @@ log = "0.4.17" 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 47da22fa..5afea334 100644 --- a/common/src/framebuffer.rs +++ b/common/src/framebuffer.rs @@ -19,7 +19,7 @@ mod font_constants { /// 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); From fb638fbfb4b8b1378504db60897fa1dfc0d1e63a Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Tue, 1 Dec 2026 23:09:21 +0100 Subject: [PATCH 5/5] common: remove the extra spacing between framebuffer text lines The raster of noto-sans-mono-bitmap 0.4 already includes the font's line spacing, so the additional 2 px made the text look loose. Lines are now 20 px apart (18 px with 0.2). Stage 3 already uses no extra spacing. --- Changelog.md | 4 ++-- common/src/framebuffer.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 6d4b2dab..61d21ce9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,8 +8,8 @@ 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). The UEFI bootloader and BIOS - stage 4 are about 10% smaller. + 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. diff --git a/common/src/framebuffer.rs b/common/src/framebuffer.rs index 5afea334..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;