Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(glyphgrid): snap geometric far edges to whole texels — geometry-path grout residual to zero
enes56fa9a66638b
diff --git a/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md b/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.mdindex aca8ffa17..000d2e4cc 100644--- a/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md+++ b/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md@@ -160,16 +160,24 @@ Auto after you switched builds, that is why: re-select Shared and carry on.Same weight as before this change (it used to be 25% of the neighbour's *background*), so itis the same bounded, accepted class — a faint tint at extreme zoom-out, never a seam and nevera ghost glyph. Report it only if it reads as more than that.- **Expected residual 0b — a fractional device cell keeps a small dip.** A device cell is- `charWidth * dpr`, so at most dprs one or both axes are FRACTIONAL and the cell's outermost- texel is only partly covered — a genuine ink/background blend that belongs to the cell and- cannot be filled in from outside. The gutter beside it continues the last FULLY covered texel,- which brings the boundary dip down from 62.5 points (flat bg gutter, the reported bug) to- **12.5 points**; sourcing the partial texel instead would have left 37.5. So: a faint reduced- dip may survive on an axis whose device cell extent is fractional, and it should read as a- barely-perceptible softening, NOT as the dark grout lattice above. If a dip is clearly visible- as a dark line, that is the blocking report, not this residual — note the display's dpr and- whether it appears on one axis or both.+ **Expected residual 0b — a fractional device cell, FONT-RENDERED full-bleed glyphs only.**+ A device cell is `charWidth * dpr`, so at most dprs one or both axes are FRACTIONAL and the+ cell's outermost texel is only partly covered — an ink/background blend that belongs to the+ cell and cannot be filled in from outside. Edge-extending the gutter from the last FULLY+ covered texel brought that boundary dip down from 62.5 points (flat bg gutter, the reported+ bug) to 12.5, and the second device round measured what was left: 4–38 points, phase-dependent,+ on the fractional axis.+ **GEOMETRIC box/block art is now seam-FREE — the mascot and the tmux separators included.**+ Since the 2026-08-04 far-edge snapping, a box/block op whose span reaches the cell's far edge+ is grown to the whole texel, so the partial texel is fully inked and the gutter continues real+ ink: the residual on the geometry path is **zero**, at every phase. Anything that still reads+ as grout on block art or on `│` `─` is a **blocking** report, not this residual.+ What remains is the same partial texel under a glyph the FONT drew, where the blend is genuine+ antialiased glyph edge and overwriting it would corrupt real pixels. That is rare in practice+ — everything in U+2500–U+259F that `box-glyphs.ts` has an entry for goes through the geometry+ path — and it takes a full-bleed glyph from outside those tables to see it at all. If you do:+ a barely-perceptible softening on the fractional axis, never a dark line. A visible dark line+ is the blocking report — note the display's dpr and whether it appears on one axis or both.**Expected residual 1 — the LOD clamp.** The sampler is forbidden to go deeper than mip level 2,because that is the deepest level the gutter can keep free of a neighbouring glyph's ink. Pastroughly 25% the filter therefore cannot get any softer, and slight aliasing comes back. That isdiff --git a/src/renderer/glyphgrid/atlas.ts b/src/renderer/glyphgrid/atlas.tsindex 7f927e236..9fb7cd683 100644--- a/src/renderer/glyphgrid/atlas.ts+++ b/src/renderer/glyphgrid/atlas.ts@@ -74,10 +74,15 @@ export interface GlyphRasterizer {* contributes about **6.25%** of the sampled value. Still a tint rather than a ghost glyph, and* it is the honest shape of the residual the LOD clamp accepts.*- * The promise is that no glyph GEOMETRY is ever drawn outside its cell rect, and it holds only- * while raster.ts keeps clipping the ink: ink allowed to overhang into the gutter shortens the- * cell-to-cell separation and invalidates the derivation above. (Copying this slot's own edge- * texels outward does not — a copy of our own content is not a second slot's ink.)+ * The promise is that no glyph GEOMETRY is ever drawn outside its slot's WHOLE-TEXEL cell box —+ * `ceil(cell)`, i.e. the pitch minus these two gutters — and it holds only while raster.ts keeps+ * clipping the ink: ink allowed to overhang into the gutter shortens the cell-to-cell separation+ * and invalidates the derivation above. (Copying this slot's own edge texels outward does not — a+ * copy of our own content is not a second slot's ink.) The BOX rather than the fractional cell+ * since the 2026-08-04 device round: raster.ts snaps a GEOMETRIC glyph's far edges out to the+ * whole texel, so a fractional axis's partial edge texel comes out fully inked instead of+ * half-blended. The separation is the same 2*GUTTER_PX either way — the box is exactly what the+ * pitch was built around.*/export const GUTTER_PX = 2diff --git a/src/renderer/glyphgrid/raster.test.ts b/src/renderer/glyphgrid/raster.test.tsindex b6e845604..1f1f77b0f 100644--- a/src/renderer/glyphgrid/raster.test.ts+++ b/src/renderer/glyphgrid/raster.test.ts@@ -252,43 +252,60 @@ describe('createCanvasRasterizer', () => {expect(Number.isInteger(ink.args[1])).toBe(true)})- // The claim is about GEOMETRY, not about pixels: no glyph may generate NEW ink outside the cell- // rect, because the MAX_SAFE_LOD derivation counts on 2*GUTTER_PX texels between two slots' inks.- // The gutter is not required to be BACKGROUND — the edge-extension strips below copy this slot's- // own border texels into it, and a copy of the slot's own content is not a second slot's ink. So- // this pin filters `fillRect`/`fillText` ops only, and the replication `drawImage`s are checked- // separately for their exact (this-slot-only) source and destination rects.- it('keeps every ink op inside the CELL rect — no glyph draws new geometry into the gutter', () => {+ // The claim is about GEOMETRY, not about pixels: no glyph may generate NEW ink outside the slot's+ // own WHOLE-TEXEL CELL BOX, because the MAX_SAFE_LOD derivation counts on 2*GUTTER_PX texels+ // between two slots' inks. The gutter is not required to be BACKGROUND — the edge-extension+ // strips below copy this slot's own border texels into it, and a copy of the slot's own content+ // is not a second slot's ink. So this pin filters `fillRect`/`fillText` ops only, and the+ // replication `drawImage`s are checked separately for their exact (this-slot-only) rects.+ //+ // RE-SCOPED (2026-08-04, far-edge snapping) from the fractional CELL rect to that box —+ // `max(1, ceil(cell))`, the pitch minus its two gutters. A box/block op whose span REACHES the+ // fractional cell edge is now grown to the whole texel, so on a fractional axis its ink+ // legitimately ends past `cellW`. Nothing the LOD derivation rests on moves: the pitch is+ // `ceil(cell) + 2*GUTTER_PX` by construction, so the box is exactly the pitch minus its gutters+ // and two slots' inks are still 2*GUTTER_PX texels apart. What is still forbidden — and what this+ // pin still catches — is ink IN THE GUTTER, which stays reachable only through step 3's+ // replication of this slot's own texels. The integral case is the old assertion unchanged+ // (ceil is the identity there); the fractional one is what the re-scope buys.+ it.each([+ ['integral 10x20', { cellW: 10, cellH: 20 }],+ ['fractional 10.5x20.5', { cellW: 10.5, cellH: 20.5 }]+ ])('keeps every ink op inside the whole-texel CELL BOX on a %s cell', (_label, sizes) => {const stub = stubCanvas()active = stub- const r = createCanvasRasterizer(FONT, 256)!+ const font = { family: 'monospace', sizePx: 16, ...sizes }+ const colsW = Math.max(1, Math.ceil(sizes.cellW))+ const colsH = Math.max(1, Math.ceil(sizes.cellH))+ const ink0 = 40+ const r = createCanvasRasterizer(font, 256)!stub.ops.length = 0- r.draw(0x2588, false, false, INK_X, INK_Y, FG, BG) // █ — the glyph that fills the whole cell+ r.draw(0x2588, false, false, ink0, ink0, FG, BG) // █ — the glyph that fills the whole cellconst ink = stub.ops.filter((o) => o.kind === 'fillRect' && o.fill === FG_CSS)expect(ink.length).toBeGreaterThan(0)for (const op of ink) {const [x, y, w, h] = op.args- expect(x).toBeGreaterThanOrEqual(INK_X)- expect(y).toBeGreaterThanOrEqual(INK_Y)- expect(x + w).toBeLessThanOrEqual(INK_X + FONT.cellW)- expect(y + h).toBeLessThanOrEqual(INK_Y + FONT.cellH)+ expect(x).toBeGreaterThanOrEqual(ink0)+ expect(y).toBeGreaterThanOrEqual(ink0)+ expect(x + w).toBeLessThanOrEqual(ink0 + colsW)+ expect(y + h).toBeLessThanOrEqual(ink0 + colsH)}- // And the only fill that is allowed outside the cell is the background one, which is exactly- // the pitch rect.+ // And the only fill that is allowed outside the cell box is the background one, which is+ // exactly the pitch rect.const outside = stub.ops.filter((o) =>o.kind === 'fillRect' &&- (o.args[0] < INK_X ||- o.args[1] < INK_Y ||- o.args[0] + o.args[2] > INK_X + FONT.cellW ||- o.args[1] + o.args[3] > INK_Y + FONT.cellH)+ (o.args[0] < ink0 ||+ o.args[1] < ink0 ||+ o.args[0] + o.args[2] > ink0 + colsW ||+ o.args[1] + o.args[3] > ink0 + colsH))expect(outside).toEqual([{kind: 'fillRect',fill: BG_CSS,- args: [INK_X - GUTTER_PX, INK_Y - GUTTER_PX, PITCH_W, PITCH_H]+ args: [ink0 - GUTTER_PX, ink0 - GUTTER_PX, colsW + 2 * GUTTER_PX, colsH + 2 * GUTTER_PX]}])})@@ -579,4 +596,168 @@ describe('createCanvasRasterizer', () => {expect(new Set(covered)).toEqual(new Set(frame))})})++ /**+ * GEOMETRIC FAR-EDGE SNAPPING (device round, 2026-08-04, second screenshot). Edge-extended+ * gutters removed most of the grout, but a phase-dependent residual dip survived on a FRACTIONAL+ * axis: the cell's outermost texel is only partly covered, so a full-bleed geometric glyph left it+ * as a half ink / half background blend that no gutter content can cancel. In the COMPOSED frame+ * the other half of that boundary pixel is the NEIGHBOUR cell's ink, so full ink is the correct+ * colour there — xterm never meets this because its atlas cells are integral device px.+ *+ * So a box/block op whose span REACHES the far cell edge has that edge snapped outward to the+ * whole-texel cell box. Two things the tests below have to keep honest: only edges that actually+ * reach the boundary move (an interior edge — a half block's midline, a dash's tail — must not),+ * and only the GEOMETRY branch is affected (a font glyph's partial far column is genuine+ * antialiased content).+ */+ describe('geometric far-edge snapping', () => {+ /** A fractional cell on BOTH axes: 10.5 x 20.5, whole-texel box 11 x 21. */+ const FRAC = { family: 'monospace', sizePx: 16, cellW: 10.5, cellH: 20.5 }+ const FRAC_COLS_W = 11+ const FRAC_COLS_H = 21+ /** A whole-texel ink origin, as `GlyphAtlas.cellXY` always hands over. */+ const IX = 40++ /** The ink ops in CELL-LOCAL coordinates — i.e. exactly what the box branch filled. */+ const inkRects = (ops: Op[], ink = IX): number[][] =>+ ops+ .filter((o) => o.kind === 'fillRect' && o.fill === FG_CSS)+ .map((o) => [o.args[0] - ink, o.args[1] - ink, o.args[2], o.args[3]])++ const drawFrac = (code: number, font = FRAC): ReturnType<typeof stubCanvas> => {+ const stub = stubCanvas()+ active = stub+ const r = createCanvasRasterizer(font, 256)!+ stub.ops.length = 0+ r.draw(code, false, false, IX, IX, FG, BG)+ return stub+ }++ it('grows a FULL-BLEED block to the whole-texel cell box on a fractional cell', () => {+ const stub = drawFrac(0x2588) // █+ // 10.5 x 20.5 of ink would leave the outermost texel on each axis half covered; 11 x 21 fills+ // it. The op still STARTS at 0 — the near edges need no snap, see the dedicated pin below.+ expect(inkRects(stub.ops)).toEqual([[0, 0, FRAC_COLS_W, FRAC_COLS_H]])+ })++ it('snaps ONLY the far edge of a right-half block — its interior midline does not move', () => {+ const stub = drawFrac(0x2590) // ▐ right half+ // The midline is `round(4/8 * 10.5)` = 5, a genuine INTERIOR edge sitting ~half a cell from+ // the boundary; the right edge reaches 10.5 and becomes the whole texel 11, i.e. w = 11 - 5.+ expect(inkRects(stub.ops)).toEqual([[5, 0, FRAC_COLS_W - 5, FRAC_COLS_H]])+ })++ it('snaps the right end of a horizontal rule, leaving its thickness alone', () => {+ const stub = drawFrac(0x2500) // ─+ // The rule spans the cell horizontally (→ snapped) and is one device px thick, centred: its+ // bottom edge is nowhere near the cell's, so the vertical axis is untouched.+ expect(inkRects(stub.ops)).toEqual([[0, 10, FRAC_COLS_W, 1]])+ })++ it('leaves a non-edge-reaching span alone — the two axes are decided independently', () => {+ const stub = drawFrac(0x2502) // │+ const [x, y, w, h] = inkRects(stub.ops)[0]+ // The stem sits at the cell's midline: 1 device px wide, five texels short of the far edge.+ // Untouched, both position and width.+ expect([x, w]).toEqual([5, 1])+ // Its own far edge — the BOTTOM — does reach, and snaps. Nothing about the horizontal axis+ // follows from that.+ expect([y, h]).toEqual([0, FRAC_COLS_H])+ })++ it('does not capture a dashed rule whose last dash merely ends NEAR the far edge', () => {+ const stub = drawFrac(0x2508) // ┈ — four dashes, deliberately NOT tiling+ // The guard on the epsilon. On a 10.5-wide cell the last dash rounds to a right edge of 10,+ // exactly HALF A PIXEL short of the boundary — so the "obvious" `>= cellW - 0.5` tolerance+ // would weld it to the next cell's first dash and quietly turn ┈ into ─. The gap IS the+ // character, so the tolerance has to be tight enough to leave it.+ expect(inkRects(stub.ops)).toEqual([+ [0, 10, 2, 1],+ [3, 10, 1, 1],+ [5, 10, 2, 1],+ [8, 10, 2, 1]+ ])+ })++ it('needs no near-edge snap — an op that starts at the cell edge already starts on a texel', () => {+ const stub = drawFrac(0x2588)+ // The ink ORIGIN is a whole texel (`GlyphAtlas.cellXY` derives it from the whole-texel pitch),+ // and `span`'s `snap` returns a literal 0 for anything at or before the near edge. So the near+ // edges are flush with a texel boundary by construction and there is nothing to round out.+ for (const [x, y] of inkRects(stub.ops)) {+ expect(x).toBe(0)+ expect(y).toBe(0)+ }+ expect(Number.isInteger(IX)).toBe(true)+ })++ it('clips the GEOMETRY branch to the whole-texel box and the FONT branch to the fractional cell', () => {+ // Geometry: the clip has to admit the snap, or the widened rects are simply cut back.+ const geo = drawFrac(0x2588)+ expect(geo.ops.find((o) => o.kind === 'clip')).toEqual({+ kind: 'clip',+ args: [IX, IX, FRAC_COLS_W, FRAC_COLS_H]+ })+ active?.restore()+ active = null+ // Font: unchanged, and deliberately so. A glyph's partial far column carries genuine+ // antialiased glyph edge — real content, drawn by the platform rasterizer — and overwriting+ // or extending it would corrupt pixels rather than complete a shape we generated ourselves.+ const font = drawFrac(0x41) // 'A'+ expect(font.ops.find((o) => o.kind === 'clip')).toEqual({+ kind: 'clip',+ args: [IX, IX, FRAC.cellW, FRAC.cellH]+ })+ expect(font.ops.some((o) => o.kind === 'fillText')).toBe(true)+ })++ /**+ * The PIXEL half of the claim, and why it is measured at .25 rather than at the brief's .5.+ *+ * The stub's pixel model is hard-edged and assigns a texel by its CENTRE (`Math.round`), so on a+ * `.5`-fractional cell it already reports the half-covered edge texel as fully inked — the model+ * cannot distinguish before from after there, which is precisely the kind of "green either way"+ * assertion that pins nothing. At `.25` the centre of that texel falls OUTSIDE the fractional+ * cell, so the model leaves it as background until the snap fills it. The `.5` case is pinned+ * exactly, on op GEOMETRY, by the first test in this block.+ */+ it('fills the partial far texel on a fractional cell, and the gutter beyond continues it', () => {+ const stub = stubCanvas()+ active = stub+ // 10.25 x 20.25: whole-texel box 11 x 21, last FULLY covered texel 9 / 19.+ const r = createCanvasRasterizer({ family: 'monospace', sizePx: 16, cellW: 10.25, cellH: 20.25 }, 256)!+ r.draw(0x2588, false, false, IX, IX, FG, BG) // █++ // The partial far column and row — texel 10 / 20 — now carry FULL ink rather than a blend+ // fading to background.+ expect(stub.pixelAt(IX + 10, IX + 5)).toBe(FG_CSS)+ expect(stub.pixelAt(IX + 5, IX + 20)).toBe(FG_CSS)+ // Including the corner where the two meet.+ expect(stub.pixelAt(IX + 10, IX + 20)).toBe(FG_CSS)+ // And the gutter past the box continues it, so a minified sample at the boundary keeps+ // averaging ink with ink all the way out to the pitch edge.+ for (let g = 0; g < GUTTER_PX; g++) {+ expect(stub.pixelAt(IX + 11 + g, IX + 5)).toBe(FG_CSS)+ expect(stub.pixelAt(IX + 5, IX + 21 + g)).toBe(FG_CSS)+ }+ })++ it('leaves the STIPPLE shades a stipple — a far-edge dot grows by a partial texel at most', () => {+ const stub = drawFrac(0x2592) // ▒ — a dither pattern, not a tint+ const rects = inkRects(stub.ops)+ // Still a scatter of pattern-sized runs rather than one grown slab: the snap only ever moves+ // a run's OWN far edge out to the whole texel, so a dot that happens to sit against the cell+ // edge gains half a texel (1 → 1.5 here) and every other dot is untouched. Half a texel of a+ // dither dot reads as ~50% tone either way, which is why the shades need no special case.+ expect(rects.length).toBeGreaterThan(10)+ for (const [, , w, h] of rects) {+ expect(w).toBeLessThanOrEqual(1.5)+ expect(h).toBeLessThanOrEqual(1.5)+ }+ // And the tone is still a tone: ▒ is a 2-of-8 pattern, nowhere near a filled cell.+ const inked = rects.reduce((sum, [, , w, h]) => sum + w * h, 0)+ expect(inked).toBeLessThan(0.4 * FRAC_COLS_W * FRAC_COLS_H)+ })+ })})diff --git a/src/renderer/glyphgrid/raster.ts b/src/renderer/glyphgrid/raster.tsindex a935dbb30..7c9dd4a61 100644--- a/src/renderer/glyphgrid/raster.ts+++ b/src/renderer/glyphgrid/raster.ts@@ -35,6 +35,26 @@ function cssColor(packed: number): string {return `rgb(${r},${g},${b})`}+/**+ * How close a geometric op's far edge has to come to the cell's far edge to count as REACHING it —+ * see step 2 of `draw` for what reaching one earns.+ *+ * Deliberately tiny, and the tightness is the point. `box-glyphs.ts` emits the two classes of edge+ * with a real gap between them: `span`/`snap` return the extent VERBATIM for anything at or past+ * the boundary (that is the full-cell invariant), and a whole device pixel for everything else. So+ * the epsilon has nothing to bridge — it only absorbs the float noise of reconstructing+ * `op.x + op.w` from the `[start, extent]` pair `span` handed back.+ *+ * A LOOSE tolerance is not the conservative direction, which is easy to get backwards. The obvious+ * `cellW - 0.5` would also capture genuinely INTERIOR edges that happen to land half a pixel short:+ * on a 10.5-wide cell the last dash of ┈ (U+2508) rounds to a right edge of exactly 10, and+ * snapping THAT welds it to the next cell's first dash — turning a rule whose gaps are the whole+ * character into a solid ─. The edges nobody could confuse either way (a half block's midline at+ * ~cell/2, an arm's own thickness) are orders of magnitude further out than either number; the+ * cases that decide the constant are the near misses, and they want it small.+ */+const FAR_EDGE_EPS = 1e-6+/*** Where the alphabetic baseline sits inside the cell, in device px.*@@ -136,12 +156,18 @@ function baselineIn(ctx: OffscreenCanvasRenderingContext2D, font: RasterFont): n* there would bleed into slot 1's minified texels.* 2. A slot's whole pitch rect is REPAINTED with its background before it is inked, so reusing a* cell after a reset can never leave a previous glyph's ink or a previous background behind.- * 3. NO GLYPH DRAWS NEW GEOMETRY INTO THE GUTTER. Every glyph is clipped to the CELL rect — one- * gutter inside the pitch rect on each axis — so two slots' inks stay 2*GUTTER_PX texels apart,- * which is exactly the separation `MAX_SAFE_LOD = 2` is derived from (see GUTTER_PX in- * atlas.ts). A glyph wider than the cell (a CJK cell, an overhanging italic) is CUT, not- * allowed to overhang: a soft edge is a cosmetic loss on one glyph, a ghost glyph in a- * neighbour's mip is a rendering bug.+ * 3. NO GLYPH DRAWS NEW GEOMETRY INTO THE GUTTER. Every glyph is clipped to this slot's own CELL+ * BOX — one gutter inside the pitch rect on each axis — so two slots' inks stay 2*GUTTER_PX+ * texels apart, which is exactly the separation `MAX_SAFE_LOD = 2` is derived from (see+ * GUTTER_PX in atlas.ts). A glyph wider than the cell (a CJK cell, an overhanging italic) is+ * CUT, not allowed to overhang: a soft edge is a cosmetic loss on one glyph, a ghost glyph in+ * a neighbour's mip is a rendering bug.+ *+ * "Cell box" rather than "cell rect" since the 2026-08-04 device round: the FONT path is+ * clipped to the fractional cell exactly as before, while the GEOMETRY path is clipped to the+ * WHOLE-TEXEL box (`ceil(cell)`) because its far edges snap out to it — see step 2 in `draw`.+ * The separation is unchanged either way: the pitch IS the whole-texel box plus two gutters, so+ * the widened clip stops exactly where the gutter starts.** What the gutter then HOLDS is a separate question, and the answer changed in the 2026-08-04* device round: it carries this slot's OWN EDGE-EXTENDED CONTENT — background wherever the ink@@ -223,17 +249,23 @@ export function createCanvasRasterizer(// of it that sit against ink with that ink, and leaves the rest exactly as filled here.ctx.fillStyle = cssColor(bg)ctx.fillRect(x - GUTTER_PX, y - GUTTER_PX, pitchW, pitchH)- // 2. THE INK, clipped to the CELL rect — never the pitch rect. The cell always fits inside- // the pitch (the pitch rounds the cell UP and adds a gutter on each side), so no glyph can+ // 2. THE INK, clipped to THIS SLOT'S OWN CELL BOX — never the pitch rect. The box always fits+ // inside the pitch (the pitch is the box plus a gutter on each side), so no glyph can// generate geometry closer than GUTTER_PX to the next slot, which is the separation- // MAX_SAFE_LOD = 2 is derived from. A glyph that overflows the cell is CUT here. (Step 3- // may then COPY this ink outward into our own gutter — a copy of our own content, never a+ // MAX_SAFE_LOD = 2 is derived from. A glyph that overflows it is CUT here. (Step 3 may+ // then COPY this ink outward into our own gutter — a copy of our own content, never a// reason to relax this clip.)- ctx.save()- ctx.beginPath()- ctx.rect(x, y, font.cellW, font.cellH)- ctx.clip()- ctx.fillStyle = cssColor(fg)+ //+ // WHICH box, though, is decided PER BRANCH, and the two must not be merged into one+ // widened clip:+ // - GEOMETRY gets the WHOLE-TEXEL box (`colsW`/`colsH`), because its far edges snap out+ // to it (see below) and a fractional clip would simply cut the snap back off.+ // - the FONT keeps the FRACTIONAL cell. A glyph's partial far column is genuine+ // antialiased glyph edge drawn by the platform rasterizer — real content — and letting+ // it spill into the extra texel would be overwriting pixels rather than completing a+ // shape we generated ourselves.+ // Both are inside the pitch, so the LOD derivation is untouched either way.+ //// Geometry first: these ranges are DEFINED as fractions of the cell, so drawing them is// both more correct and cheaper than trusting the face. The ops are already snapped to// device px (interior edges) and to the exact cell bounds (outer edges), so no seam can@@ -243,8 +275,48 @@ export function createCanvasRasterizer(// reads as foreground PIXELS over the background fill, which is exactly what xterm's own// patterns are.const geometry = boxGlyphOps(code, font.cellW, font.cellH)+ ctx.save()+ ctx.beginPath()+ ctx.rect(x, y, geometry ? colsW : font.cellW, geometry ? colsH : font.cellH)+ ctx.clip()+ ctx.fillStyle = cssColor(fg)if (geometry) {- for (const op of geometry) ctx.fillRect(x + op.x, y + op.y, op.w, op.h)+ for (const op of geometry) {+ // FAR-EDGE SNAPPING (device round, 2026-08-04, second mascot screenshot). An op whose+ // span REACHES the cell's far edge has that edge grown to the whole texel; every other+ // edge is left exactly where box-glyphs.ts put it.+ //+ // WHY. A device cell is `charWidth * dpr` and fractional in general, so the cell's+ // outermost texel is only PARTLY covered and a full-bleed geometric glyph leaves it as an+ // ink/background blend (0.5 ink on a .5 axis). Step 3 can continue whatever is beside it+ // but can never fix the texel itself — it belongs to the cell — which is the residual the+ // edge-extension comments predicted and the device round then measured: dips of 4–38+ // points surviving on the fractional axis after the gutters were extended.+ //+ // It is not merely paperable, it is WRONG. In the COMPOSED frame the other half of that+ // boundary pixel is the NEIGHBOUR CELL'S ink, so the correct colour there is FULL ink;+ // today's half-blend is the wrong answer even at zoom 1, at the phases where a fragment+ // lands on it. xterm never meets any of this because its atlas cells are integral device+ // px — the whole-texel box is the closest thing this atlas has to that, so a glyph that+ // is DEFINED as filling its cell is drawn as filling the box. Step 3's replication then+ // continues real ink into the gutter and the geometry path's residual goes to zero.+ //+ // FONT-rendered glyphs are excluded on purpose (see the clip above), so the residual+ // survives for full-bleed glyphs drawn by the face — rare, since the block and+ // box-drawing ranges come through here whenever box-glyphs.ts has an entry for them.+ //+ // The STIPPLES (░▒▓) need no special case: a dither run that happens to end on the cell+ // edge grows by the same partial texel, which reads as ~50% tone either way at the sizes+ // a shade block is ever looked at.+ //+ // NEAR edges need nothing at all. `span`'s `snap` returns a literal 0 for anything at or+ // before the near edge, and the ink origin is a whole texel (`GlyphAtlas.cellXY` derives+ // it from the whole-texel pitch) — so a near edge is already flush with a texel boundary+ // and there is no partial texel to complete.+ const w = op.x + op.w >= font.cellW - FAR_EDGE_EPS ? colsW - op.x : op.w+ const h = op.y + op.h >= font.cellH - FAR_EDGE_EPS ? colsH - op.y : op.h+ ctx.fillRect(x + op.x, y + op.y, w, h)+ }} else {ctx.font = `${italic ? 'italic ' : ''}${bold ? 'bold ' : ''}${font.sizePx}px ${font.family}`ctx.fillText(String.fromCodePoint(code), x, y + baseline)