Skip to content

Commit 65071cc

Browse files
committed
fix: update RenderDoubleTJunction for consistent double-line rendering
- Ensure all lines, including branches, render as double lines in T-junction glyphs. - Adjust path generation logic for accurate top, bottom, left, and right configurations. - Update segment definitions to align with the new rendering behavior.
1 parent cafb3c3 commit 65071cc

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

src/VcrSharp.Infrastructure/Rendering/CustomGlyphRenderer.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ private static void RenderDoubleCorner(StringBuilder sb, char c, double x, doubl
249249

250250
/// <summary>
251251
/// Renders double-line T-junctions (╠ ╣ ╦ ╩) with proper geometry.
252-
/// The double line continues through, with a single line branching off.
252+
/// All lines are double (two parallel lines) including the branch.
253253
/// </summary>
254254
private static void RenderDoubleTJunction(StringBuilder sb, char c, double x, double y,
255255
double w, double h, string color, double stroke, double gap)
@@ -268,29 +268,33 @@ private static void RenderDoubleTJunction(StringBuilder sb, char c, double x, do
268268

269269
var pathData = c switch
270270
{
271-
'\u2560' => // ╠ - double vertical, single right
271+
'\u2560' => // ╠ - double vertical and double right
272272
$"M{F(outerV)} {F(top)}V{F(bottom)}" + // left vertical line (full)
273273
$"M{F(innerV)} {F(top)}V{F(outerH)}" + // right vertical line (top portion)
274274
$"M{F(innerV)} {F(innerH)}V{F(bottom)}" + // right vertical line (bottom portion)
275-
$"M{F(innerV)} {F(cy)}H{F(right)}", // horizontal branch to right
275+
$"M{F(innerV)} {F(outerH)}H{F(right)}" + // top horizontal line to right
276+
$"M{F(innerV)} {F(innerH)}H{F(right)}", // bottom horizontal line to right
276277

277-
'\u2563' => // ╣ - double vertical, single left
278+
'\u2563' => // ╣ - double vertical and double left
278279
$"M{F(innerV)} {F(top)}V{F(bottom)}" + // right vertical line (full)
279280
$"M{F(outerV)} {F(top)}V{F(outerH)}" + // left vertical line (top portion)
280281
$"M{F(outerV)} {F(innerH)}V{F(bottom)}" + // left vertical line (bottom portion)
281-
$"M{F(outerV)} {F(cy)}H{F(left)}", // horizontal branch to left
282+
$"M{F(outerV)} {F(outerH)}H{F(left)}" + // top horizontal line to left
283+
$"M{F(outerV)} {F(innerH)}H{F(left)}", // bottom horizontal line to left
282284

283-
'\u2566' => // ╦ - double horizontal, single down
285+
'\u2566' => // ╦ - double horizontal and double down
284286
$"M{F(left)} {F(outerH)}H{F(right)}" + // top horizontal line (full)
285287
$"M{F(left)} {F(innerH)}H{F(outerV)}" + // bottom horizontal line (left portion)
286288
$"M{F(innerV)} {F(innerH)}H{F(right)}" + // bottom horizontal line (right portion)
287-
$"M{F(cx)} {F(innerH)}V{F(bottom)}", // vertical branch down
289+
$"M{F(outerV)} {F(innerH)}V{F(bottom)}" + // left vertical line down
290+
$"M{F(innerV)} {F(innerH)}V{F(bottom)}", // right vertical line down
288291

289-
'\u2569' => // ╩ - double horizontal, single up
292+
'\u2569' => // ╩ - double horizontal and double up
290293
$"M{F(left)} {F(innerH)}H{F(right)}" + // bottom horizontal line (full)
291294
$"M{F(left)} {F(outerH)}H{F(outerV)}" + // top horizontal line (left portion)
292295
$"M{F(innerV)} {F(outerH)}H{F(right)}" + // top horizontal line (right portion)
293-
$"M{F(cx)} {F(outerH)}V{F(top)}", // vertical branch up
296+
$"M{F(outerV)} {F(outerH)}V{F(top)}" + // left vertical line up
297+
$"M{F(innerV)} {F(outerH)}V{F(top)}", // right vertical line up
294298

295299
_ => ""
296300
};
@@ -459,10 +463,10 @@ private enum BoxSegments
459463
'\u2557' => BoxSegments.DoubleHorizontal | BoxSegments.DoubleVertical, // ╗
460464
'\u255A' => BoxSegments.DoubleHorizontal | BoxSegments.DoubleVertical, // ╚
461465
'\u255D' => BoxSegments.DoubleHorizontal | BoxSegments.DoubleVertical, // ╝
462-
'\u2560' => BoxSegments.DoubleVertical | BoxSegments.LightRight, // ╠ (double vertical, single right)
463-
'\u2563' => BoxSegments.DoubleVertical | BoxSegments.LightLeft, // ╣
464-
'\u2566' => BoxSegments.DoubleHorizontal | BoxSegments.LightDown, // ╦
465-
'\u2569' => BoxSegments.DoubleHorizontal | BoxSegments.LightUp, // ╩
466+
'\u2560' => BoxSegments.DoubleVertical, // ╠ (handled specially by RenderDoubleTJunction)
467+
'\u2563' => BoxSegments.DoubleVertical, // ╣ (handled specially by RenderDoubleTJunction)
468+
'\u2566' => BoxSegments.DoubleHorizontal, // ╦ (handled specially by RenderDoubleTJunction)
469+
'\u2569' => BoxSegments.DoubleHorizontal, // ╩ (handled specially by RenderDoubleTJunction)
466470
'\u256C' => BoxSegments.DoubleHorizontal | BoxSegments.DoubleVertical, // ╬
467471

468472
// Single/double combinations

0 commit comments

Comments
 (0)