help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: window-height but taking the face into account


From: Eli Zaretskii
Subject: Re: window-height but taking the face into account
Date: Mon, 25 Mar 2024 18:57:44 +0200

> From: mbork@mbork.pl
> Date: Mon, 25 Mar 2024 17:13:38 +0100
> 
> it seems that `window-height' returns the same number irrespective of
> the font size I use (set up with `text-scale-adjust').

Yes.  Like all the window-dimension functions, it measures in units of
canonical character height, which is the height of the frame's default
face's font.

> Is it possible to get the actual number of lines visible on the
> screen?

I'd say use line-number-at for the first and the last position in the
window, then subtract the first from the last.

> I think I could use something like
> (floor (window-pixel-height) (window-default-line-height)).

This will only be correct if all the lines in the window have the same
height.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]