don't render 0 ... also this file needs some love

This commit is contained in:
Sam 2013-06-11 15:26:36 +10:00
parent 4e01b84695
commit 4d7a520a8c

View file

@ -48,6 +48,7 @@
myGlyphs.push(glyphs[v]);
});
}
if(num>0) {
// Merge the glyphs together
var combined = [];
var glyphHeight = myGlyphs[0].length;
@ -59,7 +60,7 @@
} else {
// Merge the glyph parts, careful of the boundaries
var l = combined[y].length;
if(combined[y][(l-1)] == ' '){
if(combined[y][(l-1)] === ' '){
combined[y] = combined[y].substring(0, (l-1)) + v[y];
} else {
combined[y] += v[y].substring(1);
@ -69,17 +70,18 @@
});
// Figure out our starting position
var glyphWidth = combined[0].length;
var x = (myPos.indexOf('l') != -1) ? 0 : (16 - glyphWidth);
var y = (myPos.indexOf('t') != -1) ? 0 : (16 - glyphHeight);
var x = (myPos.indexOf('l') !== -1) ? 0 : (16 - glyphWidth);
var y = (myPos.indexOf('t') !== -1) ? 0 : (16 - glyphHeight);
// Draw them pixels!
for(dX=0; dX<glyphWidth; dX++){
for(dY=0; dY<glyphHeight; dY++){
var pixel = combined[dY][dX];
if(pixel != ' '){
ctx.fillStyle = (pixel == '@') ? myFg : myBg;
if(pixel !== ' '){
ctx.fillStyle = (pixel === '@') ? myFg : myBg;
ctx.fillRect((x+dX), (y+dY), 1, 1);
}
}
}
}
}
// Update the favicon