emacs-devel
[Top][All Lists]
Advanced

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

Re: master 91418d27e9: Add new functions for computing character metrics


From: Stefan Monnier
Subject: Re: master 91418d27e9: Add new functions for computing character metrics for windows
Date: Fri, 29 Apr 2022 09:46:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen [2022-04-29 09:15:10] wrote:
> ++++
> +** New function 'window-max-characters-per-line'.
> +
> ++++
> +** New function 'window-char-pixel-width'.
> +
> ++++
> +** New function 'window-char-pixel-width'.

Any reason not to group them under the same heading?

> +    (let* ((face (if face face 'default))

(or face 'default) ?

> +        (info (font-info (face-font face)))
> +        (width (aref info 11)))
> +      (if (> width 0)
> +       width
> +     (aref info 10)))))

Any chance we could have a `cl-defstruct` for those font-info objects, so
we can use names rather than magic constants?  Alternatively a short
comment here explaining the difference between 11 and 10 would be nice.

> +(defun window-max-characters-per-line (&optional window face)

The name says "max", but AFAICT it's basically "window width / *average*
char width", so it's not really the "max" number of chars (unsurprisingly).

I'm not sure how best to name it (and document it), tho.
For that I think I'd need to know what are the use cases (to see what
property they rely on).


        Stefan




reply via email to

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