How to find out current font used in my Emacs?

40

5

How to find out current font used in my Emacs?

qazwsx

Posted 2012-05-10T16:35:40.927

Reputation: 6 739

Answers

44

In my version of Emacs, I can get the information by entering M-x describe-font.

choroba

Posted 2012-05-10T16:35:40.927

Reputation: 14 741

Emacs 25.1 on Windows says Debugger entered--Lisp error: (void-variable describe-font), this worked on Linux though. – NikoNyrh – 2017-12-21T09:00:41.900

6When doing that, it prompts Font name (default current choice for ASCII chars): What does that mean? What should I do there? – qazwsx – 2012-05-10T18:02:26.900

2@duperuser: I just hit Enter... – choroba – 2012-05-10T18:06:22.730

2This is an answer to the second question, but not the first one. After hitting Enter, 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? – qazwsx – 2012-05-10T20:34:11.487

@choroba after hitting enter on M-x describe-font I get "No fonts being used" on the mini-buffer – MarcusJuniusBrutus – 2013-09-09T17:18:47.640

@MenelaosPerdikeas: Are you running emacs in a text terminal? – choroba – 2013-09-09T17:46:03.970

11

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.

Stefan

Posted 2012-05-10T16:35:40.927

Reputation: 1 052

1What command is "C-u C-x =" a shortcut to? – qazwsx – 2017-12-04T18:14:53.993

Well, C-x = is bound to what-cursor-position, but when called with a C-u prefix, it mostly delegates the work to describe-char. – Stefan – 2017-12-04T18:21:02.123

So without using any keyboard shortcut, how to do the same thing? – qazwsx – 2017-12-04T18:28:18.277

If you limit yourself to the M-x shortcut, it would be M-x describe-char RET. – Stefan – 2017-12-04T18:32:02.210

So why is C-x =/what-cursor-position not used? – qazwsx – 2017-12-04T18:44:19.883

You can use that as well, but then you need to pass the C-u prefix: 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. – Stefan – 2017-12-04T18:51:57.383

What confuses me is that none of your suggestions include both what-cursor-position and describe-font. – qazwsx – 2017-12-04T20:32:24.497

7

You can just evaluate

(face-attribute 'default :font)

To evaluate a sexp, do M-:, type/paste the above sexp in there and hit enter.

Kaushal Modi

Posted 2012-05-10T16:35:40.927

Reputation: 223

0

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. makdown-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.

rofrol

Posted 2012-05-10T16:35:40.927

Reputation: 1 419