Subject: bug#42562: Problem with rendering Persian text still exists in minibuffer and dired

From: Sineau Gh <[email-masked]>
Date: Thu, 30 Jul 2020 23:42:23 +0430

> From: Sineau Gh <[email-masked]>
> > Date: Thu, 30 Jul 2020 17:27:36 +0430
> > Cc: [email-masked]
> >
> > The problem I originally reported was not concerned with typing text,
> but text rendered in read-only buffers
> > (ie. dired and minibuffer).
>
> Then please describe the steps to reproduce this with one such
> read-only buffer.
>
>

> Also here's the bad news. Just now I realized that bug#41005 is not
> solved yet. At certain combinations of
> > characters, the ligatures are still disjointed. Also I tried to change
> the font family, but that  didn't help either.
> > This doesn't happen when I compiled emacs using --without-harfbuzz
> option. I don't know if it helps but I can
> > try to find if there's a pattern to the combinations of characters I
> mentioned.
>
> Here also we would need a recipe to reproduce the problem.
>
> These problems are highly context dependent, and cannot be debugged
> without a reproducer.

> Thanks.

Upon further investigation, I realized that in my config I have used a
combination of `default-frame-alist` and `set-fontset-font` that I forgot
about. So here's a reproduction I hope can be useful for you. First of all
the case is the same for both editable buffers and read-only ones so I'm
just using a file with following content:
تست
تحقیق
به
اصالت

شرتالکو
حقیق
حقیقت
سنت
تالکو
مدرن
مدرنیزاسیون
I have tested this in three cases. Please note they are basically the same
with some minor differences, but I mention them for completeness.
1- If I have not set a default font in my config, the text is rendered with
broken ligatures. And if I set the font using `M-x set-frame-font` then
everything is okay (even if I set it again to the default font used for
Persian / Arabic text).

2- If I use something like the following in my config files:
`(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12"))`
on init the font is rendered broken. And if I set the font using `M-x
set-frame-font` then everything is okay. Now if I set it again to DejaVu
Sans Mono (the font I have used in my config file), it still shows broken
text. I have to first set it to another font and then set it again to
DejaVu so it renders correctly.

3- If I use the following line in my config:
`(set-frame-font "DejaVu Sans Mono-12" t t)`
on init the font is broken. And if I set the font using `M-x
set-frame-font` then everything is okay (like previous cases). But I can't
set it to DejaVu Sans Mono using `M-x set-frame-font` in any way. That
means I first tried to change the font to something different and then back
to DejaVu and still it didn't work.

I should note that I have tested this with various fonts and the result is
the same. Also I have tested this in Org and Fundamental modes and the
result is the same. Also I didn't add `set-fontset-font` to the mix but I
supposed it's not going to make a difference.

I hope this helps, and excuse me if it's not. Thanks for your patience.