Fix display when a font claims large values of ascent and descent
commitf1baa156503f089d6627171e0e9ad73bbdbb7268
authorEli Zaretskii <eliz@gnu.org>
Sat, 6 Jun 2015 12:55:15 +0000 (6 15:55 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 6 Jun 2015 13:10:19 +0000 (6 16:10 +0300)
tree30f6860253e0cbd4c463cc163e24627e8dfc9bb6
parent6f10a3f90fb94506031712140246f1a5dbee71eb
parent957cbfd7650e6ebd1afc62daeb5f6923730112c9
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.
src/composite.c
src/font.c
src/xdisp.c
src/xterm.c