[HarfBuzz] Ligatures

Khaled Hosny dr.khaled.hosny at gmail.com
Tue May 26 21:37:16 UTC 2020



> On May 24, 2020, at 6:34 PM, Eli Zaretskii <eliz at gnu.org> wrote:
> 
>> From: Khaled Hosny <dr.khaled.hosny at gmail.com>
>> Date: Sun, 24 May 2020 18:00:45 +0200
>> Cc: harfbuzz at lists.freedesktop.org
>> 
> 
>> This, for example, ensures that HarfBuzz can do basic Arabic-like shaping across item boundaries e.g. if you break items in the middle of an Arabic word (due to font change, for example), you still get the initial/medial/final forms across the boundary as appropriate. Or to put a combining mark at the start of a paragraph on a dotted circle as it otherwise has no base.
>> 
>> If this is not possible, then you can try to pass enough context, like reach back and forward to first character that is not a combining mark. This may or may not be enough.
>> 
>> Shaping space-delimited words is orthogonal to that, context is better be always provided.
> 
> So this sounds like passing a physical line that ends in a newline
> should be good enough?  Or are there issues that cross newlines as
> well?

It should be enough.
> 
> And what is a "paragraph" in this context?

The same as in UAX#9.

>> Some fonts do have OpenType lookups that interact with space (e.g. kerning pairs involving space, or even substitutions involving space), so shaping words independently will give suboptimal result. You can use HarfBuzz API to find out if the font has OpenType layout rules involving space, or decide to live with this limitation.
> 
> Which API provides this information?

https://harfbuzz.github.io/harfbuzz-hb-ot-layout.html#hb-ot-layout-lookup-collect-glyphs

But requires some understanding of how OpenType lookups are structured. Checking how Firefox uses it might help.

Regards,
Khaled


More information about the HarfBuzz mailing list