elisp: Pixel Specification

 
 37.16.3 Pixel Specification for Spaces
 --------------------------------------
 
 The value of the ‘:width’, ‘:align-to’, ‘:height’, and ‘:ascent’
 properties can be a special kind of expression that is evaluated during
 redisplay.  The result of the evaluation is used as an absolute number
 of pixels.
 
    The following expressions are supported:
 
        EXPR ::= NUM | (NUM) | UNIT | ELEM | POS | IMAGE | FORM
        NUM  ::= INTEGER | FLOAT | SYMBOL
        UNIT ::= in | mm | cm | width | height
        ELEM ::= left-fringe | right-fringe | left-margin | right-margin
              |  scroll-bar | text
        POS  ::= left | center | right
        FORM ::= (NUM . EXPR) | (OP EXPR ...)
        OP   ::= + | -
 
    The form NUM specifies a fraction of the default frame font height or
 width.  The form ‘(NUM)’ specifies an absolute number of pixels.  If NUM
 is a symbol, SYMBOL, its buffer-local variable binding is used.
 
    The ‘in’, ‘mm’, and ‘cm’ units specify the number of pixels per inch,
 millimeter, and centimeter, respectively.  The ‘width’ and ‘height’
 units correspond to the default width and height of the current face.
 An image specification ‘image’ corresponds to the width or height of the
 image.
 
    The elements ‘left-fringe’, ‘right-fringe’, ‘left-margin’,
 ‘right-margin’, ‘scroll-bar’, and ‘text’ specify to the width of the
 corresponding area of the window.
 
    The ‘left’, ‘center’, and ‘right’ positions can be used with
 ‘:align-to’ to specify a position relative to the left edge, center, or
 right edge of the text area.
 
    Any of the above window elements (except ‘text’) can also be used
 with ‘:align-to’ to specify that the position is relative to the left
 edge of the given area.  Once the base offset for a relative position
 has been set (by the first occurrence of one of these symbols), further
 occurrences of these symbols are interpreted as the width of the
 specified area.  For example, to align to the center of the left-margin,
 use
 
      :align-to (+ left-margin (0.5 . left-margin))
 
    If no specific base offset is set for alignment, it is always
 relative to the left edge of the text area.  For example, ‘:align-to 0’
 in a header-line aligns with the first text column in the text area.
 
    A value of the form ‘(NUM . EXPR)’ stands for the product of the
 values of NUM and EXPR.  For example, ‘(2 . in)’ specifies a width of 2
 inches, while ‘(0.5 . IMAGE)’ specifies half the width (or height) of
 the specified image.
 
    The form ‘(+ EXPR ...)’ adds up the value of the expressions.  The
 form ‘(- EXPR ...)’ negates or subtracts the value of the expressions.