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

From: Vitalie Spinu <[email-masked]>
Date: Sat, 07 Mar 2015 18:09:02 +0200

>>> Eli Zaretskii on Sat, 07 Mar 2015 11:49:01 +0200 wrote:

 >> 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 string of of `window-body-width` and `window-body-height` don't
even mention the measurement unit. The docs can easel be more
explicit. Something along the following lines:

  Return the height of WINDOW's text area in canonical lines. The height
  of a canonical line is given by `frame-char-height`.

 > The ELisp manual explicitly says "frame's default character height".

Ok, thanks. This one is in the preamble of 27.3 Window Sizes manual page. I
have missed that paragraph completely.

BTW, the "width of a “default” character" is confusing as of the
conflicting meaning with the `default-font-height`. "Canonical" is a
better term IMO.

 > 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.

Uff. That's rather complicated :(

 > I suspect that you might be trying to compute something for which
 > helpful functions already exist, so you are encouraged to tell more
 > details.

I simply need the number of characters that can be fit in a single line
in order to set the sub-process output width.

Building on your "approximation" trick, I can get an approximate width
in pixels of the character, then divide the width of the window in
pixels by this width to get the approximate number of characters. Is
there an easier way?

Thanks,

  Vitalie