devongovett/pdfkit — pull request #301 by ef4 (2014-09-11 20:20:50+00:00)
Title: Fix center-aligned character spacing

Center-aligned text fails to take into account the character spacing. The fix just requires renaming `@charSpacing` so that the `widthOfString` function in `mixins/text` will see it.

Here is a minimal sample document that demonstrates the issue:

````javascript
var fs = require('fs');
var PDFDocument = require('pdfkit');
var doc = new PDFDocument();
var stream = doc.pipe(fs.createWriteStream('./out.pdf'));

function test(charSpacing) {
doc.rect(150, doc.y, 150, 30).stroke('#000');
doc.x = 150;
doc.y += 10;
doc.text("Testing", {width: 150, align: 'center', characterSpacing: charSpacing});
doc.moveDown();
}

test();
test(3);
doc.end();

stream.on('finish', function() {
process.exit(0);
});
````