From f7e9177dbe00aecb002e17f1ae7a20309df70ffe Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 22 Sep 2018 20:43:23 +0200 Subject: [PATCH] fix fontsize parsing (#5258) --- src/parser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/parser.js b/src/parser.js index de9ad84ee12..9051d1be5aa 100644 --- a/src/parser.js +++ b/src/parser.js @@ -826,8 +826,6 @@ if (element.parentNode && fabric.svgValidParentsRegEx.test(element.parentNode.nodeName)) { parentAttributes = fabric.parseAttributes(element.parentNode, attributes, svgUid); } - fontSize = (parentAttributes && parentAttributes.fontSize ) || - element.getAttribute('font-size') || fabric.Text.DEFAULT_SVG_FONT_SIZE; var ownAttributes = attributes.reduce(function(memo, attr) { value = element.getAttribute(attr); @@ -841,6 +839,9 @@ ownAttributes = extend(ownAttributes, extend(getGlobalStylesForElement(element, svgUid), fabric.parseStyleAttribute(element))); + fontSize = (parentAttributes && parentAttributes.fontSize ) || + ownAttributes['font-size'] || fabric.Text.DEFAULT_SVG_FONT_SIZE; + var normalizedAttr, normalizedValue, normalizedStyle = {}; for (var attr in ownAttributes) { normalizedAttr = normalizeAttr(attr);