summaryrefslogtreecommitdiff
path: root/src/composite.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-06-06 15:55:15 +0300
committerEli Zaretskii <eliz@gnu.org>2015-06-06 16:10:19 +0300
commitf1baa156503f089d6627171e0e9ad73bbdbb7268 (patch)
tree30f6860253e0cbd4c463cc163e24627e8dfc9bb6 /src/composite.c
parent6f10a3f90fb94506031712140246f1a5dbee71eb (diff)
parent957cbfd7650e6ebd1afc62daeb5f6923730112c9 (diff)
downloademacs-f1baa156503f089d6627171e0e9ad73bbdbb7268.tar.gz
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.
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/composite.c b/src/composite.c
index 1c9c62bf910..1c18165599d 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -732,9 +732,11 @@ composition_gstring_width (Lisp_Object gstring, ptrdiff_t from, ptrdiff_t to,
if (FONT_OBJECT_P (font_object))
{
struct font *font = XFONT_OBJECT (font_object);
+ int font_ascent, font_descent;
- metrics->ascent = font->ascent;
- metrics->descent = font->descent;
+ get_font_ascent_descent (font, &font_ascent, &font_descent);
+ metrics->ascent = font_ascent;
+ metrics->descent = font_descent;
}
else
{