}
*x = top_x;
- *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
+ /* The condition below is a heuristic fix for the situation
+ where move_it_to stops just after finishing the display
+ of a fringe bitmap, which resets it.ascent to zero, and
+ thus causes Y to be offset by it.max_ascent. */
+ if (it.ascent == 0 && it.what == IT_IMAGE
+ && it.method != GET_FROM_IMAGE
+ && it.image_id < 0
+ && it.max_ascent > 0)
+ *y = max (top_y, window_top_y);
+ else
+ *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
*rtop = max (0, window_top_y - top_y);
*rbot = max (0, bottom_y - it.last_visible_y);
*rowh = max (0, (min (bottom_y, it.last_visible_y)
RESTORE_IT (&it2, &it2, it2data);
move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS);
*x = it2.current_x;
- *y = it2.current_y + it2.max_ascent - it2.ascent;
+ if (it2.ascent == 0 && it2.what == IT_IMAGE
+ && it2.method != GET_FROM_IMAGE
+ && it2.image_id < 0
+ && it2.max_ascent > 0)
+ *y = it2.current_y;
+ else
+ *y = it2.current_y + it2.max_ascent - it2.ascent;
*rtop = max (0, -it2.current_y);
*rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent)
- it.last_visible_y));