Subject: bug#20022: 24.4.90; window-body-height, window-body-width wrong value after text-scale-adjust

From: Eli Zaretskii <[email-masked]>
Date: Sat, 07 Mar 2015 11:49:01 +0200

> From: Vitalie Spinu <[email-masked]>
> Date: Sat, 07 Mar 2015 00:31:53 +0200
> 
> After text-scale-adjust [C-x C-] window-height and window-width return
> the old (original) value.

As designed: the value is measured in canonical character units.

> The doc says:
> 
>  This function returns the height, in lines, of the body of window
>  WINDOW.

It says much more than that.  In particular, it mentions "the
character height of WINDOW's frame", which should be a hint.  The
ELisp manual explicitly says "frame's default character height".

> So at least the docs are imprecise or incomplete.

Suggestions to how to make them more complete without confusing users
(who might not even know that the size of the default face's font can
be changed, or that text-scale-adjust exists at all) are welcome.

IOW, there's a problem here: we need to provide a description that
will make sense both to relative newbies and to sophisticated Lisp
programmers alike.  The current doc string is an attempt to do so.  If
you (or someone else) can suggest a better wording for that, it will
be most welcome.

> Relatedly, there seems to be no way to determine the height/width of a
> character in pixels after rescaling. `frame-char-width` returns the
> original size.

You want default-font-height, I think.  (A similar functionality for
width can be used based on font-info modifications on the master
branch only, but you could approximate that by assuming the same ratio
between the canonical width and the rescaled width as between the
canonical height and rescaled height.)

For the line height, don't forget the line-spacing issue, which is
taken into account by the default-line-height function.

(Btw, I'm not sure how you get from window-width/height to
width/height of a character; I suspect that you might be trying to
compute something for which helpful functions already exist, so you
are encouraged to tell more details.)