diff --git a/lib/widgets/bigtext.js b/lib/widgets/bigtext.js index 5a7dafd..c7fbefa 100644 --- a/lib/widgets/bigtext.js +++ b/lib/widgets/bigtext.js @@ -53,19 +53,32 @@ BigText.prototype.loadFont = function(filename) { this.ratio.height = data.height; function convertLetter(ch, lines) { + var line, i; + while (lines.length > self.ratio.height) { lines.shift(); lines.pop(); } + lines = lines.map(function(line) { var chs = line.split(''); chs = chs.map(function(ch) { return ch === ' ' ? 0 : 1; }); - while (chs.length < self.ratio.width) chs.push(0); + while (chs.length < self.ratio.width) { + chs.push(0); + } return chs; }); - while (lines.length < self.ratio.height) lines.push([0, 0, 0, 0, 0, 0, 0, 0]); + + while (lines.length < self.ratio.height) { + line = []; + for (i = 0; i < self.ratio.width; i++) { + line.push(0); + } + lines.push(line); + } + return lines; }