How to find out current font used in my Emacs?
Solution 1
In my version of Emacs, I can get the information by entering M-x describe-font.
Solution 2
Different fonts can be used for different characters and different parts of the buffer. For a given character, you can find out which font was used by moving point to that character than then doing C-u C-x = which will give you all kinds of information about that position in the buffer, including which font was used for it.
Solution 3
You can just evaluate
(face-attribute 'default :font)
To evaluate a sexp, do M-:, type/paste the above sexp in there and hit enter.
Solution 4
Place cursor on text which you want to customize and run M-x describe-face.
It will give you information how this font was set, i.e. markdown-pre-face. You can then see that it inhertis from markdown-code-face which inherits from fixed-pitch.
And this is how you can set it:
(set-face-attribute 'default nil
:family "Source Code Pro"
:height 130
:weight 'normal
:width 'normal)
(copy-face 'default 'fixed-pitch)
Restart Emacs after setting it.
Related videos on Youtube
qazwsx
Updated on September 18, 2022Comments
-
qazwsx 11 monthsHow to find out current font used in my Emacs?
-
qazwsx about 11 yearsWhen doing that, it promptsFont name (default current choice for ASCII chars):What does that mean? What should I do there? -
qazwsx about 11 yearsThis is an answer to the second question, but not the first one. After hittingEnter, is the displayed info about the font used for displaying ASCII characters ONLY? If so, how to find out the fonts used for displaying non-ASCII ones? -
choroba almost 10 years@MenelaosPerdikeas: Are you running emacs in a text terminal? -
qazwsx over 5 yearsWhat command is "C-u C-x =" a shortcut to? -
Stefan over 5 yearsWell,C-x =is bound towhat-cursor-position, but when called with aC-uprefix, it mostly delegates the work todescribe-char. -
qazwsx over 5 yearsSo without using any keyboard shortcut, how to do the same thing? -
Stefan over 5 yearsIf you limit yourself to theM-xshortcut, it would beM-x describe-char RET. -
qazwsx over 5 yearsSo why isC-x =/what-cursor-positionnot used? -
Stefan over 5 yearsYou can use that as well, but then you need to pass theC-uprefix:C-u M-x what-cursor-position RET, otherwise you'll get just very brief data in the echo area, and this doesn't include any font information. -
qazwsx over 5 yearsWhat confuses me is that none of your suggestions include bothwhat-cursor-positionanddescribe-font. -
NikoNyrh over 5 yearsEmacs 25.1 on Windows saysDebugger entered--Lisp error: (void-variable describe-font), this worked on Linux though.