From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.bugs Subject: bug#11860: 24.1; Arabic - Harakat (diacritics, short vowels) don't appear Date: Sun, 16 Sep 2012 21:03:25 +0900 Message-ID: <87k3vudvjm.fsf@gnu.org> References: <349071341393469@web30d.yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347797098 5397 80.91.229.3 (16 Sep 2012 12:04:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Sep 2012 12:04:58 +0000 (UTC) Cc: 11860@debbugs.gnu.org, smias@yandex.ru To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 16 14:05:01 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TDDav-0006YD-3R for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Sep 2012 14:05:01 +0200 Original-Received: from localhost ([::1]:49717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDDaq-0005mB-VZ for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Sep 2012 08:04:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDDap-0005m5-1C for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 08:04:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDDan-0000XB-Ub for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 08:04:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDDan-0000X7-RV for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 08:04:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TDDbt-0003Bf-Rb for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 08:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kenichi Handa Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Sep 2012 12:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11860 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11860-submit@debbugs.gnu.org id=B11860.134779714512227 (code B ref 11860); Sun, 16 Sep 2012 12:06:01 +0000 Original-Received: (at 11860) by debbugs.gnu.org; 16 Sep 2012 12:05:45 +0000 Original-Received: from localhost ([127.0.0.1]:36570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDDbd-0003B9-1J for submit@debbugs.gnu.org; Sun, 16 Sep 2012 08:05:45 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:35942) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDDbZ-0003Ay-KM for 11860@debbugs.gnu.org; Sun, 16 Sep 2012 08:05:42 -0400 Original-Received: from 253.240.accsnet.ne.jp ([202.220.240.253]:50175 helo=mongkok) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TDDaR-0006NY-KV; Sun, 16 Sep 2012 08:04:32 -0400 In-Reply-To: <87bohcty0r.fsf@gnu.org> (message from Kenichi Handa on Tue, 11 Sep 2012 23:49:40 +0900) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64416 Archived-At: In article <87bohcty0r.fsf@gnu.org>, Kenichi Handa writes: > I'll try to fix Ffont_shape_gstring, and check whether or > not it breaks rendersing of some scripts. I've just installed this change. With this change, I tried to render several scripts that require CTL (complex text layout) while setting a breakpoint at this line: shaper_error: return Qnil; but, Emacs has never reach that line on GNU/Linux system (i.e. with m17n-lib and libotf). --- Kenichi Handa handa@gnu.org === modified file 'src/font.c' --- src/font.c 2012-09-15 07:06:56 +0000 +++ src/font.c 2012-09-16 11:47:45 +0000 @@ -4295,7 +4295,10 @@ header of the glyph-string. If the shaping was successful, the value is GSTRING itself or a newly -created glyph-string. Otherwise, the value is nil. */) +created glyph-string. Otherwise, the value is nil. + +See the documentation of `composition-get-gstring' for the format of +GSTRING. */) (Lisp_Object gstring) { struct font *font; @@ -4326,44 +4329,45 @@ if (XINT (n) < LGSTRING_GLYPH_LEN (gstring)) LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil); + /* Check FROM_IDX and TO_IDX of each GLYPH in GSTRING to assure that + GLYPHS covers all characters in GSTRING. More formally, provided + that NCHARS is the number of characters in GSTRING, N is the + number of glyphs, and GLYPHS[i] is the ith glyph, FROM_IDX and + TO_IDX of each glyph must satisfy these conditions: + + GLYPHS[0].FROM_IDX == 0 + GLYPHS[i].FROM_IDX <= GLYPHS[i].TO_IDX + if (GLYPHS[i].FROM_IDX == GLYPHS[i-1].FROM_IDX) + ;; GLYPHS[i] and GLYPHS[i-1] belongs to the same grapheme cluster + GLYPHS[i].TO_IDX == GLYPHS[i-1].TO_IDX + else + ;; Be sure to cover all characters. + GLYPHS[i].FROM_IDX == GLYPHS[i-1].TO_IDX + 1 + GLYPHS[N-1].TO_IDX == NCHARS - 1 */ glyph = LGSTRING_GLYPH (gstring, 0); from = LGLYPH_FROM (glyph); to = LGLYPH_TO (glyph); - for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) + if (from != 0 || to < from) + goto shaper_error; + for (i = 1; i < LGSTRING_GLYPH_LEN (gstring); i++) { - Lisp_Object this = LGSTRING_GLYPH (gstring, i); - - if (NILP (this)) + glyph = LGSTRING_GLYPH (gstring, i); + if (NILP (glyph)) break; - if (NILP (LGLYPH_ADJUSTMENT (this))) - { - if (j < i - 1) - for (; j < i; j++) - { - glyph = LGSTRING_GLYPH (gstring, j); - LGLYPH_SET_FROM (glyph, from); - LGLYPH_SET_TO (glyph, to); - } - from = LGLYPH_FROM (this); - to = LGLYPH_TO (this); - j = i; - } - else - { - if (from > LGLYPH_FROM (this)) - from = LGLYPH_FROM (this); - if (to < LGLYPH_TO (this)) - to = LGLYPH_TO (this); - } + if (! (LGLYPH_FROM (glyph) <= LGLYPH_TO (glyph) + && (LGLYPH_FROM (glyph) == from + ? LGLYPH_TO (glyph) == to + : LGLYPH_FROM (glyph) == to + 1))) + goto shaper_error; + from = LGLYPH_FROM (glyph); + to = LGLYPH_TO (glyph); } - if (j < i - 1) - for (; j < i; j++) - { - glyph = LGSTRING_GLYPH (gstring, j); - LGLYPH_SET_FROM (glyph, from); - LGLYPH_SET_TO (glyph, to); - } + if (to != LGSTRING_CHAR_LEN (gstring) - 1) + goto shaper_error; return composition_gstring_put_cache (gstring, XINT (n)); + + shaper_error: + return Qnil; } DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs,