summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--dist/svg.js7
-rw-r--r--src/elements/Text.js6
3 files changed, 11 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8fb06b0..8e09b70 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -79,6 +79,7 @@ The document follows the conventions described in [“Keep a CHANGELOG”](http:
- `clone()` does not add the clone to the dom anymore
- `SVG.Text.textPath()` returns only the first textpath child
- `attr()` excepts array now to get multiple values at once
+- `SVG.Text.rebuild()` now takes every font-size into account (#512)
### Fixed
- fixed a bug in clipping and masking where empty nodes persists after removal -> __TODO!__
diff --git a/dist/svg.js b/dist/svg.js
index e80e6bd..ba031c9 100644
--- a/dist/svg.js
+++ b/dist/svg.js
@@ -6,7 +6,7 @@
* @copyright Wout Fierens <wout@mick-wout.com>
* @license MIT
*
-* BUILT: Thu Nov 08 2018 12:57:03 GMT+0100 (GMT+01:00)
+* BUILT: Thu Nov 08 2018 13:49:37 GMT+0100 (GMT+01:00)
*/;
var SVG = (function () {
'use strict';
@@ -6313,8 +6313,11 @@ var SVG = (function () {
if (this._rebuild) {
var self = this;
var blankLineOffset = 0;
- var dy = this.dom.leading * new SVGNumber(this.attr('font-size'));
+ var leading = this.dom.leading;
this.each(function () {
+ var fontSize = window.getComputedStyle(this.node).getPropertyValue('font-size');
+ var dy = leading * new SVGNumber(fontSize);
+
if (this.dom.newLined) {
this.attr('x', self.attr('x'));
diff --git a/src/elements/Text.js b/src/elements/Text.js
index f1aa402..f221004 100644
--- a/src/elements/Text.js
+++ b/src/elements/Text.js
@@ -122,9 +122,13 @@ export default class Text extends Shape {
if (this._rebuild) {
var self = this
var blankLineOffset = 0
- var dy = this.dom.leading * new SVGNumber(this.attr('font-size'))
+ var leading = this.dom.leading
this.each(function () {
+ var fontSize = window.getComputedStyle(this.node)
+ .getPropertyValue('font-size')
+ var dy = leading * new SVGNumber(fontSize)
+
if (this.dom.newLined) {
this.attr('x', self.attr('x'))