Skip to content

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.

fix(glyphgrid): close the double-corner elbow, and shades that are dither, not wash

enes254b70a5be94
diff --git a/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md b/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md
index fbfdedc3f..590864013 100644
--- a/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md
+++ b/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md
@@ -62,7 +62,10 @@ Auto after you switched builds, that is why: re-select Shared and carry on.
and tees join their arms with no notch; **block elements tile exactly** — `▀`/`▄` and
`▌`/`▐` meet on a shared edge with no dark seam and no overlap, the eighth blocks step
evenly, and the mascot is the right shape with no dark artifacts; the shade ramp `░▒▓` reads
- as three distinct densities. Known v1 approximations, not defects: **rounded corners
+ as three distinct densities. **Look at `░▒▓` up close**: they must be DITHER patterns (a
+ visible stipple of single device pixels, transcribed from xterm's own pattern table), not
+ smooth tints — a flat wash means the geometry path regressed to an alpha fill and will not
+ match the renderer beside it. Known v1 approximations, not defects: **rounded corners
`╭╮╯╰` render SQUARE**, the diagonals `╱╲╳` still come from the font, and the double-line
tees `╠╣╦╩` keep the crossing rail continuous where the printed glyph breaks it.
The round-3 report's "blockier / heavier than GPU mode" should be GONE for line and block art.
@@ -149,6 +152,17 @@ Auto after you switched builds, that is why: re-select Shared and carry on.
and its text stays under the upper node's plate. The failure this replaced is the one to watch
for — the upper node's crisp chrome with the LOWER node's text legible through its body.
Bring a node to the front the ordinary way (drag it / re-create it) rather than by selecting.
+ Also check the flip itself: with a terminal SELECTED, toggle Shared on and then off. The
+ selection is cleared on each transition (deliberate — React Flow only recomputes z on a nodes
+ change, so the prop flip alone would leave that node stuck at z 1000), and no node is left
+ floating above the others afterwards.
+- [ ] **3.9c Node-attached UI that escapes the node box (round 4).** On an overlapping canvas, open
+ the 💬 comments flyout on a terminal that another terminal overlaps, and look at a session
+ node carrying a kanban column half-pill. Both are positioned OUTSIDE their node's rect, and
+ with the elevation off they are no longer lifted above nodes later in the array — so either
+ may be partly covered by a neighbouring terminal, and selecting the node will not fix it.
+ That is the known trade (L15). Judge how often it actually bites: report the overlap depth at
+ which the flyout becomes unusable, if it does.
- [ ] **3.9b Overlap, contents vs frame (round 4).** With two terminals overlapping, look at the
covered region closely. Expected: the upper node's CONTENTS occlude the lower one's
completely — no text, no cursor, no selection band from the lower node is readable through
@@ -345,7 +359,15 @@ Auto after you switched builds, that is why: re-select Shared and carry on.
ordering because canvas can never paint over DOM. The two real fixes are Phase 2 questions: draw
the node frame into the shared canvas too, or give the plate the node's full chrome geometry.
Side effect to be aware of: **clicking a covered terminal no longer brings it to the front** in
- shared mode (checklist 3.9) — selection is no longer a stacking input there.
+ shared mode (checklist 3.9) — selection is no longer a stacking input there. That reaches
+ node-attached UI that deliberately ESCAPES the node box, too: the 💬 comments flyout
+ (`.term-node__comments`, a sibling of the overflow:hidden root) and the kanban column half-pill
+ (`ColumnPill`, likewise a sibling) are positioned outside their node's rect, and with the
+ elevation off they are no longer lifted above nodes that sit LATER in the array — so on an
+ overlapping canvas a flyout or a pill can be partly covered by a neighbouring terminal, and
+ selecting its node no longer fixes it. Both are transient, node-attached surfaces rather than
+ content, which is why this ships; the Phase-2 fix is the one L15 already needs (make chrome and
+ canvas agree for real, instead of turning one of the two orderings off).
---
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 505c194ff..abbc92f7b 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -4980,6 +4980,22 @@ export function Canvas() {
setNodeZOrder(idsFromOrderSig(glyphOrderSig))
}, [glyphOrderSig])
+ // Flipping the mode changes `elevateNodesOnSelect`, but React Flow computes a node's z only in
+ // `adoptUserNodes` — which runs on a NODES change, not on a prop change. So a node that happens
+ // to be selected at the moment of the flip keeps the z 1000 it was given under the old prop, and
+ // stays wrongly on top (in the DOM only) until something else touches the nodes array. Clearing
+ // the selection is the minimal correct nudge: it is a real nodes change, so every node is
+ // re-adopted under the new rule, and it costs the user nothing (selection is not a stacking input
+ // in shared mode anyway — see L15). Change-gated on both the transition and on anything actually
+ // being selected, and skipped on mount so a project load's restored selection survives.
+ const prevGlyphActiveRef = useRef<boolean | null>(null)
+ useEffect(() => {
+ const prev = prevGlyphActiveRef.current
+ prevGlyphActiveRef.current = glyphLayerActive
+ if (prev === null || prev === glyphLayerActive) return
+ setNodes((ns) => (ns.some((n) => n.selected) ? ns.map((n) => ({ ...n, selected: false })) : ns))
+ }, [glyphLayerActive, setNodes])
+
const zoomRafRef = useRef<number | null>(null)
const gestureSettleRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const onMove = useCallback(
@@ -7502,7 +7518,10 @@ export function Canvas() {
// Mirroring the elevation in `nodeOrderSig` (what round 3 did) cannot fix it, because
// canvas text can never paint over DOM chrome; only agreeing on array order can.
// Dynamic, and false ONLY while shared is active: the default renderer modes have opaque
- // bodies and keep React Flow's normal selection behavior, untouched.
+ // bodies and keep React Flow's normal selection behavior, untouched. Flipping this prop
+ // is NOT enough on its own — React Flow assigns z in `adoptUserNodes`, which runs on a
+ // nodes change — so the effect above clears the selection on the transition to force a
+ // re-adopt; without it a node selected at the moment of the flip keeps z 1000.
elevateNodesOnSelect={!glyphLayerActive}
>
<Background
diff --git a/src/renderer/glyphgrid/box-glyphs.test.ts b/src/renderer/glyphgrid/box-glyphs.test.ts
index 14ddef482..ce67c1ec7 100644
--- a/src/renderer/glyphgrid/box-glyphs.test.ts
+++ b/src/renderer/glyphgrid/box-glyphs.test.ts
@@ -107,6 +107,32 @@ describe('box drawing — the full-cell invariant', () => {
}
}
})
+
+ it('no op ever leaves the cell, at any cell size — growing a thin rect grows it INWARD', () => {
+ // `▕` (right one eighth) on a 7.83px cell snaps to x=7 with 0.83px of room; forcing w=1 used to
+ // put the right edge at 8. Harmless (the rasterizer clips) but an invariant that survives only
+ // because someone else catches it is not one.
+ const sizes: [number, number][] = [
+ [5.3, 9],
+ [7.83, 17.6], // the reported case
+ [10, 20],
+ [13.4, 29.7],
+ [17, 34],
+ [25.5, 51]
+ ]
+ for (const [cw, ch] of sizes) {
+ for (let code = 0x2500; code <= 0x259f; code++) {
+ const list = boxGlyphOps(code, cw, ch)
+ if (!list) continue
+ for (const o of list) {
+ expect(o.x).toBeGreaterThanOrEqual(0)
+ expect(o.y).toBeGreaterThanOrEqual(0)
+ expect(o.x + o.w).toBeLessThanOrEqual(cw)
+ expect(o.y + o.h).toBeLessThanOrEqual(ch)
+ }
+ }
+ }
+ })
})
describe('box drawing — arms', () => {
@@ -237,6 +263,53 @@ describe('box drawing — doubles and dashes', () => {
expect(list.some((o) => o.y === 0 && o.h > 4)).toBe(false)
})
+ it('the four double corners have SOLID elbows — no hole where two rails meet', () => {
+ // The round-4 review reproduced a hole at the OUTER elbow of every ╔╗╚╝ at every cell size: a
+ // rail stopped at the perpendicular rail's centre LINE, so it covered only half of the rail it
+ // was supposed to corner with, and a `light × light` square of the elbow was covered by
+ // neither. Note this is NOT caught by asking whether the two rails intersect — they do, just
+ // not over the whole elbow.
+ //
+ // The elbow square is derived from the EMITTED rects (the vertical rail gives its x range, the
+ // horizontal rail its y range) rather than predicted from the cell size, so the check is exact
+ // at any snapping.
+ const corners: [string, -1 | 1, -1 | 1][] = [
+ // [glyph, direction the horizontal arms point, direction the vertical arms point]
+ ['╔', 1, 1],
+ ['╗', -1, 1],
+ ['╚', 1, -1],
+ ['╝', -1, -1]
+ ]
+ for (const [cw, ch] of [
+ [32, 64], // light = 4: a half-rail miss is several px wide
+ [16, 32], // light = 2
+ [10, 20] // light = 1: the smallest representable miss
+ ] as const) {
+ for (const [glyph, hx, vy] of corners) {
+ const list = ops(glyph, cw, ch)
+ expect(list).toHaveLength(4)
+ const set = covered(list, cw, ch)
+ const horizontals = list.filter((o) => o.w > o.h).sort((a, b) => a.y - b.y)
+ const verticals = list.filter((o) => o.h > o.w).sort((a, b) => a.x - b.x)
+ expect(horizontals).toHaveLength(2)
+ expect(verticals).toHaveLength(2)
+ // The OUTER rail of a pair is the one on the far side from where the arms point.
+ const [outerH, innerH] = vy === 1 ? horizontals : [...horizontals].reverse()
+ const [outerV, innerV] = hx === 1 ? verticals : [...verticals].reverse()
+ for (const [h, v, which] of [
+ [outerH, outerV, 'outer'],
+ [innerH, innerV, 'inner']
+ ] as const) {
+ for (let x = Math.floor(v.x); x < Math.ceil(v.x + v.w); x++) {
+ for (let y = Math.floor(h.y); y < Math.ceil(h.y + h.h); y++) {
+ expect(set.has(`${x},${y}`), `${glyph} ${which} elbow (${x},${y}) at ${cw}x${ch}`).toBe(true)
+ }
+ }
+ }
+ }
+ }
+ })
+
it('╬ crosses as four rails with an OPEN centre', () => {
const list = ops('╬', 32, 64)
expect(list).toHaveLength(4)
@@ -305,22 +378,38 @@ describe('block elements', () => {
expect(three.size).toBe(ur.size + ll.size + lr.size)
})
- it('the shades are full-cell ALPHA fills, strictly increasing ░ < ▒ < ▓', () => {
- const light = ops('░')
- const medium = ops('▒')
- const dark = ops('▓')
- for (const l of [light, medium, dark]) {
- expect(l).toHaveLength(1)
- expect(l[0]).toMatchObject({ x: 0, y: 0, w: W, h: H })
+ it('the shades are STIPPLES, not flat fills — many 1px rows, none covering the cell', () => {
+ // The parity point: xterm draws ░▒▓ from a device-pixel dither table in BOTH its renderers, so
+ // a single full-cell rect (at any alpha) is instantly distinguishable in a side-by-side.
+ for (const ch of ['░', '▒', '▓']) {
+ const list = ops(ch, 16, 32)
+ expect(list.length).toBeGreaterThan(8)
+ for (const o of list) {
+ expect(o.h).toBe(1) // one device-pixel row per op
+ expect(o.w).toBeLessThan(16) // never spans the cell
+ }
}
- expect(light[0].alpha!).toBeLessThan(medium[0].alpha!)
- expect(medium[0].alpha!).toBeLessThan(dark[0].alpha!)
- expect(dark[0].alpha!).toBeLessThan(1)
})
- it('only the shades carry an alpha — everything else is opaque ink', () => {
- for (const ch of ['─', '┼', '█', '▀', '╬']) {
- for (const o of ops(ch)) expect(o.alpha).toBeUndefined()
- }
+ it('shade DENSITY is strictly increasing ░ < ▒ < ▓, and none of them is solid', () => {
+ const density = (ch: string): number => covered(ops(ch, 16, 32), 16, 32).size / (16 * 32)
+ const light = density('░')
+ const medium = density('▒')
+ const dark = density('▓')
+ expect(light).toBeGreaterThan(0)
+ expect(light).toBeLessThan(medium)
+ expect(medium).toBeLessThan(dark)
+ expect(dark).toBeLessThan(1)
+ })
+
+ it('the stipple is pinned to DEVICE pixels — a bigger cell gets more dots, not bigger ones', () => {
+ // This is what makes it a dither rather than a texture: the pattern must not scale with the
+ // cell, or a large cell would show a chunky checkerboard instead of a tint.
+ const small = ops('▓', 16, 32)
+ const large = ops('▓', 32, 64)
+ for (const o of [...small, ...large]) expect(o.h).toBe(1)
+ expect(large.length).toBeGreaterThan(small.length)
+ const d = (l: PaintOp[], w: number, h: number): number => covered(l, w, h).size / (w * h)
+ expect(d(large, 32, 64)).toBeCloseTo(d(small, 16, 32), 2)
})
})
diff --git a/src/renderer/glyphgrid/box-glyphs.ts b/src/renderer/glyphgrid/box-glyphs.ts
index 4346e1f34..a9c87e035 100644
--- a/src/renderer/glyphgrid/box-glyphs.ts
+++ b/src/renderer/glyphgrid/box-glyphs.ts
@@ -35,22 +35,29 @@
* `null`, so `fillText` draws them as before. They do not tile, so the gap problem does not
* apply to them.
* - **Double-line junctions are drawn as rails, not as nested corners.** A double arm is two
- * parallel light rails; where two double arms meet, each rail stops at the near or the far
- * perpendicular rail (see `pushDoubleArm`). This is exact for the corners (╔╗╚╝) and the plain
- * crossings, and slightly over-draws the tees (╠╣╦╩ keep the crossing rail continuous where the
- * real glyph breaks it). Every case connects edge-to-edge, which is the property that matters.
+ * parallel light rails; where two double arms meet, each rail stops at the EDGE of the near or
+ * the far perpendicular rail (see `pushDoubleArm` — stopping at the rail's centre line is what
+ * left a 1px hole in every ╔╗╚╝ elbow in the first cut of this module). This is exact for the
+ * corners and the plain crossings, and slightly over-draws the tees (╠╣╦╩ keep the crossing rail
+ * continuous where the real glyph breaks it). Every case connects edge-to-edge, which is the
+ * property that matters.
* - **Heavy/light is a thickness distinction only** — heavy is exactly twice light, which is what
* xterm does too.
*/
-/** One axis-aligned fill, in CELL-LOCAL device pixels. `alpha` is the shade level (the shade
- * blocks ░▒▓); absent means fully opaque. Rects only — see the module comment. */
+/**
+ * One axis-aligned, fully OPAQUE fill, in CELL-LOCAL device pixels.
+ *
+ * There is deliberately no alpha channel. The one family that looked like it wanted one — the
+ * shade blocks ░▒▓ — is a dither pattern, not a tint (see `SHADES`), and an alpha field would
+ * make it possible to "simplify" them back into flat washes that no longer match the renderer
+ * beside them. Everything this module draws is ink or nothing.
+ */
export interface PaintOp {
x: number
y: number
w: number
h: number
- alpha?: number
}
// ---------------------------------------------------------------------------------------------
@@ -149,13 +156,49 @@ const BLOCKS: Readonly<Record<number, readonly (readonly [number, number, number
0x259f: [[4, 0, 4, 8], [0, 4, 8, 4]] // ▟ upper right + lower left + lower right
}
-/** ░▒▓ — a full-cell fill at a third, a half and two thirds… in practice the conventional
- * quarter/half/three-quarter ramp every terminal renderer uses. The only contract the rest of the
- * system relies on is that they are strictly increasing. */
-const SHADES: Readonly<Record<number, number>> = {
- 0x2591: 0.25,
- 0x2592: 0.5,
- 0x2593: 0.75
+/**
+ * ░▒▓ — DITHER PATTERNS, transcribed from xterm's `patternCharacterDefinitions`, which both of its
+ * renderers use.
+ *
+ * Each entry is a bitmap of DEVICE pixels — one array element per pixel, not per fraction of the
+ * cell — tiled from the cell's top-left across the whole cell. `1` is an opaque pixel, `0` is bare
+ * background.
+ *
+ * These are NOT flat alpha fills, and the difference is the whole point. A shade block is a
+ * STIPPLE: at normal reading size the eye integrates the dither into a tint, but the texture is
+ * visible, it does not change with the cell size (the pattern is pinned to device pixels, so a
+ * bigger cell shows more dots rather than bigger ones), and it composites against whatever is
+ * behind it exactly the way the DOM renderer's does. A flat `globalAlpha` fill — what round 4
+ * shipped first — reads as a smooth wash and is instantly distinguishable from the per-terminal
+ * renderer in the side-by-side comparison the checklist asks for.
+ *
+ * The coverage ratios that fall out of the tables are 2/16, 2/8 and 6/8. xterm's own comments label
+ * them 25/50/75%, which the tables do not literally produce; matching xterm's PIXELS is the point
+ * here, not matching its comments, so the tables are transcribed as they are. The contract the
+ * tests hold is the ordering: ░ < ▒ < ▓.
+ */
+const SHADES: Readonly<Record<number, readonly (readonly number[])[]>> = {
+ 0x2591: [
+ // ░ LIGHT SHADE — 2 of 16 device px
+ [1, 0, 0, 0],
+ [0, 0, 0, 0],
+ [0, 0, 1, 0],
+ [0, 0, 0, 0]
+ ],
+ 0x2592: [
+ // ▒ MEDIUM SHADE — 2 of 8
+ [1, 0],
+ [0, 0],
+ [0, 1],
+ [0, 0]
+ ],
+ 0x2593: [
+ // ▓ DARK SHADE — 6 of 8
+ [0, 1],
+ [1, 1],
+ [1, 0],
+ [1, 1]
+ ]
}
// ---------------------------------------------------------------------------------------------
@@ -179,7 +222,7 @@ export function boxGlyphOps(code: number, cellW: number, cellH: number): PaintOp
function blockOps(code: number, cellW: number, cellH: number): PaintOp[] | null {
const shade = SHADES[code]
- if (shade !== undefined) return [{ x: 0, y: 0, w: cellW, h: cellH, alpha: shade }]
+ if (shade) return stippleOps(shade, cellW, cellH)
const spec = BLOCKS[code]
if (!spec) return null
const ops: PaintOp[] = []
@@ -340,8 +383,18 @@ function pushDoubleArm(
if (opposite === 3) inner = dir === -1 ? far : 0
else if (!anyPerp) inner = centre - (dir * Math.max(perpSpan, light)) / 2
else {
+ // Which perpendicular rail does this one corner with? The rail on the SAME side as the
+ // perpendicular arm's direction is the INNER corner and stops at the NEAR rail; the other is
+ // the OUTER corner and runs on to the FAR rail.
+ //
+ // The stop is the rail's own EDGE, not its centre line. A rail of thickness `light` centred
+ // at `centre ± light` spans `centre ± 0.5·light` … `centre ± 1.5·light`, so stopping at the
+ // centre line covers only HALF the rail it is supposed to corner with and leaves a
+ // 1-device-px hole at the elbow — reproducible at every cell size on ╔╗╚╝, and the reason the
+ // header's "exact for the corners" claim was false before round 4. Near edge is
+ // `centre + dir·0.5·light`; far edge is `centre − dir·1.5·light`.
const matches = bothPerp || (side === -1 && perpA === 3) || (side === 1 && perpB === 3)
- inner = matches ? centre + dir * light : centre - dir * light
+ inner = matches ? centre + dir * 0.5 * light : centre - dir * 1.5 * light
}
const from = dir === -1 ? 0 : inner
const to = dir === -1 ? inner : far
@@ -350,6 +403,45 @@ function pushDoubleArm(
}
}
+/**
+ * Tile a dither pattern across the cell, one rect per RUN of set pixels in a pattern row.
+ *
+ * Runs rather than individual pixels: ▓ on a retina cell is ~80 tiles, and emitting its six set
+ * pixels separately would be ~480 ops where ~320 will do. This is rasterized once per atlas slot,
+ * so the cost is not on any hot path — but the op list is also what a future direct-to-GPU path
+ * would upload, and a list that is twice as long as it needs to be is a bad default.
+ *
+ * The last tile in each direction is clipped by the cell bound (`push` clamps), so a cell that is
+ * not a whole multiple of the pattern simply shows a partial tile — which is what a repeating
+ * pattern does everywhere else, including xterm's `createPattern`.
+ */
+function stippleOps(pattern: readonly (readonly number[])[], cellW: number, cellH: number): PaintOp[] {
+ const ph = pattern.length
+ const pw = pattern[0].length
+ const ops: PaintOp[] = []
+ for (let ty = 0; ty < cellH; ty += ph) {
+ for (let row = 0; row < ph; row++) {
+ const y = ty + row
+ if (y >= cellH) break
+ for (let tx = 0; tx < cellW; tx += pw) {
+ let col = 0
+ while (col < pw) {
+ if (!pattern[row][col]) {
+ col++
+ continue
+ }
+ const start = col
+ while (col < pw && pattern[row][col]) col++
+ const x0 = tx + start
+ if (x0 >= cellW) break
+ push(ops, cellW, cellH, x0, y, Math.min(tx + col, cellW), y + 1)
+ }
+ }
+ }
+ }
+ return ops
+}
+
/** The dashed rules: `count` evenly spaced dashes with `count` gaps, centred on the cell's mid
* line. Unlike the solid lines these deliberately do NOT reach the cell edges — the gap IS the
* character. */
@@ -388,16 +480,33 @@ function dashOps(
* boundary is the full-cell invariant: `cellW` is fractional in general, so `Math.round(cellW)`
* would leave a sub-pixel of background between two adjacent ─ cells — the gap this module exists
* to close. A rect that rounds away to nothing is kept at one pixel: an invisible line is worse
- * than a slightly fat one.
+ * than a slightly fat one — but it is grown INWARD (`span` below), never off the end of the cell.
*/
function push(ops: PaintOp[], cellW: number, cellH: number, x0: number, y0: number, x1: number, y1: number): void {
- const x = snap(x0, cellW)
- const y = snap(y0, cellH)
- const w = Math.max(1, snap(x1, cellW) - x)
- const h = Math.max(1, snap(y1, cellH) - y)
+ const [x, w] = span(x0, x1, cellW)
+ const [y, h] = span(y0, y1, cellH)
ops.push({ x, y, w, h })
}
+/**
+ * One axis of `push`: snap both edges, then guarantee at least one device pixel of extent WITHOUT
+ * leaving the cell.
+ *
+ * The naive `Math.max(1, b - a)` overshoots. `▕` (right one eighth) on a 7.83px-wide cell snaps to
+ * `a = 7`, `b = 7.83`; forcing `w = 1` puts the right edge at 8, a sixth of a pixel outside the
+ * cell. It is harmless in practice — the rasterizer clips every draw to the slot — but a rule that
+ * survives only because someone else catches it is not an invariant, and the next consumer of these
+ * ops (a future GPU path that uploads them directly, say) would not clip. Growing inward keeps
+ * `x + w <= cellW` true by construction.
+ */
+function span(v0: number, v1: number, extent: number): [number, number] {
+ const a = snap(v0, extent)
+ let b = snap(v1, extent)
+ if (b - a >= 1) return [a, b - a]
+ b = Math.min(extent, a + 1)
+ return [Math.max(0, b - 1), b - Math.max(0, b - 1)]
+}
+
function snap(v: number, extent: number): number {
if (v <= 0) return 0
if (v >= extent) return extent
diff --git a/src/renderer/glyphgrid/raster.ts b/src/renderer/glyphgrid/raster.ts
index 26cdcd3ae..d5744788e 100644
--- a/src/renderer/glyphgrid/raster.ts
+++ b/src/renderer/glyphgrid/raster.ts
@@ -82,15 +82,12 @@ export function createCanvasRasterizer(
// 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
// appear between two adjacent cells and no rect lands on a half pixel.
+ // The ops are opaque white by construction — including the shade blocks, which are DITHER
+ // patterns rather than tints, so `globalAlpha` is never touched here and the atlas keeps
+ // exactly two states per texel: ink or transparent.
const geometry = boxGlyphOps(code, font.cellW, font.cellH)
if (geometry) {
- for (const op of geometry) {
- ctx.globalAlpha = op.alpha ?? 1
- ctx.fillRect(x + op.x, y + op.y, op.w, op.h)
- }
- // `restore()` puts globalAlpha back anyway; reset it explicitly so a future edit that
- // moves a draw out of the save/restore pair cannot inherit a shade's alpha.
- ctx.globalAlpha = 1
+ for (const op of geometry) ctx.fillRect(x + op.x, y + op.y, op.w, op.h)
} else {
ctx.font = `${italic ? 'italic ' : ''}${bold ? 'bold ' : ''}${font.sizePx}px ${font.family}`
ctx.fillText(String.fromCodePoint(code), x, y + baseline)