From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.bidi,gmane.emacs.devel Subject: Re: Arabic support Date: Mon, 06 Sep 2010 15:04:46 +0900 Message-ID: References: <83bp8oml9c.fsf@gnu.org> <83pqwvhsbm.fsf@gnu.org> <83d3suhtg4.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1283753110 14014 80.91.229.12 (6 Sep 2010 06:05:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Sep 2010 06:05:10 +0000 (UTC) Cc: emacs-bidi@gnu.org, jasonr@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-bidi-bounces+gnu-emacs-bidi=m.gmane.org@gnu.org Mon Sep 06 08:05:09 2010 Return-path: Envelope-to: gnu-emacs-bidi@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OsUpI-0002vN-Rb for gnu-emacs-bidi@m.gmane.org; Mon, 06 Sep 2010 08:05:09 +0200 Original-Received: from localhost ([127.0.0.1]:37377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OsUpH-0007CO-Uv for gnu-emacs-bidi@m.gmane.org; Mon, 06 Sep 2010 02:05:08 -0400 Original-Received: from [140.186.70.92] (port=44603 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OsUpA-00079k-8G for emacs-bidi@gnu.org; Mon, 06 Sep 2010 02:05:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OsUp5-00033X-Vz for emacs-bidi@gnu.org; Mon, 06 Sep 2010 02:05:00 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:60907) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OsUp1-00032u-2l; Mon, 06 Sep 2010 02:04:51 -0400 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id o8664lT9008113; Mon, 6 Sep 2010 15:04:47 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp2.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id o8664k9u008473; Mon, 6 Sep 2010 15:04:46 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp2.aist.go.jp with ESMTP id o8664kZx003073; Mon, 6 Sep 2010 15:04:46 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken with local (Exim 4.71) (envelope-from ) id 1OsUow-0008AK-GC; Mon, 06 Sep 2010 15:04:46 +0900 In-Reply-To: <83d3suhtg4.fsf@gnu.org> (message from Eli Zaretskii on Sat, 04 Sep 2010 10:13:47 +0300) X-detected-operating-system: by eggs.gnu.org: Solaris 9 X-BeenThere: emacs-bidi@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of Emacs support for multi-directional text." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-bidi-bounces+gnu-emacs-bidi=m.gmane.org@gnu.org Errors-To: emacs-bidi-bounces+gnu-emacs-bidi=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bidi:820 gmane.emacs.devel:129702 Archived-At: In article <83d3suhtg4.fsf@gnu.org>, Eli Zaretskii writes: > I think I found what I was missing. This part: [...] > is inaccurate, and therefore leads to incorrect conclusions. A > (hopefully) more correct description is this: > During the buffer scan that delivers characters to PRODUCE_GLYPHS, > if the next character to be delivered is a composed character, then > composition_reseat_it and next_element_from_composition are called. > If they succeed to compose the character with one or more following > characters, the whole sequence of characters that where composed is > recorded in the `struct composition_it' object that is part of the > buffer iterator. The composed sequence could produce one or more > font glyphs (called "grapheme clusters") on the screen. Each of > these grapheme clusters is then delivered to PRODUCE_GLYPHS in the > direction corresponding to the current bidi scan direction. In > particular, if the bidi iterator currently scans the buffer > backwards, the grapheme clusters are delivered back to front. This > reorders the grapheme clusters as appropriate for the current bidi > context. > If this is correct, Yes. > then the conclusion is that the font driver's > `shape' method should return the grapheme clusters in LGSTRING in > logical order; they will be reordered correctly by > next_element_from_composition, composition_reseat_it, and > set_iterator_to_next, as described above. > Did I get it right this time? Yes. One additional comment. A grapheme cluster in LGSTRING may contain multiple glyphs, and the order of those glyphs depends on a font backend, or even on a font, and are given to `draw' method of a font backend without reordering. It's the responsibility of 'shape' method to produce those glyphs in the order that 'draw' method expects. For instance, if LGSTRING has these LGLYPHS in this order: G0: (glyph for a char at position N) G1: (first glyph for chars at position N+1 to N+2) G2: (second glyph for chars at position N+1 to N+2) G3: (first glyph for chars at position N+3 to N+4) G4: (second glyph for chars at position N+3 to N+4) G5: (third glyph for chars at position N+3 to N+4) G6: (glyph for a char at position N+5) and we are producing glyphs backward, 'draw' method is given glyphs in this order: glyphs from G6 to G6 (both inclusive) glyphs from G3 to G5 (both inclusive) glyphs from G1 to G2 (both inclusive) glyphs from G0 to G0 (both inclusive) --- Kenichi Handa handa@m17n.org