From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: composition text property Date: Tue, 26 Jun 2007 10:32:57 +0900 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1182821589 12677 80.91.229.12 (26 Jun 2007 01:33:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 26 Jun 2007 01:33:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 26 03:33:08 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I2zvY-0003yq-0t for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2007 03:33:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I2zvX-0005S1-It for ged-emacs-devel@m.gmane.org; Mon, 25 Jun 2007 21:33:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I2zvV-0005Rm-AX for emacs-devel@gnu.org; Mon, 25 Jun 2007 21:33:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I2zvU-0005RN-Bh for emacs-devel@gnu.org; Mon, 25 Jun 2007 21:33:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I2zvU-0005RK-9R for emacs-devel@gnu.org; Mon, 25 Jun 2007 21:33:04 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I2zvT-0002tA-Kf for emacs-devel@gnu.org; Mon, 25 Jun 2007 21:33:04 -0400 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id l5Q1WwAP022094; Tue, 26 Jun 2007 10:32:58 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp3.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id l5Q1WwC7001392; Tue, 26 Jun 2007 10:32:58 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp3.aist.go.jp with ESMTP id l5Q1Wvd0000820; Tue, 26 Jun 2007 10:32:57 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.67) (envelope-from ) id 1I2zvN-0001oF-CL; Tue, 26 Jun 2007 10:32:57 +0900 In-reply-to: User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:73871 Archived-At: In article , "Drew Adams" writes: > Trying again - got no reply. Anybody know about the `composition' property? Sorry for not responding. I've thought that I already replied, but it was in the different thread. > > From: Drew Adams Sent: Wednesday, May 30, 2007 9:09 AM > > From the Elisp manual, node Special Properties, `composition': > > > > This text property is used to display a sequence of characters as a > > single glyph composed from components. For instance, in Thai a > > base consonant is composed with the following combining vowel as a > > single glyph. The value should be a character or a sequence > > (vector, list, or string) of integers. > > > > * If it is a character, it means to display that character > > instead of the text in the region. > > > > * If it is a string, it means to display that string's contents > > instead of the text in the region. > > > > * If it is a vector or list, the elements are characters > > interleaved with internal codes specifying how to compose the > > following character with the previous one. In the thread of "Crash using text property 'composite on w32", I wrote: > Yes. The above description is for the argument COMPONENTS > of the function `compose-region', or for just a part of the > property value. The value has this form: > > The property value has this form when the composition is made: > ((LENGTH . COMPONENTS) . MODIFICATION-FUNC) > then turns to this form: > (COMPOSITION-ID . (LENGTH COMPONENTS-VEC . MODIFICATION-FUNC)) > when the composition is registered in composition_hash_table and > composition_table. These rather peculiar structures were designed > to make it easy to distinguish them quickly (we can do that by > checking only the first element) and to extract LENGTH (from the > former form) and COMPOSITION-ID (from the latter form). > [...] > > The detail is described in the header comment of > src/composite.c. How much detail, do you think, we should > describe in Info? > > Isn't it enough to say just as below? > > The value should be a cons of special structure. It should > be manipulated only by the functions `compose-region', > `compose-string' and `find-composition'. So, > > I must be misunderstanding this - perhaps someone can explain. I try this: > > > > (put-text-property > > (point) (1+ (point)) > > 'composition "Hi there!") > > This must be: (compose-region (point) (1+ (point)) '(H? (Br . Bl) ?i (Br . Bl) ?\s (Br . Bl) .........")) But in this case, you should simply use display property. > > I expected to see "Hi there!" displayed in place of the character before > > point ("display that strings contents instead of the text..."). Instead, I > > see no visible change. `C-u C-x =' shows that the composition property was > > applied. I also tried applying the property this way to several > > consecutive > > characters (expecting to see "Hi there!" in place of each), but with no > > visible change. > > > > I also tried looking at Emacs source code that uses this property, but I > > didn't find much, and what I found didn't enlighten me. > > > > What am I missing? Thx. > > > > BTW, should the text really be speaking of "the region" here? I tried with > > and without an active region, with no visible change. I suspect that this > > has nothing to do with the region, and I'd file a bug, but I don't yet > > understand this text (obviously). Shouldn't "the region" be "the > > characters > > with property `composition'"? > > > > Also, the illustration of Thai doesn't help (me) much. How about a code > > example, showing how `composition' can be used to compose a Thai consonant > > and its following vowel, forming a single glyph? Composition is not a text property to play around by direct manipulation. It is more internal to Emacs, and only text layouting program (e.g. thai-composition-function, tibetan-composition-function) should use. I'll improve the documentaion soon. --- Kenichi Handa handa@m17n.org