* bug#3975: Line height too small with Monaco font on Mac OS X [not found] ` <xbaiaavjpjob.fsf@cam.ac.uk> @ 2010-02-08 23:43 ` Chong Yidong 2009-07-30 9:22 ` bug#3975: 23.1; " Francis Devereux [not found] ` <874olrz41x.fsf@stupidchicken.com> 1 sibling, 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
* bug#3975: 23.1; Line height too small with Monaco font on Mac OS X @ 2009-07-30 9:22 ` Francis Devereux [not found] ` <handler.3975.B.124894575813167.ack@emacsbugs.donarmstrong.com> 2010-02-09 2:28 ` bug#3975: " Leo 0 siblings, 2 replies; 5+ messages in thread From: Francis Devereux @ 2009-07-30 9:22 UTC (permalink / raw) To: bug-gnu-emacs 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <handler.3975.B.124894575813167.ack@emacsbugs.donarmstrong.com>]
* bug#3975: 23.1; [PATCH] Line height too small with Monaco font on Mac OS X [not found] ` <handler.3975.B.124894575813167.ack@emacsbugs.donarmstrong.com> @ 2009-07-30 22:57 ` Francis Devereux 0 siblings, 0 replies; 5+ messages in thread From: Francis Devereux @ 2009-07-30 22:57 UTC (permalink / raw) To: 3975 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#3975: Line height too small with Monaco font on Mac OS X 2009-07-30 9:22 ` bug#3975: 23.1; " Francis Devereux [not found] ` <handler.3975.B.124894575813167.ack@emacsbugs.donarmstrong.com> @ 2010-02-09 2:28 ` Leo 1 sibling, 0 replies; 5+ messages in thread From: Leo @ 2010-02-09 2:28 UTC (permalink / raw) To: bug-gnu-emacs 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <874olrz41x.fsf@stupidchicken.com>]
* bug#3975: Line height too small with Monaco font on Mac OS X [not found] ` <874olrz41x.fsf@stupidchicken.com> @ 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 -- [not found] <256A1330-5C0B-4F54-926E-83C95923067D@devrx.org> [not found] ` <xbaiaavjpjob.fsf@cam.ac.uk> 2010-02-08 23:43 ` bug#3975: Line height too small with Monaco font on Mac OS X 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 ` bug#3975: 23.1; [PATCH] " Francis Devereux 2010-02-09 2:28 ` bug#3975: " Leo [not found] ` <874olrz41x.fsf@stupidchicken.com> 2010-02-11 13:45 ` Francis Devereux
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).