height property

double height

The height of this text span, as a multiple of the font size.

When height is null or omitted, the line height will be determined by the font's metrics directly, which may differ from the fontSize. When height is non-null, the line height of the span of text will be a multiple of fontSize and be exactly fontSize * height logical pixels tall.

For most fonts, setting height to 1.0 is not the same as omitting or setting height to null because the fontSize sets the height of the EM-square, which is different than the font provided metrics for line height. The following diagram illustrates the difference between the font-metrics defined line height and the line height produced with height: 1.0 (which forms the upper and lower edges of the EM-square):

Text height diagram

Examples of the resulting line heights from different values of TextStyle.height:

Text height comparison diagram

See StrutStyle for further control of line height at the paragraph level.


final double height