[HarfBuzz] Order of combining diacriticals

Khaled Hosny dr.khaled.hosny at gmail.com
Wed Jun 12 20:24:12 UTC 2019


On Wed, Jun 12, 2019 at 10:22:48PM +0300, Eli Zaretskii wrote:
> In Emacs, we use HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES cluster
> level, because HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS produced
> incorrect display.

The cluster levels shouldn’t affect display, the glyph positions are
exactly the same for all the three:

$ hb-shape NotoSerifHebrew-Regular.ttf --unicodes="U+05D1,U+05B0,U+05BC" --cluster-level=0
[uni05B0=0 at 178,0+0|uni05BC=0 at 153,0+0|uni05D1=0+539]

$ hb-shape NotoSerifHebrew-Regular.ttf --unicodes="U+05D1,U+05B0,U+05BC" --cluster-level=1
[uni05B0=1 at 178,0+0|uni05BC=1 at 153,0+0|uni05D1=0+539]

$ hb-shape NotoSerifHebrew-Regular.ttf --unicodes="U+05D1,U+05B0,U+05BC" --cluster-level=2
[uni05B0=1 at 178,0+0|uni05BC=2 at 153,0+0|uni05D1=0+539]

This might indicate an issue with the Emacs display code.

> With this level, whenever I type a Hebrew base
> character with more than one diacritical, I need to type them in
> certain order, otherwise the display is incorrect.
> 
> For example, in this series of characters:
> 
>   U+05D1 HEBREW LETTER BET
>   U+05B0 HEBREW POINT SHEVA
>   U+05BC HEBREW POINT DAGESH

> 
> I need to type them in the above order; if I type DAGESH before SHEVA,
> the produced display is incorrect.

The glyph order and positions are the same regardless of the input order
(which is what I’d expect since HarfBuzz normalizes mark order), the
only difference is cluster values which is also expected AFICT:

$ hb-shape NotoSerifHebrew-Regular.ttf --unicodes="U+05D1,U+05B0,U+05BC" --cluster-level=1
[uni05B0=1 at 178,0+0|uni05BC=1 at 153,0+0|uni05D1=0+539]

$ hb-shape NotoSerifHebrew-Regular.ttf --unicodes="U+05D1,U+05BC,U+05B0" --cluster-level=1
[uni05B0=2 at 178,0+0|uni05BC=1 at 153,0+0|uni05D1=0+539]
 
> Is this expected with level-0 clusters?  Or should I look for a bug in
> how Emacs uses HarfBuzz?

Might be a result of hb_buffer_reverse_clusters() used by Emacs.

Regards,
Khaled


More information about the HarfBuzz mailing list