Commit bceb4bfc authored by David Schnur's avatar David Schnur

Added lineHeight to the font-spec object.

Line height is a core font property - it can be specified as part of the
unified 'font' definition - and we therefore need to give users access
to it when they're manually defining the font.
parent dbad717c
...@@ -298,6 +298,7 @@ with this format: ...@@ -298,6 +298,7 @@ with this format:
```js ```js
{ {
size: 11, size: 11,
lineHeight: 13,
style: "italic", style: "italic",
weight: "bold", weight: "bold",
family: "sans-serif", family: "sans-serif",
...@@ -306,6 +307,9 @@ with this format: ...@@ -306,6 +307,9 @@ with this format:
} }
``` ```
The size and lineHeight must be expressed in pixels; CSS units such as 'em'
or 'smaller' are not allowed.
The options "min"/"max" are the precise minimum/maximum value on the The options "min"/"max" are the precise minimum/maximum value on the
scale. If you don't specify either of them, a value will automatically scale. If you don't specify either of them, a value will automatically
be chosen based on the minimum/maximum data values. Note that Flot be chosen based on the minimum/maximum data values. Note that Flot
......
...@@ -286,7 +286,7 @@ Licensed under the MIT license. ...@@ -286,7 +286,7 @@ Licensed under the MIT license.
// If the font is a font-spec object, generate a CSS font definition // If the font is a font-spec object, generate a CSS font definition
if (typeof font === "object") { if (typeof font === "object") {
textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family; textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px/" + font.lineHeight + "px " + font.family;
} else { } else {
textStyle = font; textStyle = font;
} }
...@@ -453,7 +453,7 @@ Licensed under the MIT license. ...@@ -453,7 +453,7 @@ Licensed under the MIT license.
show: null, // null = auto-detect, true = always, false = never show: null, // null = auto-detect, true = always, false = never
position: "bottom", // or "top" position: "bottom", // or "top"
mode: null, // null or "time" mode: null, // null or "time"
font: null, // null (derived from CSS in placeholder) or object like { size: 11, style: "italic", weight: "bold", family: "sans-serif", variant: "small-caps" } font: null, // null (derived from CSS in placeholder) or object like { size: 11, lineHeight: 13, style: "italic", weight: "bold", family: "sans-serif", variant: "small-caps" }
color: null, // base color, labels, ticks color: null, // base color, labels, ticks
tickColor: null, // possibly different color of ticks, e.g. "rgba(0,0,0,0.15)" tickColor: null, // possibly different color of ticks, e.g. "rgba(0,0,0,0.15)"
transform: null, // null or f: number -> number to transform axis transform: null, // null or f: number -> number to transform axis
...@@ -672,6 +672,8 @@ Licensed under the MIT license. ...@@ -672,6 +672,8 @@ Licensed under the MIT license.
family: placeholder.css("font-family") family: placeholder.css("font-family")
}; };
fontDefaults.lineHeight = fontDefaults.size * 1.15;
axisCount = options.xaxes.length || 1; axisCount = options.xaxes.length || 1;
for (i = 0; i < axisCount; ++i) { for (i = 0; i < axisCount; ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment