Fix display when a font claims large values of ascent and descent
This fixes bug#20628.
* src/xdisp.c (get_phys_cursor_geometry): Correct the Y
coordinate of a hollow cursor glyph when the original glyph's
ascent is too small.
(get_font_ascent_descent, normal_char_ascent_descent)
(normal_char_height): New functions.
(handle_single_display_spec, append_space_for_newline)
(calc_pixel_width_or_height, produce_stretch_glyph)
(calc_line_height_property): Use normal_char_ascent_descent and
normal_char_height.
(x_produce_glyphs): When font-global values of ascent and descent
are too large, use per-character glyph metrics instead, if
possible. But don't allow the glyph row's ascent and descent
values become smaller than the values from the metrics of the
font's "normal" character.
* src/xftfont.c (xftfont_draw):
* src/w32font.c (w32font_draw): Correct the values of ascent and
descent used to draw glyphless characters' hex code in a box.
* src/xterm.c (x_draw_glyph_string_background):
* src/xdisp.c (x_produce_glyphs):
* src/w32term.c (x_draw_glyph_string_background):
* src/nsterm.m (ns_maybe_dumpglyphs_background): Use FONT_TOO_HIGH
to detect fonts whose global ascent and descent values are too
large to be used in layout decision, and redraw the background
when that happens.
* src/dispextern.h (FONT_TOO_HIGH): New macro.
(get_font_ascent_descent): Add prototype.
* src/xterm.c (x_new_font):
* src/w32term.c (x_new_font):
* src/nsterm.m (x_new_font):
* src/font.c (font_open_entity):
* src/composite.c (composition_gstring_width): Use
get_font_ascent_descent to obtain reasonable values for ascent and
descent of a font.