minor fix. refactor.
This commit is contained in:
parent
abdd0a8c89
commit
ffb657ba1b
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue