emacs-devel
[Top][All Lists]
Advanced

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

Re: Entering emojis


From: Lars Ingebrigtsen
Subject: Re: Entering emojis
Date: Sat, 30 Oct 2021 14:25:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> And I see that there is, indeed, a bug (or a missing feature) in
> truncate-string-to-width: its algorithm assumes that string-width
> returns a number that is the sum of char-width values for its
> constituent characters, which is not necessarily true when
> character-composition is involved.

(I should have read the entire thread before responding to the previous
email, I see.)

> It needs instead to consider string-width values on subsequent
> substrings.  It also cannot assume that string-width is monotonically
> increasing in the number of characters in the substring, as that, too,
> could be false when character-composition is involved.

Yup.

> Again, this is nothing specific to Emoji, this can happen with any
> composed text, for example any ligature that produces a single glyph
> from 2 or more characters.

I was idly speculating whether the current truncate-string-to-width
behaviour is "right" in some sense, and we'd have to introduce some new
primitives here, but I guess not.

But perhaps we should have one new primitive here -- something like
string-glyph-split -- that would split a string into a list of strings
where each string represents a complete glyph.  I think that might be
useful for people who are composing displays by chopping things off the
start/end of strings, for instance.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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