I'm using Fedora 17 and Emacs 24 and wanted to try liberation fonts on Emacs. I've tried this with HOME/.Xresources:
Xft.antialias: 1
Xft.dpi: 96
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
Emacs.font: Liberation Mono-12
That changes only normal text, but not other text such as ORG-MODE headings. I don't know if antialiasing is working either.
I've also tried:
(set-fontset-font
nil '(#x0250 . #x02af) (font-spec :family "Liberation Mono"))
but it's still the same.
Check to make sure that the org-mode faces are set to inherit correctly from the default face.
I put the following bit of code in my .emacs.d to change the default font:
(set-face-attribute 'default nil :family "Ubuntu Mono" :height 120 :weight 'normal)
Whether the font is being anti-aliased and hinted is dependent on the program drawing the emacs window. So if you're running the X Windows version of Emacs inside Gnome or KDE, then Gnome/KDE will draw the fonts as hinted and anti-aliased. If you're running emacs inside a terminal, then you need to research how to use anti-aliased and hinted fonts inside the terminal (which if you're using a terminal emulator inside of a window manager is still tied to the abilities of the window manager itself).
Related
How do change the font size in spacemacs? Do I need to download additional packages such as source code font?
I tried changing the font size in the configuration file, but the font size does not change. I am having trouble installing source code font, because the font paths are not registered correctly. The fonts were installed via the instructions provided by open source Adobe. Is there an easier way to do such a simple task in spacemacs?
Another way is to use the key sequence "SPC z x" and then press "+/=" key to increase font size or "-" key to decrease font size. Other options are shown on the which-key menu.
In my .spacemacs file I have the following
(defun dotspacemacs/init ()
(setq-default
dotspacemacs-startup-lists '(recents bookmarks projects)
dotspacemacs-default-font '("SourceCode Pro"
:size 18
:weight normal
:width normal
:powerline-offset 2))
Of course you should change the font to your liking. The powerline has some char that goes well with the powerline in spacemacs.
To get to .spacemacs simply type SPC f e d to reload the new file type SPC f e R.
This should do it.
And yes I am an old man with less than optimal eyes, hence the rather large font.
If you don't want to change the default settings or want to change the font size without restarting emacs, try:
M-x text-scale-increase
Another way I do it (at least in Ubuntu 20.04) is to click CTRL and move the scroll wheel on your mouse or touchpad to increase/decrease the size of the text.
Emacs has a built-in rst-mode, but the header highlight literally makes it unreadable. Is there some quick fix for this?
The screenshot above is produced on a Mac OS X using iTerm2, with emacs -Q command (which means no customized .emacs will be used). I am using emacs version 24.4.1.
To find out the name of a face, put your point on it and call
describe-face. This tells you that it is rst-level-1. Looking at
the value, you probably want to change 'Background'.
(custom-set-faces
'(rst-level-1 ((t (:background "white")))))
See the face customization
node in the manual for more details.
First of all, please look at this screenshot
I have GUI Emacs installed via Homebrew on the left and another one running inside iTerm2 with -nw option on the right. Both of them are using Droid Sans Mono font.
But, as you can see, the right one can perfectly handle all unicode characters. I think iTerm2 helps here:
on the left display says that there is no font available
on the right display is equal to terminal code #xF0 #x9F #x8D #xBA
How can I achieve the same result in GUI Emacs as I can have in iTerm2?
OK, I finally managed this issue with these lines in my emacs config:
;; set proper language (fixes cyrillic letters in ansi-term)
(setenv "LANG" "ru_RU.UTF-8")
;; default font
(set-face-attribute 'default nil :family "Droid Sans Mono")
;; font for all unicode characters
(set-fontset-font t 'unicode "Symbola" nil 'prepend)
;; override font for cyrillic characters
(set-fontset-font t 'cyrillic "Droid Sans Mono")
The first line can be ignored, as it only for fixing cyrillic letters in ansi-term.
The steps are:
set your default font with set-face-attribute
then set different font for the specific character-sets via set-fontset-font
Of course, I'll need to set specific range of characters for Symbola font, but it works for me now.
P.S. but I still can't get colored emoji in Emacs as I have in iTerm2
I use emacs with org-mode and other packages that assume all characters have the same width. This was not problematic until I started using Emacs 23 (on Mac and Linux) instead of Carbon Emacs. Now many non-ASCII characters (such as the phonetic characters in 0250–02AF) are rendered with a different font with different metrics. I would like to force emacs to render these characters with the same font as ASCII characters, e.g. DejaVu Sans Mono 10. How can this be achieved? Where is the documentation relating to emacs fonts in never versions located?
Try
(set-fontset-font
nil '(#x0250 . #x02af) (font-spec :family "DejaVu Sans Mono"))
You can move the cursor (point) over the phonetic character and do a C-u C-x = to run some version of what-cursor-position. This will open another buffer containing information about what is under the cursor - including a line containing face and a descriptionof what face is used. Remeber the name of the face used.
Then, call M-x customize-face and enter the remembered used face and customize it to your needs.
I have a function that sets Emacs' color theme to a theme defined by myself. In this function I do:
(set-face-attribute 'default cur-frame :foreground fg-color :background bg-color)
I then set the background color, foreground color, and cursor color for default-frame-alist, initial-frame-alist and special-display-frame-alist.
All of this works fine on my Mac. But when I use this on Linux, it looks fine for all frames that have already been opened, but on newly created frames it looks like this:
I do not have this problem with new frames if use the set-background-color / set-foreground-color functions instead of (set-face-attribute 'default ...). But if I do that I have to manually reset the colors for every frame that's already open.
I am using Emacs version 23.3 on both Mac and Ubuntu.
For clarification, this is the theme file I use:
my-color.el
set-face-attribute sets, as the name suggest, the attributes of a face (i.e., font-related properties), not the attributes of the frame. Use
(add-to-list 'default-frame-alist '(background-color . "lightgray"))
and similar to change frame-related properties.
(if (eq system-type 'darwin)
;; mac os x settings
(if (eq system-type 'gnu/linux)
(setq default-frame-alist '((background-color . "black")
(foreground-color . "gray")))))
something like this should help you maintain settings per OS.
It seems that it's better to use
(custom-set-faces
'(default ... )
'(region ... )
....
)
style to set faces, this way it will not have that problem.
Emacs uses1) (or does not paint over) the Gtk3.0 theme background in more recent Emacs versions. Changing background using e.g. set-background-color or default-frame-alist only works until I resize the window, after which the Gtk theme background "shines through" again.
I have not yet been able to figure out how to get emacs to always paint over the Gtk theme background, but at least I have found a way how to change the Gtk theme background color, for Emacs only: https://superuser.com/questions/699501/emacs-showing-grey-background-where-there-are-no-characters/937749#937749
So this does not fully solve changing the background color when you switch themes, but at least you can get rid of the black-white contrast you experience when opening new frames.
1) on my machine at least :)