unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Composed Sequences
Date: Sat, 26 Feb 2022 22:02:40 +0200	[thread overview]
Message-ID: <837d9hpfa7.fsf@gnu.org> (raw)
In-Reply-To: <20220226194616.4c6e0330@JRWUBU2> (message from Richard Wordingham on Sat, 26 Feb 2022 19:46:16 +0000)

> Date: Sat, 26 Feb 2022 19:46:16 +0000
> From: Richard Wordingham <richard.wordingham@ntlworld.com>
> 
> > > > Emacs
> > > > obeys the decisions of the font designers.  
> 
> > > Unless they recorded the positions of the boundaries between the
> > > parts of a ligature!  
> 
> > I don't understand what you mean by that.
> 
> The GDEF table of an OpenType font records the boundary between the
> components of a ligature glyph, via the 'ligature caret list' table
> therein. These data, if they exist, are amongst the 'decisions of the
> font designers'.

Emacs doesn't (yet) use that information, so it cannot (yet) let you
move "inside" the ligature, if the ligature is a single grapheme.

> Glossary:
> 
> cluster  - sequence of coded characters presented to the shaping engine
>            to be shaped.

That's not the terminology we use in Emacs.  A grapheme cluster is the
output of shaping, not the input.  The input is just a match for a
regular expression that expresses our idea of the shortest sequence of
characters the shaper needs to see to do its job correctly.

> In principle, a glyph may be shared between two graphemes, but I doubt
> that Emacs has a mechanism to support that.

It doesn't, and I don't think HarfBuzz can produce such results (IIUC
what you mean).

> > Emacs behaves according to what the shaping engine tells us about the
> > number of graphems in the cluster.  Each grapheme is (by default) a
> > single unit for the purposes of cursor motion: Emacs will not let you
> > "enter" the grapheme, even if it is make out of several glyphs.  But
> > there's nothing in particular that Emacs expects from the number and
> > order of the graphemes in a cluster, we just use what the shaping
> > engine hands back to us.  And the cursor motion in Emacs is by default
> > in logical order, i.e. in the increasing order of buffer positions of
> > the original codepoints.
> 
> I hope you mean "several characters", not "several glyphs".

I mean both: in general, the shaping engine can take N codepoints
(a.k.a. "characters") and return M glyphs, arranged as K graphemes, to
display those N codepoints.

> The exception is related to disable-point-adjustment and its
> relatives, and I think also to undisplayed buffers.

In Emacs 29, there's now a variable to allow cursor movement inside a
composed sequence even when disable-point-adjustment is nil (as it is
by default).



      reply	other threads:[~2022-02-26 20:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 11:09 Manually parsing char-tables Richard Wordingham
2022-02-20 12:50 ` Eli Zaretskii
2022-02-21  1:39   ` Richard Wordingham
2022-02-26  0:28   ` Composed Sequences (was: Manually parsing char-tables) Richard Wordingham
2022-02-26  6:33     ` Eli Zaretskii
2022-02-26 15:11       ` Composed Sequences Richard Wordingham
2022-02-26 15:35         ` Eli Zaretskii
2022-02-26 19:46           ` Richard Wordingham
2022-02-26 20:02             ` Eli Zaretskii [this message]

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=837d9hpfa7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).