From: Chong Yidong Date: Mon, 8 Feb 2010 23:39:01 +0000 (-0500) Subject: * nsfont.m (nsfont_open): The system's value for the font descent X-Git-Tag: emacs-pretest-23.1.93~86 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=14a225f9c27fa8ea76a0fbee70c9a34dee474bb6;p=emacs.git * nsfont.m (nsfont_open): The system's value for the font descent is negative, so round it down to avoid clipping. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4837d8ecb06..6cf78dbe084 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-02-08 Francis Devereux + + * nsfont.m (nsfont_open): The system's value for the font descent + is negative, so round it down to avoid clipping. + 2010-02-06 Chong Yidong * charset.c (load_charset_map_from_file) diff --git a/src/nsfont.m b/src/nsfont.m index d5107f376dd..97d74a82f2b 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -844,8 +844,10 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) /* max bounds */ font_info->max_bounds.ascent = lrint (hshrink * [sfont ascender] + expand * hd/2); + /* [sfont descender] is usually negative. Use floor to avoid + clipping descenders. */ font_info->max_bounds.descent = - -lrint (hshrink* [sfont descender] - expand*hd/2); + -lrint (floor(hshrink* [sfont descender] - expand*hd/2)); font_info->height = font_info->max_bounds.ascent + font_info->max_bounds.descent; font_info->max_bounds.width = lrint (font_info->width); @@ -880,8 +882,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) #endif /* set up metrics portion of font struct */ - font->ascent = [sfont ascender]; - font->descent = -[sfont descender]; + font->ascent = lrint([sfont ascender]); + font->descent = -lrint(floor([sfont descender])); font->min_width = ns_char_width(sfont, '|'); font->space_width = lrint (ns_char_width (sfont, ' ')); font->average_width = lrint (font_info->width);