* Re: Crash using text property 'composite on w32
[not found] ` <87bqfl5g90.fsf@stupidchicken.com>
@ 2007-06-14 12:32 ` Kenichi Handa
2007-06-14 12:42 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 2+ messages in thread
From: Kenichi Handa @ 2007-06-14 12:32 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
In article <87bqfl5g90.fsf@stupidchicken.com>, Chong Yidong <cyd@stupidchicken.com> writes:
> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.bugs as well.
> "Juanma Barranquero" <lekktu@gmail.com> writes:
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x010c798a in run_composition_function (from=267, to=269, prop=520)
> > at composite.c:456
> > 456 func = COMPOSITION_MODIFICATION_FUNC (prop);
> > (gdb) bt
> > #0 0x010c798a in run_composition_function (from=267, to=269, prop=520)
> > at composite.c:456
> > #1 0x010c7d1c in update_compositions (from=269, to=271, check_mask=3)
> > at composite.c:514
> The trouble here is that the code expects the property `prop' obtained
> from find_composition to be a valid composition, which is a cons. So
> probably the way to fix this is to stick in a couple of
> COMPOSITION_VALID_P checks into update_compositions, around
> composite.c:514.
Thank you for finding this bug. You are right. I installed
a fix in the trunk. Anyway, composition property should not
be attached manually as this:
(let ((s "text"))
(put-text-property 0 2 'composition ?A s)
(insert s))
Instead, people should use compose-region or compose-string
as this:
(insert (compose-string "text" 0 2 ?A))
> The strange thing, though, is that the elisp manual describes the
> composition property as follows (documented by Handa on 2007-04-19):
> `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.
> Is this a mistake?
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'.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 2+ messages in thread