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: Sat, 30 Apr 2022 11:52:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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

That's not my point.  All I'm saying is that it's just another function
that does the ~90% work.  Maybe it's a bit closer to 100% but that
doesn't make it qualitatively different and that makes it part of the
same family as those other functions.  And having such wildly different
naming between those functions is not helpful.

> No, I didn't.  If someone needs to use text with different faces, then
> calling this function is a mistake.

Most of the code that will want to use this function can be confronted
with text with different faces completely out of its control
(e.g. because of hi-lock, goto-address-mode, you name it).
So you're saying that in practice most uses are "a mistake".

> Any API can be used mistakenly, but that fact doesn't yet mean the API
> is not useful when used correctly.

I think you misunderstand me: I'm not at all opposed to the
functionality offered by this new function.

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

I think it should match window-*-width since that's the most common
pattern shared by other functions in that family, AFAICT.

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

I'm not arguing against the new functionality.
I'm arguing against the way it's exposed.


        Stefan




reply via email to

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