Skip to content

Bump noto-sans-mono-bitmap to 0.4.0 - #586

Draft
phip1611 wants to merge 5 commits into
rust-osdev:mainfrom
phip1611:bump-noto-sans-mono-bitmap
Draft

phip1611 wants to merge 5 commits into
rust-osdev:mainfrom
phip1611:bump-noto-sans-mono-bitmap

Conversation

@phip1611

@phip1611 phip1611 commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

This PR bumps noto-sans-mono-bitmap to 0.4.0 in common and BIOS stage 3, and makes it a workspace dependency. Version 0.4 renders the mono font the standard way, like terminals and editors: characters are sharper, share a common baseline, and are no longer cut off. As the raster height is now the font's line height, the text uses a 20 px raster without extra line spacing, so it stays about as large as before (14.7 px instead of 14 px font, same characters per line). Stage 3 previously pulled in 0.1 with all 24 font variants. It now compiles only the one it uses, which cuts clean builds by ~25%.

Screenshots

Framebuffer log of the basic_boot test kernel in QEMU. Before: main (0.2, 16 px raster, 2 px extra line spacing). After: this PR.

before (main) after
UEFI, zoomed 2x TODO uefi-before-zoom.png TODO uefi-after-zoom.png
UEFI TODO uefi-before.png TODO uefi-after.png
BIOS (stage 4) TODO bios-before.png TODO bios-after.png

In the zoomed view, the descender of g ("Using") is no longer cut off.

Build time (clean builds)

Measured before the switch to the 20 px raster.

Build before (main) after factor
bootloader crate, end-to-end 24.9 s 18.7 s 0.75x
BIOS stage 3 alone 15.3 s 7.2 s 0.47x
BIOS stage 4 / UEFI alone 9.1 / 10.6 s same 1.00x

Binary size

Artifact before after factor
BIOS stage 3 (flat binary) 118,786 B 102,402 B 0.86x
BIOS stage 4 (flat binary) 152,224 B 136,344 B 0.90x
UEFI bootloader (.efi) 181,760 B 162,816 B 0.90x

Testing

cargo fmt, cargo check, and cargo clippy (as in CI) pass on every commit. cargo test -- --test-threads 1 and the examples/basic build pass on the last commit.

@phip1611
phip1611 marked this pull request as ready for review December 1, 2026 14:54
@Freax13

Freax13 commented Dec 1, 2026

Copy link
Copy Markdown
Member

Oddly enough, even though the sizes didn't change, the new rendered output has a visibly smaller font:

Old:
image

New:
image

I'm not sure what's going on here, but I'd like to find out. I'll have to take another look later.

@Freax13

Freax13 commented Dec 1, 2026

Copy link
Copy Markdown
Member

Nvm, figured I out: The width decreased from 9 to 7. @phip1611 That's expected, right?

@phip1611

phip1611 commented Dec 1, 2026 •

Copy link
Copy Markdown
Member Author

that is expected and comes from the new rendering. The policy I used in the crate is to be able to render every possible char without clipping.

But I see that this might be not the best policy as some rare non standard characters influence force that onto normal characters..

The framebuffer font now renders about 7% larger,

That is btw compared to v0.3, not v0.2.

@phip1611
phip1611 marked this pull request as draft December 1, 2026 21:57
@phip1611

phip1611 commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

To be honest, font rendering is complex and I have no clue. For the v0.4.0 release, I got help from Claude and Opus 5.5. I am pretty confident it does the right thing and that terminals and other software render mono fonts in a similar way.

@phip1611
phip1611 marked this pull request as ready for review December 1, 2026 22:04
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%).
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.
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.
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.
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.
@phip1611
phip1611 force-pushed the bump-noto-sans-mono-bitmap branch from b79789f to fb638fb Compare December 1, 2026 22:19
@phip1611
phip1611 marked this pull request as draft December 1, 2026 22:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants