Closed
Description
I've just got weird rendering of text "Terminal Chess" in Slant font when wrapping.
______ _ __
/_ __/__ _________ ___ (_)___ ____ _/ /
/ / / _ \/ ___/ __ `__ \/ / __ \/ __ `/ /
/ / / __/ / / / / / / / / / / / /_/ / /
/_/__\\\\\\/ /_/ /_/ /_/_/_/ /_/\__,_/_/
/ ____/ /_ ___ __________
/ / / __ \/ _ \/ ___/ ___/
/ /___/ / / / __(__ |__ )
\____/_/ /_/\___/____/____/
See the "e" letter. Reproducing demo https://codepen.io/jcubic/pen/JjGxvMY?editors=0010
Activity
jcubic commentedon Jul 22, 2020
It's not about wrapping it's about merging lines same can be observed at demo when type two lines
http://patorjk.com/software/taag/#p=display&f=Slant&t=Terminal%0AChess .
patorjk commentedon Jul 22, 2020
Thank you for the report. This looks like a bug in the vertical smushing. Unfortunately I’m on mobile right now and won’t be able to take a closer look until tonight.
patorjk commentedon Jul 23, 2020
So it looks like this isn't a bug, but rather a consequence of the font author not setting good layout parameters for the font. The Slant font has a full_layout value of 18319 [1]. This means it's layout options are: [2]
It's "Apply vertical smushing rule 2 when smushing" that is causing this effect. My guess, from the comment at the top of the font file, is that Paul Burton just copied the layout parameter from another font. Changing the full_layout parameter to 17807 (which will exclude that rule), should fix this issue.
[1] https://github.com/patorjk/figlet.js/blob/master/fonts/Slant.flf
[2] https://github.com/patorjk/figlet.js/blob/master/doc/figfont.txt
jcubic commentedon Jul 23, 2020
Great, investigation. Will you publish to npm version 1.5.1 with the fix?
jcubic commentedon Jul 23, 2020
Can you create the branch with the fix where I can test? I wanted to test master branch from https://cdn.jsdelivr.net/gh/patorjk/figlet.js@master/fonts/ but it seems that there was no commit.
jcubic commentedon Jul 23, 2020
Or maybe you will not update the Font because it's someone else document?
jcubic commentedon Jul 23, 2020
I've checked linux figlet and it seems that it don't work like this, maybe there is layout mode that allow this but it's not documented (I was not able to find it):
this it the output:
If you know how to enable same behavior in original figlet it can be reported as a bug.
patorjk commentedon Jul 23, 2020
I will take a closer look at this - at first I thought it was because the linux figlet didn't support full_layout, but it may be an issue with vertical underscore smushing.
I've updated the font in master, and it looks like it works - but I may revert that change if I find the bug is actually in the underscore smushing (I have to run some errands but I should be able to tackle this this afternoon).
patorjk commentedon Jul 23, 2020
So there was a bug, I've updated master. Can you confirm that it works correctly? Here's what the output should be based on the layout rules:
This is different than the linux version because the linux version doesn't support the full_layout parameter and instead uses the old_layout parameter. Full_layout was added when the figlet creators released FigWin, though that version has long since died and for whatever reason they never updated their linux app (the figlet spec mentions this - that FigWin implements the full spec and the figlet linux app does not. I think maybe they thought FigWin would replace the command line app).
Also, if you want to avoid vertical smushing, you can manually set the vertical layout with verticalLayout (just set it to "fitted" or "full"). Most fonts default to using one of those two values.
jcubic commentedon Jul 23, 2020
There is one inconsistency maybe another bug you can see in latest code from master https://codepen.io/jcubic/pen/JjGxvMY
I've added few underscores to be sure if it merged (smushed) those lines correctly:
I think that the issue is with
a
letter in slant fontpatorjk commentedon Jul 23, 2020
This looks to be expected. For "Terminal Chess" with 5 underscores, it doesn't merge the lines because the full_layout parameter specifies that it's to use rules 1-3 for vertical smushing:
A "," plus an "_" doesn't meet any rules for smushing, so the line can't be smushed.
jcubic commentedon Jul 23, 2020
What about this:
I've edited previous comment multiple times, one the example show same code but with _ before chess with o it's the same.
patorjk commentedon Jul 23, 2020
That case is the same as the previous one. "," can take the place of " " with no problem, but "," and "_" can't be smushed together. That's why the first case smushes together a line closer than the second case.
22 remaining items