From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bidi,gmane.emacs.devel Subject: Re: Arabic support Date: Sat, 04 Sep 2010 10:13:47 +0300 Message-ID: <83d3suhtg4.fsf@gnu.org> References: <83bp8oml9c.fsf@gnu.org> <83pqwvhsbm.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1283584338 6330 80.91.229.12 (4 Sep 2010 07:12:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2010 07:12:18 +0000 (UTC) Cc: emacs-bidi@gnu.org, jasonr@gnu.org, emacs-devel@gnu.org To: handa@m17n.org Original-X-From: emacs-bidi-bounces+gnu-emacs-bidi=m.gmane.org@gnu.org Sat Sep 04 09:12:17 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 1Ormv7-0001nb-5C for gnu-emacs-bidi@m.gmane.org; Sat, 04 Sep 2010 09:12:13 +0200 Original-Received: from localhost ([127.0.0.1]:40701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ormv6-0004CV-F9 for gnu-emacs-bidi@m.gmane.org; Sat, 04 Sep 2010 03:12:12 -0400 Original-Received: from [140.186.70.92] (port=38627 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ormv1-0004CP-Ig for emacs-bidi@gnu.org; Sat, 04 Sep 2010 03:12:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ormv0-000267-CX for emacs-bidi@gnu.org; Sat, 04 Sep 2010 03:12:07 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:65124) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ormv0-00025r-6A; Sat, 04 Sep 2010 03:12:06 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0L8700900NRNFA00@a-mtaout22.012.net.il>; Sat, 04 Sep 2010 10:11:46 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.126.202.93]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L870098XNZKC220@a-mtaout22.012.net.il>; Sat, 04 Sep 2010 10:11:46 +0300 (IDT) In-reply-to: <83pqwvhsbm.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:818 gmane.emacs.devel:129665 Archived-At: > Date: Fri, 03 Sep 2010 16:25:49 +0300 > From: Eli Zaretskii > Cc: emacs-bidi@gnu.org, emacs-devel@gnu.org, jasonr@gnu.org > > Am I missing something? I think I found what I was missing. This part: > 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 glyph row as a single element of type IT_COMPOSITION. > This single element is expanded into the actual font glyphs when the > glyph row is drawn by the terminal-specific draw_glyphs method. The > bidi reordering treats this single element as if it were a single > glyph, and thus does not reorder its font glyphs. So this single > element winds up in the glyph row in the position corresponding to the > first character of the composed sequence. 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, 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?