Subject: Re: bug#41005: problem with rendering Persian text in Emacs 27

From: Amin Bandali <[email-masked]>
Date: Tue, 21 Jul 2020 13:53:25 -0400

Robert Pluim <[email-masked]> writes:

>>>>>> On Tue, 21 Jul 2020 08:40:56 -0400, Amin Bandali <[email-masked]> said:
>
>     Amin> Hi Eli, Pip,
>     Amin> Thank you for working on this and fixing it on emacs-27 per the reports.
>
>     Amin> I have not been able to keep a close eye on GNU lists and trackers for a
>     Amin> while now, but I was wondering if there's been any more progress/updates
>     Amin> on this issue on master?  I sometimes read/write in Persian, and this
>     Amin> bug is quite an annoyance. :-)  Changing the text scale (C-x C-=) and/or
>     Amin> filling the paragraph (M-q) seems to sometimes help, but not always; and
>     Amin> the issue remains.
>
> emacs-27 gets merged to master on a regular basis, and the relevant
> commit is present in both:
>
> $ git branch --contains 30a7ee505a
> * emacs-27
> + master
>
> Are you still seeing issues with the latest master?
>
> Robert
>

Ah, great point!  This got me suspicious, so I went ahead and actually
tried both emacs-27 and master in a few different configurations myself.

It seems that with emacs-27, Xft rendering of Arabic/Persian text works
just fine, like it used to: <https://p.bndl.org/persian-emacs-xft.png>.

However, using Cairo+HarfBuzz, on both emacs-27 and master the issue is
still present: <https://p.bndl.org/persian-emacs-ftcrhb.png>.

Excerpts from M-x describe-char RET on a Persian character from Xft and
Cairo+HarfBuzz are at <https://p.bndl.org/persian-emacs-xft.txt> and
<https://p.bndl.org/persian-emacs-ftcrhb.txt> respectively, in case that
might be useful somehow.  The font used for typesetting the Persian text
is Vazir v22.1.0, available from
<https://github.com/rastikerdar/vazir-font/releases/download/v22.1.0/vazir-font-v22.1.0.zip>.

My .Xresources configuration for the Xft and Cairo+HarfBuzz setups, the
former only for emacs-27, and the latter for both emacs-27 and master:

Emacs.FontBackend: xft,x   
Emacs.font: Source Code Pro Medium:size=14

Emacs.FontBackend: ftcrhb,x
Emacs.font: Source Code Pro Medium:size=14

Lastly, it might be worth mentioning that if I recall correctly, when
using xfthb with emacs-27, I observe the same issue.  Which may suggest
that perhaps the issue is related to Emacs's HarfBuzz support.

Hope this is useful.