unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: window-height but taking the face into account
Date: Mon, 25 Mar 2024 18:57:44 +0200	[thread overview]
Message-ID: <86il1ajlkn.fsf@gnu.org> (raw)
In-Reply-To: <87ttku2sst.fsf@mbork.pl>

> 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	other threads:[~2024-03-25 16:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 16:13 window-height but taking the face into account mbork
2024-03-25 16:57 ` Eli Zaretskii [this message]
2024-03-26 13:48 ` Stefan Monnier via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86il1ajlkn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).