: font->average_width ? font->average_width
: font->space_width ? font->space_width
: 1);
- height = (font->height ? font->height : 1);
+
+ int font_ascent, font_descent;
+ get_font_ascent_descent (font, &font_ascent, &font_descent);
+ height = font_ascent + font_descent;
+ if (height <= 0)
+ height = 1;
#ifdef HAVE_WINDOW_SYSTEM
FRAME_DISPLAY_INFO (f)->n_fonts++;
if (FRAME_DISPLAY_INFO (f)->n_fonts == 1)
x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
{
struct font *font = XFONT_OBJECT (font_object);
- int unit;
+ int unit, font_ascent, font_descent;
if (fontset < 0)
fontset = fontset_from_font (font_object);
FRAME_FONT (f) = font;
FRAME_BASELINE_OFFSET (f) = font->baseline_offset;
FRAME_COLUMN_WIDTH (f) = unit = font->average_width;
- FRAME_LINE_HEIGHT (f) = font->height;
+ get_font_ascent_descent (font, &font_ascent, &font_descent);
+ FRAME_LINE_HEIGHT (f) = font_ascent + font_descent;
/* Compute number of scrollbar columns. */
unit = FRAME_COLUMN_WIDTH (f);
it->nglyphs = 1;
}
}
+
+ if (FONT_TOO_HIGH (font))
+ {
+ int font_ascent, font_descent;
+
+ /* For very large fonts, where we ignore the declared font
+ dimensions, and go by per-character metrics instead,
+ don't let the row ascent and descent values (and the row
+ height computed from them) be smaller than the "normal"
+ character metrics. This avoids unpleasant effects
+ whereby lines on display would change their heigh
+ depending on which characters are shown. */
+ normal_char_ascent_descent (font, -1, &font_ascent, &font_descent);
+ it->max_ascent = max (it->max_ascent, font_ascent);
+ it->max_descent = max (it->max_descent, font_descent);
+ }
}
else if (it->what == IT_COMPOSITION && it->cmp_it.ch < 0)
{
x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
{
struct font *font = XFONT_OBJECT (font_object);
- int unit;
+ int unit, font_ascent, font_descent;
if (fontset < 0)
fontset = fontset_from_font (font_object);
FRAME_FONT (f) = font;
FRAME_BASELINE_OFFSET (f) = font->baseline_offset;
FRAME_COLUMN_WIDTH (f) = font->average_width;
- FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (font);
+ get_font_ascent_descent (font, &font_ascent, &font_descent);
+ FRAME_LINE_HEIGHT (f) = font_ascent + font_descent;
#ifndef USE_X_TOOLKIT
FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);