fix #7522 - merge insights into main branch
[g.raphael] / seed / toSVG.js
index b95cbd7..dce97c3 100644 (file)
@@ -108,7 +108,8 @@ function extractStyle(node) {
         font: {
             family: typeof node.attrs['font-family'] === 'undefined' ? null : node.attrs['font-family'],
             size: typeof node.attrs['font-size'] === 'undefined' ? null : (node.attrs['font-size']),
-            anchor: typeof node.attrs['text-anchor'] === 'undefined' ? null : node.attrs['text-anchor'],
+            weight: typeof node.attrs['font-weight'] === 'undefined' ? null : (node.attrs['font-weight']),
+            anchor: typeof node.attrs['text-anchor'] === 'undefined' ? null : node.attrs['text-anchor']
         }
     };
 }
@@ -122,7 +123,6 @@ function styleToString(style) {
     //Roo.log(JSON.stringify(style));
     var r = [
         'font-family:' + style.font.family,
-        'font-weight:normal',
         'font-style:normal',
         'font-stretch:normal',
         'font-variant:normal'
@@ -130,6 +130,12 @@ function styleToString(style) {
     if (style.font.size !== null) {
         r.push('font-size: ' + style.font.size + 'px')
     }
+    if (style.font.weight !== null) {
+        r.push('font-weight: ' + style.font.weight);
+    }
+    else {
+        r.push('font-weight: normal');
+    }
 
     return r.join(';')