Skip to content

Commit

Permalink
vertical smushing bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
patorjk committed Jul 23, 2020
1 parent faeb2f1 commit 9b16300
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -338,6 +338,7 @@ figlet -f "Dancing Font" "Hi"
For more info see the [figlet-cli](https://github.com/patorjk/figlet-cli).

## Release History
* 2020.07.12 v1.5.1 Fixed with with vertical smushing, updated lodash version.
* 2020.07.12 v1.5.0 Added width and whitespaceBreak options.
* 2020.04.26 v1.4.0 Removed jQuery from preloader and examples.
* 2020.02.23 v1.3.0 Added the "ANSI Regular" font and updated the README with info on how to use with Webpack.
Expand Down
4 changes: 1 addition & 3 deletions fonts/Slant.flf
@@ -1,4 +1,4 @@
flf2a$ 6 5 16 15 12 0 17807
flf2a$ 6 5 16 15 10 0 18319
Slant by Glenn Chappell 3/93 -- based on Standard
Includes ISO Latin-1
figlet release 2.1 -- 12 Aug 1994
Expand All @@ -9,8 +9,6 @@ Modified by Paul Burton <solution@earthlink.net> 12/96 to include new parameter
supported by FIGlet and FIGWin. May also be slightly modified for better use
of new full-width/kern/smush alternatives, but default output is NOT changed.
Modified by Patrick Gillespie (patorjk) on 2020/07/23 to fix vertical layout issue (ref: https://github.com/patorjk/figlet.js/issues/61)
$$@
$$ @
$$ @
Expand Down
1 change: 1 addition & 0 deletions lib/figlet.js
Expand Up @@ -390,6 +390,7 @@ var figlet = figlet || (function() {
} else if (opts.fittingRules.vLayout === SMUSHING) {
result += uni_Smush(ch1,ch2);
} else {
validSmush = false;
validSmush = (opts.fittingRules.vRule5) ? vRule5_Smush(ch1,ch2) : validSmush;
validSmush = (!validSmush && opts.fittingRules.vRule1) ? vRule1_Smush(ch1,ch2) : validSmush;
validSmush = (!validSmush && opts.fittingRules.vRule2) ? vRule2_Smush(ch1,ch2) : validSmush;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "figlet",
"version": "1.5.0",
"version": "1.5.1",
"description": "Creates ASCII Art from text. A full implementation of the FIGfont spec.",
"keywords": [
"figlet",
Expand Down
10 changes: 10 additions & 0 deletions test/expected/verticalSmushRule2
@@ -0,0 +1,10 @@
______ _ __
/_ __/__ _________ ___ (_)___ ____ _/ /
/ / / _ \/ ___/ __ `__ \/ / __ \/ __ `/ /
/ / / __/ / / / / / / / / / / / /_/ / /
/_/__\___/_/ /_/ /_/ /_/_/_/ /_/\__,_/_/
/ ____/ /_ ___ __________
/ / / __ \/ _ \/ ___/ ___/
/ /___/ / / / __(__ |__ )
\____/_/ /_/\___/____/____/

9 changes: 9 additions & 0 deletions test/figlet_test.js
Expand Up @@ -200,6 +200,15 @@ exports.figlet = {

test.done();
},
verticalSmushRule2: function(test) {
test.expect(1);

var expected = grunt.file.read('test/expected/verticalSmushRule2');
var actual = figlet.textSync('Terminal\nChess', {font: 'Slant'});
test.equal(actual, expected, 'Vertical Smush Rule 2 should be followed.');

test.done();
},
printDirection: function(test) {
test.expect(1);

Expand Down

0 comments on commit 9b16300

Please sign in to comment.