From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: larsi@gnus.org, malsburg@posteo.de, emacs-devel@gnu.org
Subject: Re: master 91418d27e9: Add new functions for computing character metrics for windows
Date: Sat, 30 Apr 2022 18:25:57 +0300 [thread overview]
Message-ID: <8335hu8uey.fsf@gnu.org> (raw)
In-Reply-To: <jwvbkwiodag.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Sat, 30 Apr 2022 10:34:58 -0400)
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: larsi@gnus.org, malsburg@posteo.de, emacs-devel@gnu.org
> Date: Sat, 30 Apr 2022 10:34:58 -0400
>
> >> But admittedly, in most cases you can use
> >> `window-max-characters-per-line only` as a heuristic because of the
> >> effect of proportional fonts
> > What else can you do when proportional fonts are used, except account
> > fro the average width?
>
> Indeed. But it just means that (unless you do the kind of job that
> Lars did in vtable and SHR) the code will always be somewhat broken, and
> the difference between using `window-max-characters-per-line` or
> `window-body-width` is in which cases it's broken.
Emacs is still 85% fixed-pitch. We still don't "have the technology"
to work with variable-pitch fonts as simply and efficiently as with
fixed-pitch. In this situation, lamenting the fact that an API is
less helpful with variable-pitch fonts strikes me as a clear case of
premature optimization.
> >> and faces
> > The function accepts FACE as the argument. So this is accounted for.
>
> I think you missed to "applied to specific parts of the text":
No, I didn't. If someone needs to use text with different faces, then
calling this function is a mistake. Any API can be used mistakenly,
but that fact doesn't yet mean the API is not useful when used
correctly.
> > (And I wonder why this sudden crusade against this function.)
>
> For one, because it's name makes it impossible to find when you're
> looking for "one of those functions that returns some notion of text
> width".
I disagree. But anyway, if you or someone can come up with a better
name, and do it soon enough, we can easily rename it.
> For two, because this was already a nasty mess and this function just
> adds insult to injury, IMO.
I cannot disagree more. The function has a place and serves a class
of use cases well enough to be justified. It prevents Lisp programs
from using low-level interfaces like font-get-glyphs etc., on the one
hand, and OTOH is simpler and faster than window-text-pixel-size.
next prev parent reply other threads:[~2022-04-30 15:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <165123811050.20687.5215165731843845332@vcs2.savannah.gnu.org>
[not found] ` <20220429131511.9BD62C01683@vcs2.savannah.gnu.org>
2022-04-29 13:46 ` master 91418d27e9: Add new functions for computing character metrics for windows Stefan Monnier
2022-04-29 13:53 ` Lars Ingebrigtsen
2022-04-29 14:55 ` Stefan Monnier
2022-04-29 19:59 ` Eli Zaretskii
2022-04-29 20:40 ` Stefan Monnier
2022-04-30 5:23 ` Eli Zaretskii
2022-04-30 11:12 ` Lars Ingebrigtsen
2022-04-30 13:33 ` Stefan Monnier
2022-04-30 13:48 ` Eli Zaretskii
2022-04-30 14:34 ` Stefan Monnier
2022-04-30 15:25 ` Eli Zaretskii [this message]
2022-04-30 15:52 ` Stefan Monnier
2022-04-30 16:19 ` Eli Zaretskii
2022-04-30 21:47 ` Stefan Monnier
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=8335hu8uey.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=malsburg@posteo.de \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).