Subject: bug#28339: 25.2; Emacs shows ZWNJ character (Zero Width non-Joiner) as Space

From: Eli Zaretskii <[email-masked]>
Date: Mon, 11 Sep 2017 19:19:43 +0300

> From: handa <[email-masked]>
> Cc: [email-masked], [email-masked]
> Date: Mon, 11 Sep 2017 08:08:08 +0900
> 
> I found why Emacs shows ZWNJ with space.
> Emacs on GNU/Linux renders ZWNJ (unless it is absorbed by a rendering
> engine) with a glyph defined in a font.  As Vazir Code (and Dejavu Sans)
> defines a spacing glyph for ZWNJ, Emacs displays a space.  As Courier New
> defines a vertical bar glyph for ZWNJ, Emacs displays a vertivcal bar.
> And as Freeserif defines a zero-width glyph, Emacs displays a 1-dot
> width space.
> 
> So, please try this:
> 
> At first, load the attached code to tell Emacs that a glyph of ZWNJ have
> 1-dot width.
> 
> Then, tell Emacs to use the same font for Arabic and ZWNJ as this;
> 
> (let ((spec (font-spec :family "Vazir Code")))
>   (set-fontset-font nil 'arabic spec)
>   (set-fontset-font nil #x200c spec))
> 
> One problem with this solution is that if a font has some actual glyph
>  (e.g. vertical bar as Courier New), that bar is anyway displayed.

Thanks.

What is the significance of using the same font for ZWNJ in this case?

And why do we need to tell Emacs that ZWNJ has a 1-pixel width?
Should ZWNJ be at all displayed in this case?