From: David Reitter <david.reitter@gmail.com>
To: Francis Devereux <francis@devrx.org>,
Chong Yidong <cyd@stupidchicken.com>
Cc: "emacs-devel@gnu.org discussions" <emacs-devel@gnu.org>
Subject: Re: Line height too small with Monaco font on Mac OS X
Date: Mon, 8 Feb 2010 16:15:19 -0500 [thread overview]
Message-ID: <D41B5BE6-2BD5-431E-9167-E211D2667E30@gmail.com> (raw)
In-Reply-To: <256A1330-5C0B-4F54-926E-83C95923067D@devrx.org>
[-- Attachment #1.1: Type: text/plain, Size: 628 bytes --]
Francis,
On Feb 8, 2010, at 6:10 AM, Francis Devereux wrote:
> Could someone have a look at the patch I added to http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3975 and apply it if it looks OK?
This looks good to me. It doesn't affect other font sizes (at least not Monaco 13). Thanks for fixing this problem.
I've reformatted it a little for coding style - see attached.
Could someone with a bzr setup commit this by any chance?
2010-02-08 Francis Devereux <francis@devrx.org>
* nsfont.m (nsfont_open): Round descender dimension
towards greater height as to not cause clipping
(Bug #3975).
[-- Attachment #1.2: lineheight.patch --]
[-- Type: application/octet-stream, Size: 1383 bytes --]
diff --git a/src/nsfont.m b/src/nsfont.m
index d5107f3..6b258ce 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -844,8 +844,11 @@ 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, 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);
@@ -878,10 +881,9 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
font_info->cgfont = CGFontCreateWithPlatformFont ((void*)&atsFont);
}
#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);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 203 bytes --]
prev parent reply other threads:[~2010-02-08 21:15 UTC|newest]
Thread overview: 5+ 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 ` Chong Yidong
2010-02-11 13:45 ` Francis Devereux
2010-02-08 21:15 ` David Reitter [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D41B5BE6-2BD5-431E-9167-E211D2667E30@gmail.com \
--to=david.reitter@gmail.com \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=francis@devrx.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).