Repository navigation
[CTX-0237] fix(render): tall-glyph clipping + blur (measured baseline, 10x22 cell) - #413
Merged
Merged
Conversation
…glyph clipping Tall glyphs (block elements, powerline separators, nerd icons) lost their tops because the pen sat on a fixed 3/4-cell baseline inside a 9x19 cell while JetBrainsMono Nerd Font 12pt rasters need advance 10 / line 22 (live crossfont probe: avg_adv=10 line_h=22 descent=-5; full block top=17 h=22 landed at dest_y=-3, 3px clipped). GridRenderer now resolves the baseline from measured face metrics (line+descent, clamped, legacy 3/4 fallback); GlyphRasterizer gains an optional font_metrics hook (crossfont + fallback implement it); defaults move to letter-spacing +2 / line-height 1.375 so the live cell is 10x22 and measured tall glyphs fit with zero overhang. Over-tall outliers keep the permitted overdraw path (no cell clipping, both present paths already clip surface-only). Blur audit: raster size tracks DPI with cache invalidation (NDC ~1.0), integer pen placement, 10px cell matches the 10px raster advance.
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 & why
Tall glyphs (block elements, powerline separators, nerd icons in starship)
lost their tops: the pen sat on a fixed 3/4-cell baseline inside a 9x19 cell
while JetBrainsMono Nerd Font 12pt rasters need advance 10 / line 22.
Live crossfont probe:
avg_adv=10 line_h=22 descent=-5; full blocktop=17 h=22landed atdest_y=-3(3px clipped by neighbor-row repaint).Closes #412.
Priority: P1 | Area: render | Labels: fix,area:render,P1 | Milestone: v0.1.0 | RFC: OQ-xxx | Task: CTX-0237
Changes
bitty-render/src/glyph.rs: newFontMetrics(advance/line/descent,upstream sign) with
is_usablegate;GlyphRasterizer::font_metricsdefault returns
Ok(None)so existing implementors keep compiling.bitty-render/src/crossfont_backend.rs: implementsfont_metricsfromupstream face metrics; rejects bad sizes / stale handles.
bitty-render/src/fallback.rs: forwardsfont_metricsto the primary face.bitty-render/src/cache.rs:rasterizer()borrow for best-effort measurement.bitty-render/src/grid.rs:resolve_baseline_offset(measuredline+descent, clamped into the cell; legacy 3/4 fallback);GridRendererstores
baseline_offset, adopts it innew/apply_dpi_scale, uses it inboth emit paths. Full bitmaps still emit at
baseline - top(overdrawpermitted, never cell-clipped).
bitty-config/src/types.rs: defaultsline_height 1.2 -> 1.375,letter_spacing 1.0 -> 2.0; live effective cell 9x19 -> 10x22 (measuredraster truth; in-font tall glyphs fit with zero overhang).
bitty-app/src/main.rs: scope-adjacent mechanical update only — mapped-celldoc/expectation 9x19 -> 10x22 (no logic change;
RuntimeConfig9x19 headlessdefaults intentionally untouched).
Testing
cargo fmt --all -- --checkcleanRUSTFLAGS="-D warnings" cargo clippy -p bitty-render -p bitty-config -p bitty-app -p bitty-runtime --all-targetsclean (1 pre-existing escaped-newline notice, untouched region)cargo test --workspace --all-targets --locked: 2339 passed, 0 failedcargo check --target x86_64-pc-windows-gnu --workspace --all-targetscleanactionlint -colorclean;act -n(ci.yml) cleanrecording/ctx-0237/probe-output.txt)zero-overhang fit, over-tall overhang permission, DPI re-resolve,
metrics usability gate, default no-measurement, crossfont bad-size rejection
focus-verified seat gestures per phantom-input rule) — commander to verify
tests::demo_pump_opt_in_delivers_greetingflaked 2x during gating(yield-only pump-thread race); known pre-existing flake per PX-1210,
unrelated to this diff; full workspace suite green.
Checklist
per-tile scissor (CTX-0234); diff adds no scissor/clip
recording/ctx-0237/left untracked;temporary probe moved to
.trash/bitty/CTX-0237/)bitty-apptest/doc touch flagged for reviewer (mechanical only)