Adds two new layout modes for FigletText#2066
Adds two new layout modes for FigletText#2066patriksvensson wants to merge 2 commits intospectreconsole:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds FIGlet “layout modes” support to FigletText, enabling kerning (fitting) and smushing (universal + font-rule-based) to produce more compact/ascii-art-accurate output.
Changes:
- Introduces
FigletLayoutModeand aLayoutModeoption onFigletText, with rendering updates for fitted/smushed output. - Parses and exposes font smushing rules from FIGlet headers (
fullLayout/oldLayout) to drive smushing behavior. - Adds snapshot-based tests (plus a new test font) and a sandbox project for manual verification.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Spectre.Console/Widgets/Figlet/FigletText.cs | Implements fitted/smushed rendering and adds LayoutMode + fluent extensions. |
| src/Spectre.Console/Widgets/Figlet/FigletLayoutMode.cs | Adds a public enum for the new layout modes. |
| src/Spectre.Console/Widgets/Figlet/FigletHeader.cs | Captures FullLayout from font headers. |
| src/Spectre.Console/Widgets/Figlet/FigletFontParser.cs | Parses fullLayout and adjusts behavior around overridden index parsing. |
| src/Spectre.Console/Widgets/Figlet/FigletFont.cs | Exposes computed SmushingRules from the parsed header values. |
| src/Spectre.Console.Tests/Unit/Widgets/FigletTests.cs | Adds verification tests for fitted/smushed rendering. |
| src/Spectre.Console.Tests/Spectre.Console.Tests.csproj | Embeds the new banner.flf test font. |
| src/Spectre.Console.Tests/Expectations/Widgets/Figlet/* | Adds new verified outputs for the added tests. |
| src/Spectre.Console.Tests/Data/banner.flf | Adds a font exercising font-driven smushing rules. |
| src/Spectre.Console.slnx | Adds the Sandbox project to the solution. |
| src/Sandbox/Sandbox.csproj | New sandbox project for manual rendering inspection. |
| src/Sandbox/Program.cs | Demonstrates rendering each layout mode in a panel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
22c61fe to
94567b0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
44bd822 to
4bdc708
Compare
phil-scott-78
left a comment
There was a problem hiding this comment.
this all looks good to me, I'll probably move my usage over to it right away. I do prefer the smushed look.
The Sandbox app is the one thing I have a question about - personally I like having it in there, but it might get weird with commits in the future if people are filling it with test code.
|
@phil-scott-78 I will remove the Sandbox app! |
Now supports fitting (kerning) as well as smushing (both universal and from font rules). Closes spectreconsole#1448
4bdc708 to
4f72dcc
Compare
|
@phil-scott-78 Done. If all is good with you, should we merge this? 😅 |
I grabbed a repository with 350 figlet fonts and rendered them all. The good news is all the fonts on there that loaded in the current version worked fine with this update and spot checking the output for those seems to render just fine with the new mode. So I think its safe to push this PR. The bad news is about 120 of them failed on both versions. About 100 of them had the same issue where the endmark wasn't the hard coded That leaves 19 with other issues I can dig further into. Might just be weird fonts. |
|
@phil-scott-78 I should have done that as well. Can you share your test app? The parsing of the endmark seem fixable. If I look into fixing that, could you look into the 12 other bad fonts? |
can do. here's my audit app, it's a single file C# app - https://gist.github.com/phil-scott-78/a5825c9cf830e3d281157d8edc8d76c1 I cloned down this repository as its input - https://github.com/xero/figlet-fonts |
|
Awesome! Will take a look at it tomorrow. Super late here so I need to sleep 😅 |
|
oh nice one, I started down the path on the non-endmark failures and I found the same header height thing. Rest make sense too. Total coverage! |
|
@phil-scott-78 I've added your report as a verification test and fixed the bugs. The changes are in the latest commit. Could you take a look before we merge this? |
36ce869 to
b7c0c0f
Compare


Now supports fitting (kerning) as well as
smushing (both universal and from font rules).
Fixes #1448
Changes
Added fitting and smushing to FigletText rendering.