unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Line height too small with Monaco font on Mac OS X
@ 2010-02-08 11:10 Francis Devereux
  2010-02-08 20:16 ` Leo
  2010-02-08 21:15 ` David Reitter
  0 siblings, 2 replies; 5+ messages in thread
From: Francis Devereux @ 2010-02-08 11:10 UTC (permalink / raw)
  To: emacs-devel

Hi,

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?

Thanks,

Francis




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Line height too small with Monaco font on Mac OS X
  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-08 21:15 ` David Reitter
  1 sibling, 1 reply; 5+ messages in thread
From: Leo @ 2010-02-08 20:16 UTC (permalink / raw)
  To: emacs-devel

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?

Thanks.

Leo





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Line height too small with Monaco font on Mac OS X
  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 21:15 ` David Reitter
  1 sibling, 0 replies; 5+ messages in thread
From: David Reitter @ 2010-02-08 21:15 UTC (permalink / raw)
  To: Francis Devereux, Chong Yidong; +Cc: emacs-devel@gnu.org discussions


[-- 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 --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Line height too small with Monaco font on Mac OS X
  2010-02-08 20:16 ` Leo
@ 2010-02-08 23:43   ` Chong Yidong
  2010-02-11 13:45     ` Francis Devereux
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2010-02-08 23:43 UTC (permalink / raw)
  To: Leo; +Cc: francis, 3975, emacs-devel

Leo <sdl.web@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?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Line height too small with Monaco font on Mac OS X
  2010-02-08 23:43   ` Chong Yidong
@ 2010-02-11 13:45     ` Francis Devereux
  0 siblings, 0 replies; 5+ messages in thread
From: Francis Devereux @ 2010-02-11 13:45 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Leo, 3975, emacs-devel

On 8 Feb 2010, at 23:43, Chong Yidong wrote:

> Leo <sdl.web@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-11 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).