comparison lispref/display.texi @ 58902:e1ad27c7a13c

(Line Height): Rewrite text for clarity.
author Richard M. Stallman <rms@gnu.org>
date Sat, 11 Dec 2004 23:15:58 +0000
parents eb1bd3031b13
children d7025bc399f1 fb79180b618d
comparison
equal deleted inserted replaced
58901:40bfa1ceae4a 58902:e1ad27c7a13c
1523 maximum height of any character or image on that display line, 1523 maximum height of any character or image on that display line,
1524 including the final newline if there is one. (A line that is 1524 including the final newline if there is one. (A line that is
1525 continued doesn't include a final newline.) In the most common case, 1525 continued doesn't include a final newline.) In the most common case,
1526 the line height equals the height of the default frame font. 1526 the line height equals the height of the default frame font.
1527 1527
1528 There are several other ways to change the line height, either by 1528 There are several ways to explicitly control or change the line
1529 specifying an absolute height for the display line, or by adding 1529 height, either by specifying an absolute height for the display line,
1530 additional vertical space below each line. 1530 or by adding additional vertical space below one or all lines.
1531 1531
1532 @kindex line-height @r{(text property)} 1532 @kindex line-height @r{(text property)}
1533 A newline can have a @code{line-height} text or overlay property that 1533 A newline can have a @code{line-height} text or overlay property
1534 controls the total height of the display line ending in that newline. 1534 that controls the total height of the display line ending in that
1535 We will call the property value @var{line-height}. 1535 newline. If the property value is zero, the displayed height of the
1536 1536 line is exactly what its contents need; no line-spacing is added.
1537 If @var{line-height} property is 0, the height of the line is 1537 This case is useful for tiling small images or image slices without
1538 determined solely from its contents; nothing is added. Any 1538 adding blank areas between the images.
1539 @code{line-spacing} property on this newline is ignored. This case is 1539
1540 useful for tiling small images or image slices without adding blank 1540 If the property value is not zero, it specifies a desired height,
1541 areas between the images. 1541 @var{line-height}. There are several ways it can do this:
1542 1542
1543 If @var{line-height} property is a positive integer, the value 1543 @table @code
1544 specifies the minimum line height in pixels. The line's ascent height 1544 @item @var{integer}
1545 is increased as necessary to achieve the specified height. 1545 If the property is a positive integer, @var{line-height} is that integer.
1546 1546 @item @var{float}
1547 If @var{line-height} property is a floating point number, the 1547 If the property is a float, @var{float}, @var{line-height} is @var{float}
1548 minimum line height is the product of @var{line-height} and the 1548 times the frame's default line height.
1549 default frame line height. 1549 @item (@var{ratio} . @var{face})
1550 1550 If the property is a cons of the format shown, @var{line-height} is
1551 If @var{line-height} property is a cons @code{(@var{ratio} . @var{face})}, 1551 @var{ratio} times the height of face @var{face}. @var{ratio} can be
1552 the minimum line height is calculated as @var{ratio} times the height 1552 any type of number. If @var{face} is @code{t}, it refers to the
1553 of face @var{face}. The @var{ratio} is an integer or a floating point 1553 current face.
1554 number. If @var{face} is @code{t}, it refers to the current face. 1554 @end table
1555
1556 Thus, any valid nonzero property value specifies a height in pixels,
1557 @var{line-height}, one way or another. If the line contents' height
1558 is less than @var{line-height}, Emacs adds extra vertical space above
1559 the line to achieve the total height @var{line-height}. Otherwise,
1560 @var{line-height} has no effect.
1561
1562 If you don't specify the @code{line-height} propery, the line's
1563 height consists of the contents' height plus the line spacing.
1555 1564
1556 @vindex default-line-spacing 1565 @vindex default-line-spacing
1557 You can specify additional line spacing for all lines in a frame 1566 You can specify the line spacing for all lines in a frame with the
1558 with the @code{line-spacing} frame parameter, @xref{Window Frame 1567 @code{line-spacing} frame parameter, @xref{Window Frame Parameters}.
1559 Parameters}. However, if the variable @code{default-line-spacing} is 1568 However, if the variable @code{default-line-spacing} is
1560 non-@code{nil}, it overrides the frame's @code{line-spacing} 1569 non-@code{nil}, it overrides the frame's @code{line-spacing}
1561 parameter. An integer value specifies the number of pixels put below 1570 parameter. An integer value specifies the number of pixels put below
1562 lines on window systems. A floating point number specifies the 1571 lines on window systems. A floating point number specifies the
1563 spacing relative to the default frame line height. 1572 spacing relative to the frame's default line height.
1564 1573
1565 @vindex line-spacing 1574 @vindex line-spacing
1566 You can specify additional line spacing for all lines in a buffer 1575 You can specify the line spacing for all lines in a buffer via the
1567 via the buffer-local @code{line-spacing} variable. An integer value 1576 buffer-local @code{line-spacing} variable. An integer value specifies
1568 specifies the number of pixels put below lines on window systems. A 1577 the number of pixels put below lines on window systems. A floating
1569 floating point number specifies the spacing relative to the default 1578 point number specifies the spacing relative to the default frame line
1570 frame line height. 1579 height. This overrides line spacings specified for the frame.
1571 1580
1572 @kindex line-spacing @r{(text property)} 1581 @kindex line-spacing @r{(text property)}
1573 Finally, a newline can have a @code{line-spacing} text or overlay 1582 Finally, a newline can have a @code{line-spacing} text or overlay
1574 property that controls the height of the display line ending with that 1583 property that controls the height of the display line ending with that
1575 newline. The property value overrides the default frame line spacing 1584 newline. The property value overrides the default frame line spacing
1576 and the buffer local @code{line-spacing} variable. We will call the 1585 and the buffer local @code{line-spacing} variable.
1577 property value @var{line-spacing}. 1586
1578 1587 One way or another, these mechanisms specify a line spacing for each
1579 If the @var{line-spacing} value is a positive integer, the value 1588 line. Let's call the value @var{line-spacing}.
1580 specifies additional vertical space, below the display line, in 1589
1581 pixels. 1590 If the @var{line-spacing} value is a positive integer, it specifies
1591 the number of pixels of additional vertical space. This space appears
1592 below the display line contents.
1582 1593
1583 If the @var{line-spacing} value is a floating point number or cons, 1594 If the @var{line-spacing} value is a floating point number or cons,
1584 the additional vertical space is the product of @var{line-spacing} and 1595 the additional vertical space is @var{line-spacing} times the frame
1585 the default frame line height. 1596 default line height.
1586 1597
1598 @ignore @c I think we may want to delete this, so don't document it -- rms.
1587 If the @var{line-spacing} value is a cons @code{(total . @var{spacing})} 1599 If the @var{line-spacing} value is a cons @code{(total . @var{spacing})}
1588 where @var{spacing} is any of the forms described above, the value of 1600 where @var{spacing} is any of the forms described above, the value of
1589 @var{spacing} specifies the total displayed height of the line, 1601 @var{spacing} specifies the total displayed height of the line,
1590 regardless of the height of the characters in it. This is equivalent 1602 regardless of the height of the characters in it. This is equivalent
1591 to using the @code{line-height} property. 1603 to using the @code{line-height} property.
1604 @end ignore
1592 1605
1593 @node Faces 1606 @node Faces
1594 @section Faces 1607 @section Faces
1595 @cindex faces 1608 @cindex faces
1596 1609