[HarfBuzz] HarfBuzz shaping of R2L text
eliz at gnu.org
Wed May 29 19:32:12 UTC 2019
> Date: Wed, 29 May 2019 21:18:48 +0200
> From: Khaled Hosny <dr.khaled.hosny at gmail.com>
> Cc: harfbuzz at lists.freedesktop.org
> AFAIK, yes this is expected. Usually the glyph order shouldn’t matter,
> one just draws them as they are ordered by HarfBuzz and for anything
> that requires glyph to glyph to character mapping, the clusters provide
> all the information needed.
The display looks correct, I was just surprised that the order was
reversed regardless of the buffer's direction.
> As it happens, somewhere in Emacs does not like that for whatever reason
> and would raw the glyph in the wrong order, so it my HarfBuzz in Emacs
> integration code I used hb_buffer_reverse_clusters() right after shaping
> to get the glyph correctly drawn.
AFAICT, hb_buffer_reverse_clusters doesn't reverse the order of the
glyphs, it only renumbers the clusters such that they are in ascending
order. And in the specific case I described, there's only one cluster
anyway (I use HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES, because
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS caused problems on
> No idea how Emacs would deal with reordered Indic glyphs which don’t
> always follow the input order.
Can you show an example of such a situation and what is expected from
the correct shaping and display? I could then see what happens in
More information about the HarfBuzz