1

The docs state:

In Mac OS X 10.5 and later, Emacs uses a Core Text based font backend by default. If you prefer the older font style, enter the following at the command-line before starting Emacs:

defaults write org.gnu.Emacs FontBackend ns

I've seen this works when the Emacs executable lives under /Applications (like a typical Mac application) and runs under the native OS X window system, but not if it is installed /usr/local/bin and runs under some X11 port.

As a result, X11-capable instances of /usr/local/bin/emacs fail to recognize any of the 30-odd variables whose names start with ns-.

Is there some other way of customizing Emacs' font backend that would work for X11-capable instances of /usr/local/bin/emacs?


Strangely enough, elsewhere in the docs one finds this description of font-backend (my emphasis):

font-backend
A list of symbols, specifying the font backends to use for drawing fonts in the frame, in order of priority. On X, there are currently two available font backends: x (the X core font driver) and xft (the Xft font driver). On MS-Windows, there are currently two available font backends: gdi and uniscribe (see Windows Fonts). On other systems, there is only one available font backend, so it does not make sense to modify this frame parameter.

The emphasized sentence seems to contradict the excerpt cited at the beginning of this post. Be that as it may, I have not been able to find the setting for anything called font-backend in any instance of Emacs I've checked. Therefore, it is not too surprising that putting the following line at the beginning of my ~/.emacs file fails to have any substantive effect:

(setq font-backend 'ns)  ;; useless
  • 1
    Regarding the latter, that's because the manual is refering to a frame parameter, not a customization variable. – wasamasa Feb 14 '15 at 23:53
4

Customization settings for OS X have no effect if you do not run Emacs as a native OS X application, for obvious reasons. In other words, if you run an X11 Emacs on OS X, the FontBackend setting and the ns-* options have no effect.

You can change the font backend of an X11 Emacs, too, by setting the frame parameter font-backend, i.e.

(add-to-list 'default-frame-alist '(font-backend . xft))

to use the Xft backend, which—unlike the X backend—supports anti-aliasing.

However, you cannot use native OS X font backends with the X11 application. (font-backend . ns) will not work. It's simply impossible to use native OS X font rendering on X11 frames.

In other words, you have to build and run Emacs as native OS X application in order to use OS X font rendering. An X11 Emacs will always use X11 to render fonts, which looks rather poor, particularly on modern HiDPI screens.

In other words, don't use X11 Emacs, if you want to use OS X font rendering.

  • Thanks for your answer. As it turns out, my interest in this question is that I want to disable font antialiasing, and the only method I have found is to set the variable ns-antialiased-text to nil. Would you also say that I should not use X11 Emacs if I want bitmapped fonts rendered without antialiasing? – kjo Feb 15 '15 at 18:51
  • @kjo Bitmap fonts without antialiasing? I don't think that you can disable antialiasing in native OS X applications, let alone use bitmap fonts! Your best bet is probably an X11 instance with Xft, with antialiasing disabled via Xft-specific X resources. I'm don't know, though, whether you can use bitmap fonts. No offence meant, but if you'd like font rendering like in the 90s, OS X is probably not the best system for that. – lunaryorn Feb 15 '15 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.