Subject: Font bug in 22 (Carbon): default "Monaco" has wrong (frame-char-width)

From: David Reitter <[email-masked]>
Date: Wed, 25 Jun 2008 19:23:21 +0100

I think there's a font bug in Emacs 22 (CVS), Carbon.

To reproduce:

Start Emacs -Q
(frame-width)  (evaluates to 80)
(frame-char-width)  (evaluates to 7)
(mac-font-panel-mode)
[select 14pt  in the default Monaco font]   (note that the frame does  
not resize in width)

(frame-width)  (evaluates to 80  - wrong!)
(frame-char-width)  (evaluates to 7 - wrong!)

When you select Monaco 18, the frame gets wider as intended (still a  
bad design choice), but (frame-width) is 81, which is too high.
(/ (frame-pixel-width) (frame-char-width)) evaluates to 85.  (frame- 
pixel-width) is correct, so I assume that (frame-char-width) is wrong.

Concrete use case:

Start Emacs -Q
(setq longlines-wrap-follows-window-size t)
[enter text with several words in a line that is longer than the  
window width, i.e. gets wrapped]
(mac-font-panel-mode)
select 14 point (in the default "Monaco")
(longlines-mode)

--> lines will be wrapped too late.

I don't notice such problems with other fonts.

The original bug report by [email-masked] read:
====

Dear David,

There appears to be a bug in the latest Aquamacs version. If one tries  
to wrap the text (ALT+Q) with fontsize different from 12, one gets  
mostly garbage.

Best Wishes,
Christoph

In GNU Emacs 22.2.50.2 (i386-apple-darwin9.2.2, Carbon Version 1.6.0)
  of 2008-06-23 on plume.sr.unh.edu
Windowing system distributor `Apple Inc.', version 10.5.3
configured using `configure  '--without-x' '--prefix=/usr/local''

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: nil
   locale-coding-system: iso-8859-1
   default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
   longlines-mode: t
   tooltip-mode: t
   tool-bar-mode: t
   mouse-wheel-mode: t
   use-hard-newlines: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   unify-8859-on-encoding-mode: t
   utf-translate-cjk-mode: t
   auto-compression-mode: t
   line-number-mode: t

Recent input:
<help-echo> <down-mouse-1> <mouse-1> <help-echo> C-x
b <return> <help-echo> <help-echo> <help-echo> <down-mouse-1>
<mouse-1> C-y <up> <up> <down> <down> <escape> x l
o n g l <tab> <return> <escape> x m a c - f o <tab>
<return> <help-echo> <down-mouse-1> <mouse-1> <return>
<return> <up> ( s e t q SPC l o n g l i n e s - w r
a p - f o l l o w s - w i n d o w - s i z e SPC t )
C-x C-e <return> <return> <escape> x l o n g l <tab>
m <tab> <return> <escape> x <up> <return> <help-echo>
<help-echo> <help-echo> <help-echo> <down> <up> x l
o n g l <tab> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <escape> x l o n g l <tab>
m o <tab> <return> <escape> x <up> <return> <menu-bar>
<help-menu> <send-emacs-bug-report>

Recent messages:
Longlines mode enabled
Mac-Font-Panel mode enabled
t
Longlines mode disabled
Longlines mode enabled
Longlines mode disabled
Longlines mode enabled
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done