Repository navigation
fix(desktop): bake the Classic face on whole pixels at density 1 - #29
Merged
Merged
Conversation
gen-assets.ts snaps W95FA's outlines to the 40-unit half-pixel grid, which is the device pixel grid of the 12.5px slots at rasterDensity 2. At density 1 a device pixel is 80 units. The font's vertical edges sit at 50 + 80k units, so that snap left every one of them in the middle of a device pixel, and a few glyphs are drawn a fraction of a pixel off in y. The bake reported 86% of its ink as partial coverage, and the threshold dropped what covered half a pixel: the comma and the semicolon baked empty, and the quotes, the backtick, the closing parenthesis, the asterisk, the hyphen, the equals sign, the caret and the tilde lost or misplaced pixels. The 12.5px slots at density 1 now bake from a second snap, to the 80-unit grid with the 50-unit phase. Slots 19 and 20 at density 1 change; the density-2 atlases and the 25px slot are byte-identical, and no advance changes at either density. The generator asserts at both densities that the snap aligned and that every mapped glyph but the space has ink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
doodlewind
force-pushed
the
fix/desktop-classic-face-1x
branch
from
October 4, 2026 09:30
0b8bf80 to
0e89d93
Compare
doodlewind
marked this pull request as ready for review
October 4, 2026 10:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
At
rasterDensity1 the Classic theme's 12.5px face drew no comma and no semicolon, and nine other marks lost or misplaced pixels.src/system-ui/gen-assets.tsnow bakes the 12.5px slots at density 1 from outlines snapped to whole device pixels.Cause. The generator snaps W95FA's outlines to a 40-unit grid with a 10-unit x phase. That is the device pixel grid of the 12.5px slots at density 2 (40 units per device pixel). At density 1 a device pixel is 80 units, and the font's vertical edges sit at 50 + 80k units (1768 of the 1790 x coordinates of the ASCII glyphs), so the 40-unit snap left every vertical edge in the middle of a device pixel. A few glyphs are also drawn a fraction of a pixel off in y. The bake logged
slot19 … (AA 86.13%)for density 1, and the hard threshold then dropped whatever covered half a pixel.Fix.
loadSnapped(step, phase)takes the grid. The density-2 bakes and the 25px slot keep(40, 10); the 12.5px slots at density 1 use(80, 50). The generator's alignment assertion (AA ≤ 2%) now runs at both densities, and a new assertion fails the bake when any mapped glyph but the space has no ink.What moves.
w95fa-19.binandw95fa-20.bin(density 1). The other eight atlases are byte-identical (sha256 compared before and after). In the two that change, no glyph's advance or left-bearing shift changes, so text measures and wraps as before; the header's cell width drops by one pixel (12 to 11, and 13 to 12 for the bold slot).Eleven glyphs change their density-1 bitmap:
"')*,-;=^`~. The comma and the semicolon were empty; the others gain the pixels the threshold dropped or move to the nearest whole pixel. Cell rows of slot 19,mainon the left:Why
Pocket Studio runs the System UI in a browser canvas at density 1. Its Classic theme showed "Your games the workbench and your settings open here." in About and "evan Draft" in its lists. The same holds for any density-1 host of this shell, including the browser preview.
Verification
Run in a clean clone of this branch with the pinned PocketJS submodule (
0ca1b362), afterbun run setup.bun shells/desktop/src/system-ui/gen-assets.tsslot19 … (AA 0.00%), was86.13%; density 2 unchangedsrc/system-ui/fonts/*.binbefore and afterw95fa-19.bin,w95fa-20.binbun run checkNew coverage in
test/wrap-op.test.ts, which already loads the generated atlas: every ASCII glyph but the space has ink in slots 19 and 20 at both densities; no coverage sample is partial; each glyph's advance is equal at both densities; the comma and the semicolon draw at density 1. Withgen-assets.tsfrommain, the first and the last of these fail, naming,and;.Looked at in Pocket Studio's laptop (800×600 canvas, density 1, Classic): the commas are back in the list rows and in the About dialog, and the rest of the text is unchanged.
Not run locally, left to CI:
desktop test:rust,desktop build,desktop package:linux,desktop test:web, the site build and its smoke check.🤖 Generated with Claude Code