Continue working on display of R2L glyph rows. Reverse glyphs in
term.c:append_glyph rather than in extend_face_to_end_of_line.
Fix bidi iteration near BEGV and ZV.
dispextern.h (struct glyph): New members resolved_level and
bidi_type.
xdisp.c (append_glyph, append_composite_glyph)
(produce_image_glyph, append_stretch_glyph): Set them.
term.c (append_glyph): Ditto.
xdisp.c (display_line, next_element_from_buffer): Set the glyph
row's reversed_p flag if the paragraph base direction is odd.
(extend_face_to_end_of_line): Don't reverse the glyphs here.
term.c (append_glyph): Reverse glyphs here.
bidi.c (bidi_get_next_char_visually): Don't exit early when at ZV.
(bidi_paragraph_init): Don't step over a newline if at BEGV.
(bidi_paragraph_init): Handle empty buffers.