Skip to content

Commit

Permalink
Increase chances of pixel grid alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
espadrine committed Mar 13, 2016
1 parent d2d907c commit b72e29d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ function makeImage(data, cb) {
if (data.text[0].length === 0) {
data.logoPadding = 0;
}

var textWidth1 = (measureTextWidth(data.text[0])|0);
var textWidth2 = (measureTextWidth(data.text[1])|0);
// Increase chances of pixel grid alignment.
if (textWidth1 % 2 === 0) { textWidth1++; }
if (textWidth2 % 2 === 0) { textWidth2++; }
data.widths = [
(measureTextWidth(data.text[0])|0) + 10
+ data.logoWidth + data.logoPadding,
(measureTextWidth(data.text[1])|0) + 10,
textWidth1 + 10 + data.logoWidth + data.logoPadding,
textWidth2 + 10,
];
if (data.links === undefined) {
data.links = ['', ''];
Expand Down

0 comments on commit b72e29d

Please sign in to comment.