window-text-height

window-text-height is a built-in function in `C source code'.

(window-text-height &optional WINDOW PIXELWISE)

Return the height in lines of the text display area of WINDOW.
WINDOW must be a live window and defaults to the selected one.

The returned height does not include dividers, the mode line, any header
line, nor any partial-height lines at the bottom of the text area.

Optional argument PIXELWISE non-nil, means to return the height in
pixels.