From d068a460bd2a2c8d68b8053bd1267b445e94ca93 Mon Sep 17 00:00:00 2001 From: Adrian Hall Date: Thu, 30 Apr 2020 15:55:14 +0100 Subject: [PATCH] Change ERD fontSize config to an integer to prevent NaN errors --- src/diagrams/er/erRenderer.js | 12 +++++++++--- src/mermaidAPI.js | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/diagrams/er/erRenderer.js b/src/diagrams/er/erRenderer.js index 7435653f3..522cbd8fd 100644 --- a/src/diagrams/er/erRenderer.js +++ b/src/diagrams/er/erRenderer.js @@ -45,10 +45,13 @@ const drawEntities = function(svgNode, entities, graph) { .append('text') .attr('id', textId) .attr('x', 0) - .attr('y', (conf.fontSize + 2 * conf.entityPadding) / 2) + .attr('y', 0) .attr('dominant-baseline', 'middle') .attr('text-anchor', 'middle') - .attr('style', 'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize) + .attr( + 'style', + 'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px' + ) .text(id); // Calculate the width and height of the entity @@ -227,7 +230,10 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) { .attr('y', labelPoint.y) .attr('text-anchor', 'middle') .attr('dominant-baseline', 'middle') - .attr('style', 'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize) + .attr( + 'style', + 'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px' + ) .text(rel.roleA); // Figure out how big the opaque 'container' rectangle needs to be diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 4cbbcd21b..48626821f 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -525,9 +525,9 @@ const config = { fill: 'honeydew', /** - * Font size + * Font size (expressed as an integer representing a number of pixels) */ - fontSize: '12px' + fontSize: 12 } };