diff --git a/src/base/single/text.js b/src/base/single/text.js index c79a73aef0..f7925d5fe4 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -44,14 +44,14 @@ "padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit }); } - if (BI.isNumber(o.height)) { - this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit}); + if (BI.isWidthOrHeight(o.height)) { + this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height }); } - if (BI.isNumber(o.lineHeight)) { - this.element.css({lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit}); + if (BI.isWidthOrHeight(o.lineHeight)) { + this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight }); } if (BI.isWidthOrHeight(o.maxWidth)) { - this.element.css({maxWidth: o.maxWidth / BI.pixRatio + BI.pixUnit}); + this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth }); } this.element.css({ textAlign: o.textAlign,