From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Francis Devereux Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <21E71ACF-2CE4-4637-9EF8-71060D547653@devrx.org> Reply-To: Francis Devereux , 3975@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v935.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1248997995 31219 80.91.229.12 (30 Jul 2009 23:53:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Jul 2009 23:53:15 +0000 (UTC) To: 3975@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 31 01:53:08 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MWfQo-0003I2-Qa for geb-bug-gnu-emacs@m.gmane.org; Fri, 31 Jul 2009 01:53:07 +0200 Original-Received: from localhost ([127.0.0.1]:48209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWfQo-00037r-8I for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Jul 2009 19:53:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MWesV-0008A6-RY for bug-gnu-emacs@gnu.org; Thu, 30 Jul 2009 19:17:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MWesR-00088q-9k for bug-gnu-emacs@gnu.org; Thu, 30 Jul 2009 19:17:39 -0400 Original-Received: from [199.232.76.173] (port=39730 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWesR-00088k-5Y for bug-gnu-emacs@gnu.org; Thu, 30 Jul 2009 19:17:35 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:48338) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MWesQ-0006ln-OW for bug-gnu-emacs@gnu.org; Thu, 30 Jul 2009 19:17:35 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6UNHV9M016695; Thu, 30 Jul 2009 16:17:32 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n6UN04fX013997; Thu, 30 Jul 2009 16:00:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Francis Devereux Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 30 Jul 2009 23:00:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3975 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 3975-submit@emacsbugs.donarmstrong.com id=B3975.124899468413814 (code B ref 3975); Thu, 30 Jul 2009 23:00:04 +0000 Original-Received: (at 3975) by emacsbugs.donarmstrong.com; 30 Jul 2009 22:58:04 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6UMvvwj013800 for <3975@emacsbugs.donarmstrong.com>; Thu, 30 Jul 2009 15:57:59 -0700 Original-Received: from jupiter-wifi.repton.int (93-97-163-71.zone5.bethere.co.uk [93.97.163.71]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MKv5w-1MWeZL0Ffk-000cLs; Fri, 31 Jul 2009 00:57:51 +0200 In-Reply-To: X-Mailer: Apple Mail (2.935.3) X-Provags-ID: V01U2FsdGVkX1/sq3+g8dqqZ2/g0v2osCXBS+tJ502n1wBCTTo BNwNy9Uem1KxPbo2gShOT/NU/V54pcixx4opAZBhjZvPo2Lkw7 E2TslBIqU1l2ZvucnPpLQ== X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Thu, 30 Jul 2009 19:17:39 -0400 X-Mailman-Approved-At: Thu, 30 Jul 2009 19:53:00 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29747 Archived-At: 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