3 Commits

Author SHA1 Message Date
Vadim Namniak 66da3411c3 updated to v0.3.1 2015-05-05 17:14:54 -04:00
Vadim Namniak a1ba88647e Merge pull request #6 from steoo/master
Fixed bug with numeric value of font-weight
2015-05-05 13:28:55 -04:00
Steoo 13abe2526c Fixed bug with numeric value of font-weight 2015-05-04 22:30:48 +02:00
3 changed files with 8 additions and 3 deletions
+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 = [];
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "canvas-text-wrapper",
"version": "0.3.0",
"version": "0.3.1",
"ignore": [
"**/.*",
"**/*.log",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "canvas-text-wrapper",
"description": "Pure JavaScript canvas text wrapper that automatically splits a string into lines on specified rule with alignment and padding.",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"main": "CanvasTextWrapper.min.js",
"homepage": "http://namniak.github.io/CanvasTextWrapper/",