Mercurial > emacs
comparison src/xdisp.c @ 111420:6ce85d43dfda
xdisp.c: Add commentary about character compositions in bidirectional text.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 06 Nov 2010 20:19:32 +0200 |
parents | d53ee71e7e89 |
children | 381161c05d64 |
comparison
equal
deleted
inserted
replaced
111419:898b96cf89b3 | 111420:6ce85d43dfda |
---|---|
212 of appending it. When the glyph row is complete, the function | 212 of appending it. When the glyph row is complete, the function |
213 extend_face_to_end_of_line fills the empty space to the left of the | 213 extend_face_to_end_of_line fills the empty space to the left of the |
214 leftmost character with special glyphs, which will display as, | 214 leftmost character with special glyphs, which will display as, |
215 well, empty. On text terminals, these special glyphs are simply | 215 well, empty. On text terminals, these special glyphs are simply |
216 blank characters. On graphics terminals, there's a single stretch | 216 blank characters. On graphics terminals, there's a single stretch |
217 glyph with suitably computed width. Both the blanks and the | 217 glyph of a suitably computed width. Both the blanks and the |
218 stretch glyph are given the face of the background of the line. | 218 stretch glyph are given the face of the background of the line. |
219 This way, the terminal-specific back-end can still draw the glyphs | 219 This way, the terminal-specific back-end can still draw the glyphs |
220 left to right, even for R2L lines. | 220 left to right, even for R2L lines. |
221 | |
222 Bidirectional display and character compositions | |
223 | |
224 Some scripts cannot be displayed by drawing each character | |
225 individually, because adjacent characters change each other's shape | |
226 on display. For example, Arabic and Indic scripts belong to this | |
227 category. | |
228 | |
229 Emacs display supports this by providing "character compositions", | |
230 most of which is implemented in composite.c. During the buffer | |
231 scan that delivers characters to PRODUCE_GLYPHS, if the next | |
232 character to be delivered is a composed character, the iteration | |
233 calls composition_reseat_it and next_element_from_composition. If | |
234 they succeed to compose the character with one or more of the | |
235 following characters, the whole sequence of characters that where | |
236 composed is recorded in the `struct composition_it' object that is | |
237 part of the buffer iterator. The composed sequence could produce | |
238 one or more font glyphs (called "grapheme clusters") on the screen. | |
239 Each of these grapheme clusters is then delivered to PRODUCE_GLYPHS | |
240 in the direction corresponding to the current bidi scan direction | |
241 (recorded in the scan_dir member of the `struct bidi_it' object | |
242 that is part of the buffer iterator). In particular, if the bidi | |
243 iterator currently scans the buffer backwards, the grapheme | |
244 clusters are delivered back to front. This reorders the grapheme | |
245 clusters as appropriate for the current bidi context. Note that | |
246 this means that the grapheme clusters are always stored in the | |
247 LGSTRING object (see composite.c) in the logical order. | |
248 | |
249 Moving an iterator in bidirectional text | |
250 without producing glyphs | |
221 | 251 |
222 Note one important detail mentioned above: that the bidi reordering | 252 Note one important detail mentioned above: that the bidi reordering |
223 engine, driven by the iterator, produces characters in R2L rows | 253 engine, driven by the iterator, produces characters in R2L rows |
224 starting at the character that will be the rightmost on display. | 254 starting at the character that will be the rightmost on display. |
225 As far as the iterator is concerned, the geometry of such rows is | 255 As far as the iterator is concerned, the geometry of such rows is |