Skip to content

Snap WebGL block glyphs to shared pixel boundaries - #6138

Open
askac wants to merge 2 commits into
xtermjs:masterfrom
askac:fix/webgl-block-shared-boundaries
Open

askac wants to merge 2 commits into
xtermjs:masterfrom
askac:fix/webgl-block-shared-boundaries

Conversation

@askac

@askac askac commented Aug 27, 2026

Copy link
Copy Markdown

Why

Solid octant block glyphs are drawn from rectangles positioned on an
eighth-cell grid. When a device-cell dimension is not divisible by eight,
fractional rectangle edges are antialiased in the WebGL texture atlas. This can
leave softened edges or visible seams in composite quadrant glyphs, including
at common seven-pixel cell widths.

For example:

 ▐▛███▛█
▝▜██████▀
  ▝▝ ▝▝

Snapping every rectangle outward closes seams but can expand intentional gaps.
Always snapping shared boundaries can instead collapse narrow one-eighth
features when a cell dimension contains fewer than eight pixels.

What changed

  • Snap shared absolute octant boundaries to integer device pixels.
  • Below eight pixels, snap an axis only when every boundary used by that glyph
    remains distinct after rounding.
  • Preserve fractional coordinates when snapping would collapse a thin stroke or
    intentional gap.
  • Keep other custom glyph types and renderers unchanged.
  • Add geometry and WebGL atlas regression coverage.

Testing

  • Covered composite quadrants and complementary halves at seven- and nine-pixel
    cell widths.
  • Covered one-eighth stripes, fractional offsets, sparse stripes, and
    checkerboard topology.
  • Verified that safe seven-pixel glyphs contain no partially transparent atlas
    pixels while an unsafe seven-pixel one-eighth stripe remains visible with
    fractional coverage.
  • Verified the focused addon-webgl Chromium integration test and changed-file
    lint.

askac added 2 commits August 27, 2026 10:13
## Why

Solid block glyphs use fractional eighth-cell rectangles. At odd device-cell sizes, Canvas2D antialiasing leaves partial alpha in the WebGL atlas and exposes seams between touching blocks.

## What changed

- Snap absolute octant boundaries to integer device pixels when an axis has at least eight pixels.
- Preserve fractional coordinates below eight pixels so one-eighth stripes stay visible.
- Keep other custom glyph types and renderers unchanged.
- Add geometry and atlas regression coverage.

## Testing

- Covers odd 9-pixel cells, the 7-pixel fallback, composite quadrants, complementary halves, sparse stripes, and checkerboards.
## Why

The fixed eight-pixel threshold leaves composite block glyphs antialiased at seven-pixel cell widths even when their geometry can be snapped without loss.

## What changed

- Validate the rounded absolute boundaries used by each glyph axis.
- Snap safe seven-pixel quadrant and checkerboard geometry.
- Preserve fractional fallback when a used boundary would collapse.

## Testing

Covers seven- and nine-pixel shared boundaries, intentional gaps, fractional offsets, narrow stripes, and WebGL atlas opacity.
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.

1 participant