Q&A for those using, extending or developing Emacs. Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. If nothing happens, download GitHub Desktop and try again. Basic utilities and configuration to make Emacs.app daemon mode work smoothly. Emacs Client.app is an easy way to get access to Emacs from your Dock. To install: Copy org.gnu.emacs.plist into /Library/LaunchAgents launchctl load /Library. Tested on OS X 10.11 El Capitan, with Homebrew Emacs and Spacemacs config. Why Emacs Daemon, why this post. Installing Emacs on a Mac in and of itself is not that much of a problem - there are several options, ranging from Homebrew and Macports to Emacs for Mac OS X, Emacs Mac Port and Aquamacs. The last two in this list have some OS X. Q&A for those using, extending or developing Emacs. By using the latest Emacs version from 1, it seems that when running in daemon-mode and when opening a new client frame from the terminal or from a custom OSX app I wrote which opens a new frame when. Here’s how to change the default font in your InitFile: use M-x customize-face to customize the default face. Inspecting and Changing Fonts. Use `S-down-mouse-1’ or `M-x menu-set-font’ to see the font and fontset menu. Emacs starts with the startup fontset. Use `M-x describe-font’ to see the requested font and actual font being used.
The most important info first. Here’s how to change the default font in your InitFile: use
M-x customize-face to customize the default face.
Inspecting and Changing Fonts
Globally Change the Default Font
To change the default font for new (non special-display) frames, put either of these in your init file:
To change the default font for the current frame, as well as future frames, put either of these in your init file: Video codec pack for mac os x.
where
FONT is a string naming the font you want, for example, 'Droid Sans Mono-10' .
This should work on all platforms. As of Emacs 23, all of your system fonts including TrueType are available to Emacs.
If you are using a development snapshot for what will become Emacs 24.4 then see Emacs bug #16529.
(There needs to be an explanation for how to set fonts for particular modes or buffers here. Including a set-face-attribute hook as described above for a particular mode does not work; once you enter that mode the new font is set, but it is applied globally to all other open buffers!)
Global Fonts, .Xresources, and Emacs Daemon
I found that the only way to set fonts so that they remain consistent across emacs -nw, emacs23(-gtk), emacsclient -t, emacsclient -c, was to declare them in .Xresources and .emacs. But the declarations can’t conflict with each other. Otherwise, emacs --daemon complains. It doesn’t like (set-face-attribute ‘default nil :font FONT) and the like. For instance, to use Terminus, 9 pixel size across the board, I needed to insert
Emacs.font: Terminus-9
(set-default-font “Terminus-9”)
in my ~/.Xresources and ~/.emacs, respectively.
Changing the (buffer) menu fonts for GTK emacs
According to http://stackoverflow.com/questions/3454466/emacs23-buffer-menu-font-gtk say in
~/.emacs.d/gtkrc :
Using
widget '*' .. will change all “toolkit” fonts (menus, dialogs).
![]()
When using gtk emacs on a remote 4k display, I would get an small black menubar with tiny white lettering.
I initially started digging into all these settings to change the menubar font size and color to be more readable.
In the end I found the GDK_SCALE, GDK_DPI_SCALE and GTK_THEME environment variables were a quick shortcut to the readability I wanted. For example I settled on:
$ GDK_SCALE=1.7 GDK_DPI_SCALE=1.7 GTK_THEME=Adwaita emacs &
You may have to fiddle because it’s a little unclear to me how the scale variables affect things, even reading this documentation: https://developer.gnome.org/gtk3/stable/gtk-x11.html
Changing Font Size
You can resize (text-scale) the text in a buffer (in all windows showing it), or you can resize the default font of a frame.
Resize (Zoom) Buffer Text Incrementally
Starting with GnuEmacs 23, you can zoom the text in the current buffer, in all frames displaying it:
Resize (Zoom) Frame Font Incrementally
You can use any of the following to increase or decrease the font size for the current frame, effectively resizing it incrementally – zooming the text in or out.
Resize Frame Font using Lisp
You can change the size of a font for the current frame non-incrementally using
‘set-face-attribute’ with a :height parameter:
Alternatively, you can use
‘set-frame-font’ , ‘set-face-font’ , or ‘set-face-attribute’ with a FONT string argument that has the size you want:
Installing Fonts
If you are running Linux, you may be able to run `xfontsel` from a shell. This program helps you select a font. Once you’ve found one that you like, save the specification string. In my version, clicking the “select” button near the top left copies the string to my clipboard so I can yank (paste) it into Emacs.
Either set them in your InitFile:
Or set them in your ~/.Xresources or ~/.Xdefaults file (depending on your setup):
Actually, you may want to specify FontSets instead of a single font, if you are interested in displaying various fonts at the same time
Debian users: if your emacs startup fonts look ugly, that might be because you’ve installed the gsfonts-x11 package. gsfonts-x11 gives X the ability to display Ghostscript fonts, and they are poorly rendered on screen. To fix this, read the document that comes with gsfonts-x11, or Section 9.4.13 of the Debian Reference, 'TrueType fonts in X'.
As an emacs newbie, I feel this section quite incomplete. For most people, Installing a font means two things :
The section covers only the second point. I am quite willing to agree that emacs does thing differently for a bunch of reason, but please give me some light. (Even to tell it is some sort of X dependency, which I suspect but that doesn’t tell me what to do).
Note that arrived here after a search on “font” which, I think, seems quite a reasonable thing to do to install a new font. I didn’t see a newbie-specific page. – LionelB
For downloading fonts and installing them, there’s nothing Emacs-specific. Emacs uses your system’s fonts. If you’re using Emacs with X11, then use the X11 font installation technique (xset fp etc.). If you’re using Emacs with X11/Xft, then use the Xft font installation technique (.fonts.conf). If you’re using Emacs with MS Windows, then use the MS Windows font installation technique (Control Panel / Fonts). If you’re using Emacs with Mac, then use the Mac font installation technique (Font Book / Add Fonts).
X Logical Font Description (XLFD) python utility: https://gist.github.com/tomleo/b14a7a75e49d57c08bc1 – TomLeo
Good Pixel Fonts
Testing if fonts are available?
Is it possible to test if a given font is available without an error or other side-effects? I just wrote:
but it has the side-effect of opening a description in Help if the font exists. I’m trying to set my init files to try a series of fonts and use the first available one. (I’m using Emacs 22.1.2 on OpenBSD, fwiw.) -ScottVokes
Emacs For Os X Daemon Version
I use this:
-MichaelChen
Also I use this:
And so.
Version using dash.el (call it the same way as above):
Os X El Capitan
Version using loop:
True type fonts?Macbook Emacs
I’d like to use TrueType Fonts in Emacs in various places, but Emacs handles them badly. Can someone tell me why TTF fonts are so much trouble in Emacs, and if there’s some way I could get emacs to play nicely with them anyway? --ShaeErisson
For TTF support, see XftGnuEmacs --TimotheeBesset
As of 23.3.1 TTF support is still quite defective (on Debian at least): for example, DejaVu Sans Mono 11 is rendered at ~11.5pt, and 10pt is rendered at ~9.5pt. You’ll need to set a font size of e.g. 102-108 tenths to actually get 10pt text.
CarbonEmacs
Customize the default face (
M-x customize-face RET default RET ).
Alternatively, follow the following procedure:
Emacs for Mac OS X
M-x mac-font-panel-mode is not available on Emacs builds downloaded from http://emacsformacosx.com. On these builds, use the default Mac shortcut to popup the font panel, i.e, Command+T. Alternatively, use M-x ns-popup-font-panel. Then follow the instructions in the Carbon Emacs section.
Mac Emacs 27
From my personal experiences, there is no working-for-all-emacs solution for fontset. For current Emacs 24.x (from http://emacsformacosx.com/), below script can be one of the solution:
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |