diff options
| author | Miles Bader | 2000-10-05 05:21:13 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-10-05 05:21:13 +0000 |
| commit | 3694cb3fdecea0dda1b72429df36f1a6eef197d1 (patch) | |
| tree | 15241f394e280273b0debdbcddc732b13e46cafb /src | |
| parent | 3478046b5a77d90186d35e66613d4cfa89801fe3 (diff) | |
| download | emacs-3694cb3fdecea0dda1b72429df36f1a6eef197d1.tar.gz emacs-3694cb3fdecea0dda1b72429df36f1a6eef197d1.zip | |
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xfns.c b/src/xfns.c index 457ceb202c7..370ce8825d7 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5526,7 +5526,12 @@ image_ascent (img, face) | |||
| 5526 | if (img->ascent == CENTERED_IMAGE_ASCENT) | 5526 | if (img->ascent == CENTERED_IMAGE_ASCENT) |
| 5527 | { | 5527 | { |
| 5528 | if (face->font) | 5528 | if (face->font) |
| 5529 | ascent = height / 2 - (face->font->descent - face->font->ascent) / 2; | 5529 | /* This expression is arranged so that if the image can't be |
| 5530 | exactly centered, it will be moved slightly up. This is | ||
| 5531 | because a typical font is `top-heavy' (due to the presence | ||
| 5532 | uppercase letters), so the image placement should err towards | ||
| 5533 | being top-heavy too. It also just generally looks better. */ | ||
| 5534 | ascent = (height + face->font->ascent - face->font->descent + 1) / 2; | ||
| 5530 | else | 5535 | else |
| 5531 | ascent = height / 2; | 5536 | ascent = height / 2; |
| 5532 | } | 5537 | } |