GNU bug report logs - #3975
23.1; Line height too small with Monaco font on Mac OS X

Previous Next

Packages: ns, emacs;

Reported by: Francis Devereux <francis <at> devrx.org>

Date: Thu, 30 Jul 2009 09:30:06 UTC

Severity: normal

Tags: moreinfo

Merged with 2836, 3961, 3986

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3975 in the body.
You can then email your comments to 3975 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3975; Package emacs. (Thu, 30 Jul 2009 09:30:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Francis Devereux <francis <at> devrx.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 30 Jul 2009 09:30:07 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; Line height too small with Monaco font on Mac OS X
Date: Thu, 30 Jul 2009 10:22:20 +0100
On Mac OS X the line height is too small when the Monaco font is used.
This causes, for example, the bottom of ( and ) characters to be
clipped.

Emacs 22.3 (Carbon port) works OK with this font.

Steps to reproduce:

1) Run nextstep/Emacs.app/Contents/MacOS/Emacs -q &

2) Switch to the *scratch* buffer

3) Evaluate (setq default-frame-alist (cons '(font . "-apple-monaco- 
medium-r-normal--10-100-72-72-m-100-mac-roman") default-frame-alist))

4) Type C-x 5 2 to open a new window

5) Type ()() to see the problem

I have uploaded a screenshot showing the problem to http://www.devrx.org/emacs/emacs-23-osx-font-problem.png

Francis


In GNU Emacs 23.1.1 (i386-apple-darwin9.7.0, NS apple-appkit-949.46)
 of 2009-07-30 on spaceman.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x b * s c <tab> <return> C-y C-x C-e C-x 5 2 <left>
<right> <wheel-up> <switch-frame> <down-mouse-1> <mouse-movement>
<drag-mouse-1> <return> <return> ( s e t q SPC C-y
C-y <down-mouse-2> <mouse-2> ) <up> <up> C-a <right>
<right> <right> <right> <right> <right> <right> C-d
<down> C-a <right> C-d <down> C-d C-e C-x C-e <help-echo>
<down-mouse-1> <mouse-1> ' <down> C-a <right> ' <down>
<left> ' C-x C-e C-g C-e C-x C-e <help-echo> <down-mouse-1>
<mouse-1> <right> <backspace> <backspace> C-e <backspace>
<down> C-a <right> C-d C-d C-e <backspace> <down> C-a
<right> C-d C-d C-e <left> <backspace> <right> C-x
C-e M-x C-g <down-mouse-1> <mouse-1> C-x 5 2 <down-mouse-1>
<mouse-1> M-x r e p o r t - e m <tab> <return>

Recent messages:
((font . "-apple-monaco-medium-r-normal--10-100-72-72-m-100-mac- 
roman") (tool-bar-lines . 0) (menu-bar-lines . 1))
byte-code: Beginning of buffer
Mark set [4 times]
Entering debugger...
(ns-antialias-text nil)
Quit
Entering debugger...
meta
Quit
goto-history-element: Beginning of history; no preceding item





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3975; Package emacs. (Thu, 30 Jul 2009 23:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Francis Devereux <francis <at> devrx.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 30 Jul 2009 23:00:04 GMT) Full text and rfc822 format available.

Message #10 received at 3975 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: 3975 <at> debbugs.gnu.org
Subject: Re: 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
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




bug reassigned from package `emacs' to `emacs,ns'. Request was from Jason Rumney <jasonr <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 01 Aug 2009 09:05:04 GMT) Full text and rfc822 format available.

Merged 2836 3961 3975 3986. Request was from Jason Rumney <jasonr <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 01 Aug 2009 09:05:05 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3975; Package emacs,ns. (Mon, 08 Feb 2010 23:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 3975 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Leo <sdl.web <at> gmail.com>
Cc: francis <at> devrx.org, 3975 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: Line height too small with Monaco font on Mac OS X
Date: Mon, 08 Feb 2010 18:43:54 -0500
Leo <sdl.web <at> gmail.com> writes:

> On 2010-02-08 11:10 +0000, Francis Devereux wrote:
>> A few months ago I tried out Emacs 23.1 on Mac OS X, and found that
>> the line height was too small when using the Monaco font (some
>> characters are clipped at the bottom, including ()[]).  I downloaded
>> and compiled Emacs 23.1.92 today and found that it still has the same
>> problem.
>>
>> 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?
>
> No wonder I always feel a bit weird using monaco. I have moved to DejaVu
> Sans Mono and it is looking better.
>
> Patch is attached to bug #3975. Maybe someone can review it?

I've reviewed the patch, and it looks ok.  I've checked it in, could you
test it?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3975; Package emacs,ns. (Tue, 09 Feb 2010 02:29:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#3975: Line height too small with Monaco font on Mac OS X
Date: Tue, 09 Feb 2010 02:28:22 +0000
On 2010-02-08 23:43 +0000, Chong Yidong wrote:
>> No wonder I always feel a bit weird using monaco. I have moved to
>> DejaVu Sans Mono and it is looking better.
>>
>> Patch is attached to bug #3975. Maybe someone can review it?
>
> I've reviewed the patch, and it looks ok. I've checked it in, could
> you test it?

Unfortunately it is a bit awkward for me to test it now as I no longer
use the ns port and the font but maybe someone else can test it.

Leo






Added tag(s) moreinfo. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 10 Feb 2010 01:25:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3975; Package emacs,ns. (Thu, 11 Feb 2010 14:21:02 GMT) Full text and rfc822 format available.

Message #25 received at 3975 <at> debbugs.gnu.org (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Leo <sdl.web <at> gmail.com>, 3975 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: Line height too small with Monaco font on Mac OS X
Date: Thu, 11 Feb 2010 13:45:49 +0000
On 8 Feb 2010, at 23:43, Chong Yidong wrote:

> Leo <sdl.web <at> gmail.com> writes:
>
>> On 2010-02-08 11:10 +0000, Francis Devereux wrote:
>>> A few months ago I tried out Emacs 23.1 on Mac OS X, and found that
>>> the line height was too small when using the Monaco font (some
>>> characters are clipped at the bottom, including ()[]).  I downloaded
>>> and compiled Emacs 23.1.92 today and found that it still has the  
>>> same
>>> problem.
>>>
>>> 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?
>>
>> No wonder I always feel a bit weird using monaco. I have moved to  
>> DejaVu
>> Sans Mono and it is looking better.
>>
>> Patch is attached to bug #3975. Maybe someone can review it?
>
> I've reviewed the patch, and it looks ok.  I've checked it in, could  
> you
> test it?

Thanks, I've tested bzr trunk r99485 and the bug is fixed there.

Francis





bug closed, send any further explanations to Francis Devereux <francis <at> devrx.org> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Fri, 12 Feb 2010 14:40:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 13 Mar 2010 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 102 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.