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
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.
I installed Tomorrow theme into my Emacs24 using melpa.
Chinese characters appeared as blocks in comments while showing the correct characters in other places.
The default font in my .emacs is like following:
(set-default-font "Menlo-12")
(setq default-frame-alist '(font . "Menlo-12"))
It seems like the Menlo font doesn't support italic Chinese characters. Type M-x customize-face RET font-lock-comment-face and change "slant" to "normal", and the characters should appear.
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).
I love the cyrillic-translit input method for Emacs. However, after I set the wonderful Terminus as my default font, the Russian characters appear in Arial or something (in any case it's not Terminus).
How do I fix this? Setting the default font to UTF-8 (Emacs equivalent "-outline-Terminus-normal-normal-normal-mono-16-*-*-*-c-*-iso10646-1") doesn't help. I guess this possibly means that Terminus lacks decent UTF-8 support?
Anyhow, I'm using the following snippet for switching between cyrillic-translit input method and the "normal" mode:
(defun toggle-cyrillic-input-method ()
"toggle between French and no input method"
(interactive)
(if (string= current-input-method "cyrillic-translit")
(set-input-method nil)
(set-input-method "cyrillic-translit")))
(global-set-key [f9] 'toggle-cyrillic-input-method)
Now -- is there a way to make the snippet not only switch over to cyrillic-translit but also switch the codepage when I press F9?
In other words, how do I make it also toggle the font between "-outline-Terminus-normal-normal-normal-mono-16-*-*-*-c-*-iso8859-1" (Latin) and "-outline-Terminus-normal-normal-normal-mono-16-*-*-*-c-*-iso8859-5" (Russian)?
It's the only workaround I (as a non-programmer) could think of. Any other ideas are welcome, too. Thanks!
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.