changeset 32160:0abb3c153331

(image_ascent): Rearrange ascent calculation for the has-a-font case.
author Miles Bader <miles@gnu.org>
date Thu, 05 Oct 2000 05:21:13 +0000
parents 37dfd66f0cd2
children 20ca10cf58b3
files src/xfns.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Thu Oct 05 02:48:41 2000 +0000
+++ b/src/xfns.c	Thu Oct 05 05:21:13 2000 +0000
@@ -5526,7 +5526,12 @@
   if (img->ascent == CENTERED_IMAGE_ASCENT)
     {
       if (face->font)
-	ascent = height / 2 - (face->font->descent - face->font->ascent) / 2;
+	/* This expression is arranged so that if the image can't be
+	   exactly centered, it will be moved slightly up.  This is
+	   because a typical font is `top-heavy' (due to the presence
+	   uppercase letters), so the image placement should err towards
+	   being top-heavy too.  It also just generally looks better.  */
+	ascent = (height + face->font->ascent - face->font->descent + 1) / 2;
       else
 	ascent = height / 2;
     }