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

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

bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font


From: Joe Corneli
Subject: bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font size changes
Date: Thu, 27 Nov 2014 20:23:32 +0000

On Thu, Nov 27 2014, martin rudalics wrote:

>  > I think you are totally right.  To keep the buffer and window
>  > distinction properly, my note should probably be read as a feature
>  > request, not a bug report.  The request is for a function such as
>  > `buffer-body-width' that would return the width of the current displayed
>  > buffer in em-length units.
>
> What is the width of a buffer?  What are em-lenght units?

I mean, the distance (in useful units!) from the left side of the
buffer, as displayed within a given window, to the right side of that
window.  If the buffer is displayed using *a fixed width font*, then one
useful unit is *columns*, i.e. the number of columns that can be
displayed before line wrap or continuation kicks in.  However, if the
buffer is displayed using a variable-width font, then "columns" is *not*
necessarily a meaningful unit -- as has been pointed out in the earlier
discussion.  In this case, see below for "ems."

To be clear, the width of the *window* calculated in non-buffer-specific
units is not generally "useful" for the purpose of measuring the number
of characters that can be fit, horizontally, into the buffer.
Nevertheless, if the window is displayed using *the default face* at the
default scale (and if the default font happens to be fixed width!) then
`window-body-width' does indeed return the number of columns.

>From Wikipedia:

  «An em is a unit in the field of typography, equal to the currently
  specified point size. For example, one em in a 16-point typeface is 16
  points. Therefore, this unit is the same for all typefaces at a given
  point size. [...] The name "em" was originally a reference to the
  width of the the capital "M" in the typeface and size being used,
  which was often the same as the point size.»

> (2) `text-scale-mode-amount' is buffer-local.  So we have to choose the
>      right buffer before evaluating it.

I agree, this is indeed an important.

> (3) `text-scale-mode-amount' constitutes a request to the display engine
>      to scale a face height.  What shall we do when our target machine
>      can't display the character with the requested height and uses, for
>      example, the nearest available height instead?

Presumably the function should fall back to the height (and
corresponding scale factor) that is actually used.  This is an edge case
that I hadn't considered!






reply via email to

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