mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-06-27 17:13:51 +08:00
Merge pull request #6 from steoo/master
Fixed bug with numeric value of font-weight
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user