mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-06-27 19:45:29 +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 = {
|
CanvasTextWrapper.prototype = {
|
||||||
_init: function() {
|
_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.textBlockHeight = 0;
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
this.newLineIndexes = [];
|
this.newLineIndexes = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user