Mercurial > emacs
comparison lispref/display.texi @ 59137:d7025bc399f1
(Line Height): Further clarify.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 27 Dec 2004 16:57:31 +0000 |
parents | e1ad27c7a13c |
children | d928e34db52a |
comparison
equal
deleted
inserted
replaced
59136:b55f5e7372e9 | 59137:d7025bc399f1 |
---|---|
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 | 1533 A newline can have a @code{line-height} text or overlay property |
1534 that controls the total height of the display line ending in that | 1534 that controls the total height of the display line ending in that |
1535 newline. If the property value is zero, the displayed height of the | 1535 newline. If the property value is zero, the displayed height of the |
1536 line is exactly what its contents need; no line-spacing is added. | 1536 line is exactly what its contents demand; no line-spacing is added. |
1537 This case is useful for tiling small images or image slices without | 1537 This case is useful for tiling small images or image slices without |
1538 adding blank areas between the images. | 1538 adding blank areas between the images. |
1539 | 1539 |
1540 If the property value is not zero, it specifies a desired height, | 1540 If the property value is not zero, it is a height spec. A height |
1541 @var{line-height}. There are several ways it can do this: | 1541 spec stands for a numeric height value; this heigh spec specifies the |
1542 actual line height, @var{line-height}. There are several ways to | |
1543 write a height spec; here's how each of them translates into a numeric | |
1544 height: | |
1542 | 1545 |
1543 @table @code | 1546 @table @code |
1544 @item @var{integer} | 1547 @item @var{integer} |
1545 If the property is a positive integer, @var{line-height} is that integer. | 1548 If the height spec is a positive integer, the height value is that integer. |
1546 @item @var{float} | 1549 @item @var{float} |
1547 If the property is a float, @var{float}, @var{line-height} is @var{float} | 1550 If the height spec is a float, @var{float}, the numeric height value |
1548 times the frame's default line height. | 1551 is @var{float} times the frame's default line height. |
1549 @item (@var{ratio} . @var{face}) | 1552 @item (@var{ratio} . @var{face}) |
1550 If the property is a cons of the format shown, @var{line-height} is | 1553 If the height spec is a cons of the format shown, the numeric height |
1551 @var{ratio} times the height of face @var{face}. @var{ratio} can be | 1554 is @var{ratio} times the height of face @var{face}. @var{ratio} can |
1552 any type of number. If @var{face} is @code{t}, it refers to the | 1555 be any type of number. If @var{face} is @code{t}, it refers to the |
1553 current face. | 1556 current face. |
1554 @end table | 1557 @end table |
1555 | 1558 |
1556 Thus, any valid nonzero property value specifies a height in pixels, | 1559 Thus, any valid nonzero property value specifies a height in pixels, |
1557 @var{line-height}, one way or another. If the line contents' height | 1560 @var{line-height}, one way or another. If the line contents' height |
1559 the line to achieve the total height @var{line-height}. Otherwise, | 1562 the line to achieve the total height @var{line-height}. Otherwise, |
1560 @var{line-height} has no effect. | 1563 @var{line-height} has no effect. |
1561 | 1564 |
1562 If you don't specify the @code{line-height} propery, the line's | 1565 If you don't specify the @code{line-height} propery, the line's |
1563 height consists of the contents' height plus the line spacing. | 1566 height consists of the contents' height plus the line spacing. |
1567 There are several ways to specify the line spacing for different | |
1568 parts of Emacs text. | |
1564 | 1569 |
1565 @vindex default-line-spacing | 1570 @vindex default-line-spacing |
1566 You can specify the line spacing for all lines in a frame with the | 1571 You can specify the line spacing for all lines in a frame with the |
1567 @code{line-spacing} frame parameter, @xref{Window Frame Parameters}. | 1572 @code{line-spacing} frame parameter, @xref{Window Frame Parameters}. |
1568 However, if the variable @code{default-line-spacing} is | 1573 However, if the variable @code{default-line-spacing} is |
1582 Finally, a newline can have a @code{line-spacing} text or overlay | 1587 Finally, a newline can have a @code{line-spacing} text or overlay |
1583 property that controls the height of the display line ending with that | 1588 property that controls the height of the display line ending with that |
1584 newline. The property value overrides the default frame line spacing | 1589 newline. The property value overrides the default frame line spacing |
1585 and the buffer local @code{line-spacing} variable. | 1590 and the buffer local @code{line-spacing} variable. |
1586 | 1591 |
1587 One way or another, these mechanisms specify a line spacing for each | 1592 One way or another, these mechanisms specify a Lisp value for the |
1588 line. Let's call the value @var{line-spacing}. | 1593 spacing of each line. The value is a height spec, and it translates |
1589 | 1594 into a Lisp value as described above. However, in this case the |
1590 If the @var{line-spacing} value is a positive integer, it specifies | 1595 numeric height value specifies the line spacing, rather than the line |
1591 the number of pixels of additional vertical space. This space appears | 1596 height. |
1592 below the display line contents. | 1597 |
1593 | 1598 There is one exception, however: if the @var{line-spacing} value is |
1594 If the @var{line-spacing} value is a floating point number or cons, | 1599 a cons @code{(total . @var{spacing})}, then @var{spacing} itself is |
1595 the additional vertical space is @var{line-spacing} times the frame | 1600 treated as a heigh spec, and specifies the total displayed height of |
1596 default line height. | 1601 the line, so the line spacing equals the specified amount minus the |
1597 | 1602 line height. This differs from using the @code{line-height} property |
1598 @ignore @c I think we may want to delete this, so don't document it -- rms. | 1603 because it adds space at the bottom of the line instead of the top. |
1599 If the @var{line-spacing} value is a cons @code{(total . @var{spacing})} | 1604 |
1600 where @var{spacing} is any of the forms described above, the value of | 1605 If you specify both @code{line-spacing} using @code{total} and |
1601 @var{spacing} specifies the total displayed height of the line, | 1606 @code{line-height}, they are not redundant. First @code{line-height} |
1602 regardless of the height of the characters in it. This is equivalent | 1607 goes to work, adding space above the line contents. Then |
1603 to using the @code{line-height} property. | 1608 @code{line-spacing} goes to work, adding space below the contents. |
1604 @end ignore | |
1605 | 1609 |
1606 @node Faces | 1610 @node Faces |
1607 @section Faces | 1611 @section Faces |
1608 @cindex faces | 1612 @cindex faces |
1609 | 1613 |