In previous email I just open the test file but now I try to write the example again this behavior is shown which might be useful:

When I type A[ZWNJ]B it's OK. In Persian when I type first character and then ZWNJ it's exactly the same as English but just after I type the next character it replaced by '['. So some another mechanism might be involved. I've provided a screen shot which now show these three cases:

Regards,

On Mon, Sep 4, 2017 at 4:12 PM Nima Aryan <nimawebgard@gmail.com> wrote:
It got interesting and I've found a workaround for the issue. display of ZWNJ as SPACE or any other character is matter of font. Different fonts uses different characters. Default Emacs font shows '[' instead of space which is better and more readable at least. 

The only minor problem I've seen so far is the irrelevance of displayed character (shown as ZWNJ) to the 'glyphless-char-display-control' for Persian alphabet.  

I've attached a screenshot which shows different behavior of display for both English and Persian at the same time. I execute `emacs -q` to launch default Emacs. Then I open Test.text sample attached in previous emails. Set the `glyphless-char-display-control` to show hex-box. It's clearly shown that The English one is replaced by a hex-box but the Persian one with a '[' (or SPACE).  No matter what the 'glyphless-char-display-control' the Persian case shows same character. 

Note, To type the ZWNJ for the English text, AB, I used Persian input (A, switch keyboard layout, SHIFT+Space, switch back to English, B). So when I put ZWNJ between the AB it's shown as hex-box (and affected by 'glyphless-char-display-control' as expected) but when I type it between Persian characters it's shown as fixed '[' or 'SPACE' (font based) no matter what the glyphless-char dictates. 

Best Regards,


On Mon, Sep 4, 2017 at 1:45 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: sadid sahami <sadidsahami@gmail.com>
> Date: Mon, 04 Sep 2017 05:05:03 +0000
>
> I've provided a minimal test text, written in Emacs (Test.text) and its display for Gedit (Gedit_display.png) and
> Emacs (Emacs_display.png). The Gedit display is the correct one.

Hmm.. on my system I see a display that is almost identical to what
your "Gedit" display shows.

CC'ing Handa-san who might be able to help us with verifying the
composition rules for Persian.  Or maybe this is a problem with the
shaping engine used on GNU/Linux?

In any case, disabling bidi reordering doesn't fix the display (it
makes the display much worse for me), so it is not the problem.