[HarfBuzz] Ligatures

Khaled Hosny dr.khaled.hosny at gmail.com
Sat May 23 07:59:15 UTC 2020



> On May 23, 2020, at 9:51 AM, Khaled Hosny <dr.khaled.hosny at gmail.com> wrote:
> 
> 
> 
>> On May 23, 2020, at 9:44 AM, Eli Zaretskii <eliz at gnu.org> wrote:
>> 
>>> From: Khaled Hosny <dr.khaled.hosny at gmail.com>
>>> Date: Sat, 23 May 2020 08:36:10 +0200
>>> Cc: harfbuzz at lists.freedesktop.org
>>> 
>>>>                                                      The only way of
>>>> doing this right, I'm told, is to either (a) query the font to get the
>>>> list of all the ligatures it supports, or (b) assume any combination
>>>> of characters can produce a ligature, and therefore we need to pass
>>>> all the characters intended for display through hb_shape.  The latter
>>>> in particular is in stark contrast to how the current Emacs display
>>>> code is designed and implemented.
>>> 
>>> (a) is not realistically possible as doing it properly has pretty much the same cost as shaping the text. So your only reliable option is (b).
>> 
>> Thanks.  Since (b) is not really feasible without redesigning the
>> entire Emacs display engine (for which I see no volunteers lining up
>> any time soon), I guess we will have to use some more-or-less
>> reasonable and somewhat unreliable heuristics by supporting only some
>> ligatures that are known in advance.
> 
> What are you going to do about kerning, or mark positioning? Partially kerning arbitrary glyphs (because the sub string match some regular expression) is worse than not kerning at all.

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


More information about the HarfBuzz mailing list