From: Francis Devereux <francis@devrx.org>
To: 3975@emacsbugs.donarmstrong.com
Subject: bug#3975: 23.1; [PATCH] Line height too small with Monaco font on Mac OS X
Date: Thu, 30 Jul 2009 23:57:49 +0100 [thread overview]
Message-ID: <F8986DD6-E3EE-4F26-A5FB-9221827901BA@devrx.org> (raw)
In-Reply-To: <handler.3975.B.124894575813167.ack@emacsbugs.donarmstrong.com>
I have done some investigating into this bug and found a fix. The
problem was being caused by [sfont descender] returning -2.5, which
was being rounded to -2 by the lrint on line 807 of nsfont.c:
-lrint (hshrink* [sfont descender] - expand*hd/2);
The following patch fixes the problem:
--- src/nsfont.m~ 2009-07-30 00:39:40.000000000 +0100
+++ src/nsfont.m 2009-07-30 23:41:56.000000000 +0100
@@ -803,8 +803,11 @@
/* max bounds */
font_info->max_bounds.ascent =
lrint (hshrink * [sfont ascender] + expand * hd/2);
+ /* [sfont descender] is usually negative, so we use floor to round
+ towards the integer with the greater magnitude so that we
don't clip
+ any 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);
@@ -839,8 +842,8 @@
#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 = [sfont widthOfString: @"|"]; /* FIXME */
font->space_width = lrint (ns_char_width (sfont, ' '));
font->average_width = lrint (font_info->width);
The second hunk does not actually seem to be necessary, but I added it
for consistency.
I think that this patch may also fix bug 3961 (Incorrect font height
on Mac OS X).
Francis
next prev parent reply other threads:[~2009-07-30 22:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-08 11:10 Line height too small with Monaco font on Mac OS X Francis Devereux
2010-02-08 20:16 ` Leo
2010-02-08 23:43 ` bug#3975: " Chong Yidong
2009-07-30 9:22 ` bug#3975: 23.1; " Francis Devereux
[not found] ` <handler.3975.B.124894575813167.ack@emacsbugs.donarmstrong.com>
2009-07-30 22:57 ` Francis Devereux [this message]
2010-02-09 2:28 ` bug#3975: " Leo
2010-02-08 23:43 ` Chong Yidong
2010-02-11 13:45 ` bug#3975: " Francis Devereux
2010-02-11 13:45 ` Francis Devereux
2010-02-08 21:15 ` David Reitter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F8986DD6-E3EE-4F26-A5FB-9221827901BA@devrx.org \
--to=francis@devrx.org \
--cc=3975@emacsbugs.donarmstrong.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.