Merge pull request #6 from steoo/master

Fixed bug with numeric value of font-weight
This commit is contained in:
Vadim Namniak
2015-05-05 13:28:55 -04:00
+6 -1
View File
@@ -52,7 +52,12 @@
CanvasTextWrapper.prototype = {
_init: function() {
this.fontSize = parseInt(this.font.replace(/^\D+/g,''),10) || 18;
/* Substituting this line that causing a bug with font-weight numeric values */
//this.fontSize = parseInt(this.font.replace(/^\D+/g,''),10) || 18;
/* This line allow font values like : "italic 500 25px" to preserve both numeric a literal value of font-weight*/
this.fontSize = this.font.match(/\d+(px|em|\%)/g) ? +this.font.match(/\d+(px|em|\%)/g)[0].match(/\d+/g) : 18;
this.textBlockHeight = 0;
this.lines = [];
this.newLineIndexes = [];