minor fix. refactor.

This commit is contained in:
Christopher Jeffrey 2015-07-14 16:24:06 -07:00
parent abdd0a8c89
commit ffb657ba1b
1 changed files with 15 additions and 2 deletions

View File

@ -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;
}