[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Composed Sequences
From: |
Eli Zaretskii |
Subject: |
Re: Composed Sequences |
Date: |
Sat, 26 Feb 2022 22:02:40 +0200 |
> 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).