aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfns.c
diff options
context:
space:
mode:
authorMiles Bader <[email protected]>2000-10-05 05:21:13 +0000
committerMiles Bader <[email protected]>2000-10-05 05:21:13 +0000
commit3694cb3fdecea0dda1b72429df36f1a6eef197d1 (patch)
tree15241f394e280273b0debdbcddc732b13e46cafb /src/xfns.c
parent3478046b5a77d90186d35e66613d4cfa89801fe3 (diff)
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Diffstat (limited to 'src/xfns.c')
-rw-r--r--src/xfns.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 457ceb202c..370ce8825d 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5526,7 +5526,12 @@ image_ascent (img, face)
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;
}