Skip to content

Render dashed-wide, heavy-dash, and diagonal box glyphs in SVG - #4

Merged
phil-scott-78 merged 1 commit into
mainfrom
fix/svg-box-border-glyphs
Jun 7, 2026
Merged

Render dashed-wide, heavy-dash, and diagonal box glyphs in SVG#4
phil-scott-78 merged 1 commit into
mainfrom
fix/svg-box-border-glyphs

Conversation

@phil-scott-78

Copy link
Copy Markdown
Owner

What

The SVG CustomGlyphRenderer was missing or mis-drawing several box-drawing glyphs used by the new stacka-ported BoxBorder styles (new-box-borders.md). This fixes all three gaps so every one of the 17 new border sets renders correctly.

Glyphs Before After
╌ ╎ ╍ ╏ (DashedWide / RoundedDashedWide / HeavyDashedWide) No segment-table entry → rendered blank Real 2-dash stroke-dasharray line
╱ ╲ (Beveled) Mapped to LightLeft|LightRight → drew a horizontal bar True corner-to-corner diagonal strokes
┅ ┇ ┉ ┋ (HeavyDashed / HeavyDotted) Hardcoded lightStroke → drew thin Stroked at heavyStroke

How

  • Added TryRenderDashed (light + heavy families in 2-, 3-, and 4-dash densities) and TryRenderDiagonal (╱ ╲ ╳), both invoked before the segment lookup.
  • The dash/gap math generalizes the historical triple-dash pattern — dash = 2*len/(3N-1), gap = dash/2 — so existing light triple/quad-dash output is byte-identical.
  • Removed the now-dead dashed/diagonal table entries and the unused DashedHorizontal/DashedVertical enum flags.

Testing

  • A throwaway harness rendered all 52 distinct glyphs from new-box-borders.md: ok=52 blank=0 bad=0, with diagonal and heavy-weight assertions passing.
  • Solution builds clean (0 warnings/errors).
  • Full test suite passes: 301 Core + 89 Terminal.

The SVG CustomGlyphRenderer was missing or mis-drawing several box-drawing
glyphs used by the new stacka-ported BoxBorder styles:

- Dashed-wide (double-dash) chars in the DashedWide / RoundedDashedWide /
  HeavyDashedWide borders had no segment-table entry, so they rendered blank.
- The Beveled border's diagonals were mapped to LightLeft|LightRight, drawing
  a horizontal bar through the cell instead of an actual diagonal.
- Heavy dashes stroked at the light weight, so they looked thin.

Replace the segment-table handling of dashed/diagonal glyphs with two
dedicated handlers invoked before the lookup:

- TryRenderDashed covers the light/heavy families in 2-, 3-, and 4-dash
  densities, routing heavy variants through heavyStroke. The dash/gap math
  generalizes the historical triple-dash pattern (dash = 2*len/(3N-1),
  gap = dash/2), so existing light triple/quad dash output is byte-identical.
- TryRenderDiagonal draws true corner-to-corner strokes for the diagonals.

Remove the now-dead dashed/diagonal table entries and the unused
DashedHorizontal/DashedVertical enum flags. Verified all 52 distinct glyphs
in new-box-borders.md render correctly; full test suite passes (301 + 89).
@phil-scott-78
phil-scott-78 merged commit 85dd8c2 into main Jun 7, 2026
2 checks passed
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