Function: window--size-to-pixel

window--size-to-pixel is a byte-compiled function defined in window.el.gz.

Signature

(window--size-to-pixel WINDOW SIZE &optional HORIZONTAL PIXELWISE ROUND-MAYBE)

Documentation

For WINDOW convert SIZE lines to pixels.

SIZE is supposed to specify a height of WINDOW in terms of text lines. The return value is the number of pixels specifying that height.

WINDOW must be a valid window. Optional argument HORIZONTAL non-nil means convert SIZE columns to pixels.

Optional argument PIXELWISE non-nil means SIZE already specifies pixels but may have to be adjusted to a multiple of the character size of WINDOW's frame. Optional argument ROUND-MAYBE non-nil means round to the nearest multiple of the character size of WINDOW's frame if the option window-resize-pixelwise is nil.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
;;; Resizing windows.
(defun window--size-to-pixel (window size &optional horizontal pixelwise round-maybe)
  "For WINDOW convert SIZE lines to pixels.
SIZE is supposed to specify a height of WINDOW in terms of text
lines.  The return value is the number of pixels specifying that
height.

WINDOW must be a valid window.  Optional argument HORIZONTAL
non-nil means convert SIZE columns to pixels.

Optional argument PIXELWISE non-nil means SIZE already specifies
pixels but may have to be adjusted to a multiple of the character
size of WINDOW's frame.  Optional argument ROUND-MAYBE non-nil
means round to the nearest multiple of the character size of
WINDOW's frame if the option `window-resize-pixelwise' is nil."
  (setq window (window-normalize-window window))
  (let ((char-size (frame-char-size window horizontal)))
    (if pixelwise
	(if (and round-maybe (not window-resize-pixelwise))
	    (* (round size char-size) char-size)
	  size)
      (* size char-size))))