From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: handa Newsgroups: gmane.emacs.bugs Subject: bug#28339: 25.2; Emacs shows ZWNJ character (Zero Width non-Joiner) as Space Date: Mon, 11 Sep 2017 08:08:08 +0900 Message-ID: <87wp56kv8n.fsf@gnu.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1505084961 15954 195.159.176.226 (10 Sep 2017 23:09:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Sep 2017 23:09:21 +0000 (UTC) Cc: 28339@debbugs.gnu.org To: Nima Aryan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 11 01:09:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drBLh-0003dJ-SS for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Sep 2017 01:09:09 +0200 Original-Received: from localhost ([::1]:54574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drBLp-0007U5-2P for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Sep 2017 19:09:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drBLf-0007SP-HC for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 19:09:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drBLa-0005Dr-E8 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 19:09:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1drBLa-0005Dl-AH for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 19:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1drBLa-0004Qr-4e for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 19:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: handa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Sep 2017 23:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28339 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28339-submit@debbugs.gnu.org id=B28339.150508491617004 (code B ref 28339); Sun, 10 Sep 2017 23:09:02 +0000 Original-Received: (at 28339) by debbugs.gnu.org; 10 Sep 2017 23:08:36 +0000 Original-Received: from localhost ([127.0.0.1]:59942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drBL8-0004QA-OI for submit@debbugs.gnu.org; Sun, 10 Sep 2017 19:08:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drBL7-0004Py-E4 for 28339@debbugs.gnu.org; Sun, 10 Sep 2017 19:08:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drBL1-0004pC-8j for 28339@debbugs.gnu.org; Sun, 10 Sep 2017 19:08:28 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drBKs-0004lh-KC; Sun, 10 Sep 2017 19:08:18 -0400 Original-Received: from fl1-119-240-89-46.iba.mesh.ad.jp ([119.240.89.46]:52224 helo=shatin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1drBKr-00071B-VK; Sun, 10 Sep 2017 19:08:18 -0400 Original-Received: from handa by shatin with local (Exim 4.86_2) (envelope-from ) id 1drBKi-0007o6-DQ; Mon, 11 Sep 2017 08:08:08 +0900 In-Reply-To: (message from Nima Aryan on Thu, 07 Sep 2017 11:25:18 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136753 Archived-At: --=-=-= Content-Type: text/plain Hi, 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. --- K. Handa handa@gnu.org --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=arabic-shape.el Content-Transfer-Encoding: quoted-printable (defun arabic-font-shape-gstring (gstring) (setq gstring (font-shape-gstring gstring)) (dotimes (i (lgstring-glyph-len gstring)) (let ((glyph (lgstring-glyph gstring i))) (if (eq (lglyph-char glyph) #x200c) (let ((lbearing (lglyph-lbearing glyph)) (rbearing (lglyph-rbearing glyph)) (xoff nil)) (if (> (/ (+ rbearing lbearing) 2) 1) (setq xoff (- (/ (+ rbearing lbearing) 2)))) (lglyph-set-adjustment glyph xoff nil 1)))) gstring)) (set-char-table-range composition-function-table '(#x600 . #x74F) (list (vector "[\u0600-\u074F\u200C\u200D]+" 0 'arabic-font-shape-gstring) (vector "[\u200C\u200D][\u0600-\u074F\u200C\u200D]+" 1 'arabic-font-shape-gstring))) --=-=-=--