You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FigletText doesn't measure text size correctly
#2227
Not sure if this is of interest, but while working on a feature for FigletText, I noticed an issue with how it measures the width of text rows. I'm not certain if this is a known problem as I'm fairly new to Spectre Console.
The Issue
Currently FigletText calculates word/character widths based on the FullSize text, without taking the reduced width from smushing fitting into account. This means arranged text doesn't fill the rows when smushing/fitting is applied as shown in the following examples:
As can be seen in the second example, the word 'twice' could fit on the first line with smushing enabled. But the width measurements treat the text as if it's full size.
I made some modifications in my fork to fix the width measurement. It required moving the ComputeJunction() calls inside the GetRows() method. That way the sum of the junctions Amount property can then be used to adjust the width of each word, as the row is assembled, for a more precise measurement:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Not sure if this is of interest, but while working on a feature for FigletText, I noticed an issue with how it measures the width of text rows. I'm not certain if this is a known problem as I'm fairly new to Spectre Console.
The Issue
Currently FigletText calculates word/character widths based on the FullSize text, without taking the reduced width from smushing fitting into account. This means arranged text doesn't fill the rows when smushing/fitting is applied as shown in the following examples:
Current FullSize layout mode
Current Smushed layout mode
As can be seen in the second example, the word 'twice' could fit on the first line with smushing enabled. But the width measurements treat the text as if it's full size.
I made some modifications in my fork to fix the width measurement. It required moving the
ComputeJunction()calls inside theGetRows()method. That way the sum of the junctionsAmountproperty can then be used to adjust the width of each word, as the row is assembled, for a more precise measurement:Modified Smushed layout mode
It fits just as expected with smushing applied.
The modified code can be seen here if interested.
All reactions