[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

font handling broken in cvs emacs --with-ns (MacOS X)

From: B Smith-Mannschott
Subject: font handling broken in cvs emacs --with-ns (MacOS X)
Date: Sun, 4 Jan 2009 19:28:58 +0100

I've found what I believe to be a host of bugs and misbehaviors in the
font handling on Mac OS when built to use the native GUI toolkit
(--with-ns) from the current development sources. I'd like to gather
some feedback before filing a bug report. Have others observed this as

* Font-related Bugs in CVS Emacs (--with-ns)

I've been seeing what appear to be font-related bugs in CVS Emacs.

*** Local Configuration

I'm running Mac OS X 10.5.6, and gcc 4.0.1:

    $ uname -a
    Darwin Meheadable.local 9.6.0
    Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008;
    root:xnu-1228.9.59~1/RELEASE_I386 i386

    $ gcc --version | head -n 1
    i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5488)

I am building from a git mirror (git:// of the
emacs CVS repository.  The most recent commit is:

    commit f9b236eddbb6d8a7f827cbd9321894a622206a27
    Author: Kenichi Handa <address@hidden>
    Date:   Sun Jan 4 13:09:35 2009 +0000

        *** empty log message ***

Here's what I'm doing to build emacs:

    # Nuke build products from orbit. I don't trust make's ability to
    # build incrementally.  I've been screwed by it too
    # often.
    git clean -f
    git reset --hard HEAD
    for x in */*.dSYM ; do rm -rf "$x" ; done

    ./configure --with-ns # self-contained
    make install

*** I expect to be able to use a font other than Monaco 12pt

Emacs comes up by default in Monaco 12pt. It's as good a choice as any
for the default. I'd like to change it (to Consolas-12). (Since this
isn't CarbonEmacs, i can't use mac-font-panel-mode, more's the pitty.)

I've found a work-around using some elisp, but all the Obvious
approaches seem broken.

***** First attempt: Preferences

  1. From the menu Emacs choose Preferences
  2. Click on the button "Default Font..."
  3. (Fonts panel opens)
  4. Choose "Consolas", "Regular", "12"
  5. Close Font Panel
  6. Dismiss "Emacs Preferences" by clicking "OK"
  7. (Observe that the font in the currently opened emacs buffers
     *has* *not* changed.)
  8. (restarting emacs after making this change doesn't help either.)

Setting the default font in emacs preferences has no effect. I would
expect it to change the default font.

***** Second attempt: M-x set-default-font

  1. M-x set-default-font
  2. (mode line prompts for font name:)
  3. Hitting tab for completion reveals that there are zero possible
     fonts. (no match)

I would expect there to be fonts in the completion list of
set-default-font, at the very least one might reasonably expect Monaco
to make an appearance. Instead, the list of candidates for default
font is empty.

***** Third attempt: M-x set-face-font

  1. M-x set-face-font
  2. Set font-related attributes of face: default
  3. Set font-related attriutes of face `default' from font:
  4. Hitting tab for completion at this point produces the following list:


Clearly something is amiss. Where, for example is Courier? Or for that
matter, Consolas, which I have installed.

***** Fourth attempt: Via context menu

On the X11 version of emacs built from *the very same source*
S-mouse-1 pops up a menu "Change Default Buffer Face". I tried this on
my --with-ns build of emacs. No such menu is displayed.

CarbonEmacs still had this menu, or its equivalent. (CVS
HEAD --with-ns) doesn't, presumably because the rewritten font
handling makes it obsolete -- or rather, would make it obsolete if it

***** Fifth attempt: a little elisp

This is a work-around for the problems described above, which works.
I wrote the code used here while using an earlier version of emacs
(probably CarbonEmacs). I'd never have been able to guess the correct
values for the properties of 'default-face.

I've defined the following function:

    (defun bpsm-set-font-consolas ()
      (set-face-attribute 'default nil
                      :background "#ffffff"
                      :family "consolas"
                      :foreground "#000000"
                      :foundry "apple"
                      :height 120
                      :inverse-video nil
                      :slant 'normal
                      :weight 'normal
                      :width 'semi-condensed))

  1. Execute M-x bpsm-set-font-consolas
  2. (observe that the font of all windows in all open frames has
     changed to consolas)

This is not a complete solution, however, as fonts which do not
inherit from 'default remain unchanged.  This is ok for faces like

This is a problem for faces like 'org-column-face, which continues to
use Monaco despite the fact that I've set Consolas above.

(Earlier emacs builds and a more cluttered .emacs were giving me a
scrunched up rendition of some fat proportional serif font chosen
seemingly at random in place of org-column, so I'm thankful for small

    (defun bpsm-set-org-column-font-consolas ()
      (set-face-attribute 'org-column nil
                          :background "grey90"
                          :family "consolas"
                          :foundry "apple"
                          :height 120
                          :slant 'normal
                          :weight 'medium))

// Ben Smith-Mannschott

reply via email to

[Prev in Thread] Current Thread [Next in Thread]