Subject: Re: bug#5977: 24.0.50; Lao HELLO is incorrectly displayed

From: Kenichi Handa <[email-masked]>
Date: Wed, 21 Apr 2010 11:32:58 +0900

Sorry for the late response on this matter.

In article <[email-masked]>, Eli Zaretskii <[email-masked]> writes:

> Anyway, the problem is known: Lao (as well as quite a few other
> scripts and display features in Emacs) use character compositions,
> and the bidi display does not yet handle composed characters
> correctly.  I need Handa-san's help in figuring out how to make
> compositions work with bidi display, because I lack the necessary
> knowledge of how support for character compositions is designed and
> implemented, and the code is not documented enough, at least not for
> me, to figure that out on my own.

I've been using the branch for 23.2.  I've just build the
trunk code on GNU/Linus, and found that all characters
displayed by composition are incorrect.  But, at the moment,
I don't have a time to work on the trunk.

Here's a brief explanation about control flow.

At first, composition_compute_stop_pos is called in
compute_stop_pos and reseat_to_string to record where to
stop for composition handling in this member
     struct composition_it cmp_it;
of struct it.

Next, next_element_from_string and next_element_from_buffer
calls the macro CHAR_COMPOSED_P to check if the next element
should be composed.  CHAR_COMPOSED_P calls
composition_reseat_it which is the function to compose
character(s) and build a LGSTRING (lispy glyph string) that
carries all information about how to display that character
sequence (glyph-ids of a font, relative position, etc).
When a LGSTRING is built, it's cached and the ID of the
cached data is recorded in cmp_it (see above).

If composition_reseat_it successfully built a LGSTRING,
next_element_from_string and next_element_from_buffer call
next_element_from_composition.

next_element_from_composition sets it->what to
IT_COMPOSITION and setups it->cmp_it so that
x_draw_composite_glyph_string_foreground (called in
x_draw_glyph_string) can draw actual composition glyph(s).

---
Kenichi Handa
[email-masked]