[HarfBuzz] Ligatures

Khaled Hosny dr.khaled.hosny at gmail.com
Sat May 23 18:18:33 UTC 2020



> On May 23, 2020, at 10:35 AM, Eli Zaretskii <eliz at gnu.org> wrote:
> 
>> From: Khaled Hosny <dr.khaled.hosny at gmail.com>
>> Date: Sat, 23 May 2020 09:59:15 +0200
>> Cc: harfbuzz at lists.freedesktop.org
>> 
>> Also either Emacs is currently treating text that it enables shaping for as second-class citizens where limitations/degraded performance is acceptable (which is really really bad)
> 
> Could you tell more about which limitations and degraded performance
> you had in mind?  I'm not sure we have this, but cannot tell without
> understanding the issues.

I have no idea. I’m just guessing why you think the Emacs display engine can’t handle all text like it handles Arabic. Either it does not handle Arabic correctly, or it can handle all text like it handles Arabic.

>> or “redesigning the entire Emacs display engine” is not really needed as you can just declare all text as text that needs to be shaped and be done with it.
> 
> The Emacs display engine examines the text to be displayed and laid
> out one character at a time, and makes layout decisions after each
> character or grapheme cluster it lays out.  Its design is therefore
> fundamentally incompatible with shaping large substrings of buffer
> text at once.  We do support that for short sequences of characters,
> which seems to work well enough for complex shaping (a.k.a. "character
> compositions") of scripts that require that, but we still do that one
> grapheme cluster at a time.  


That wouldn’t work for Arabic. You can’t shape Arabic one grapheme cluster at a time (or any other text actually, but the brokenness in Arabic will be immediately obvious), so I’m most certain that is not exactly how Arabic is handled in Emacs right now.

> The character composition is implemented
> in Lisp, which is called by the display engine, and which then calls
> back into C to invoke the shaper.  This implementation is meant to
> allow a great deal of control on what should be composed and how.  But
> it is also relatively slow, which is another reason why doing that for
> all the text to be laid out is impractical: it slows down redisplay to
> the degree that it becomes annoying to users.

Having more control should not be at the price of doing things wrong. The whole composition concept of Emacs does not make any sense to me, all text is “composed”. You can have a special mode that would disable shaping for specific purposes (opening huge log files, wanting to see raw text with no bidi or shaping, etc), but this can be done in cooperation with HarfBuzz and not by bypassing it entirely.

Regards,
Khaled


More information about the HarfBuzz mailing list