/* Return true iff a character at CHARPOS (and BYTEPOS) is composed
- (possibly with the following characters). */
+ (possibly with the following characters).
+
+ Note: we pass -1 as the "resolved bidi level" when the iterator
+ doesn't have the bidi_p flag set, because in that case we really
+ don't know what is the directionality of the text, so we leave it to
+ the shaping engine to figure that out. */
#define CHAR_COMPOSED_P(IT,CHARPOS,BYTEPOS,END_CHARPOS) \
((IT)->cmp_it.id >= 0 \
|| ((IT)->cmp_it.stop_pos == (CHARPOS) \
&& composition_reseat_it (&(IT)->cmp_it, CHARPOS, BYTEPOS, \
END_CHARPOS, (IT)->w, \
- (IT)->bidi_it.resolved_level, \
+ (IT)->bidi_p \
+ ? (IT)->bidi_it.resolved_level \
+ : -1, \
FACE_FROM_ID_OR_NULL ((IT)->f, \
(IT)->face_id), \
(IT)->string)))