From 745d24cc7928e800b79684164b356db8c5070e0e Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sun, 24 Nov 2013 20:02:53 -0800 Subject: [PATCH] Default lineHeight based on the font size. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flot 0.8.0 used the default font size, typically derived from the placeholder, as the basis for the default lineHeight. This produced incorrect results when a font.size was provided explicitly, and it differed from the placeholder’s CSS size. Fixed by waiting to default lineHeight until the actual font size has been resolved. Fixes #1131. --- jquery.flot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 6ee9b9d..6a3799f 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -762,8 +762,6 @@ Licensed under the MIT license. family: placeholder.css("font-family") }; - fontDefaults.lineHeight = fontDefaults.size * 1.15; - axisCount = options.xaxes.length || 1; for (i = 0; i < axisCount; ++i) { @@ -780,6 +778,9 @@ Licensed under the MIT license. if (!axisOptions.font.color) { axisOptions.font.color = axisOptions.color; } + if (!axisOptions.font.lineHeight) { + axisOptions.font.lineHeight = Math.round(axisOptions.font.size * 1.15); + } } } @@ -799,6 +800,9 @@ Licensed under the MIT license. if (!axisOptions.font.color) { axisOptions.font.color = axisOptions.color; } + if (!axisOptions.font.lineHeight) { + axisOptions.font.lineHeight = Math.round(axisOptions.font.size * 1.15); + } } }