2

I am experiencing font issues for a few specific characters, namely the "SYMBOL FOR …" family, which are textual representations of control characters such as NUL, BEL, BS, etc.

While the symbols on the left are cute, I'd rather have those on the right

This screenshot shows:

  • on the left, emacs -Q, with completion candidates for C-x 8 RET SYMBOL FOR;

  • on the right, a Terminator console running Python, displaying some of the same characters.

Not shown: a file containing some of these characters, opened with the Geany text editor. Geany displays the same glyphs as Terminator.

While the symbols on the left are rather cute, I would rather have Emacs show the same glyphs as Terminator and Geany. I have no idea of what causes this though. Terminator and Geany both use the Monospace font, but customizing Emacs's default face to Monospace does not change the situation. I do not know yet whether the issue comes from:

  1. my system (font cache, what have you);
  2. my Emacs configuration (unlikely, since -Q includes --no-init-file --no-site-file);
  3. the Emacs software.

C-u C-x = on e.g. SYMBOL FOR NULL has this to say about the character:

             position: 146 of 151 (96%), column: 0
            character: ␀ (displayed as ␀) (codepoint 9216, #o22000, #x2400)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x2400
               script: symbol
               syntax: _    which means: symbol
             category: .:Base, c:Chinese
             to input: type "C-x 8 RET 2400" or "C-x 8 RET SYMBOL FOR NULL"
          buffer code: #xE2 #x90 #x80
            file code: #xE2 #x90 #x80 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-unknown-Symbola-normal-normal-semicondensed-*-15-*-*-*-*-0-iso10646-1 (#x77D)

Character code properties: customize what to show
  name: SYMBOL FOR NULL
  old-name: GRAPHIC FOR NULL
  general-category: So (Symbol, Other)
  decomposition: (9216) ('␀')

There are text properties here:
  fontified            t

Note that emacs -nw is unaffected, i.e. the characters on the right side of the screenshot are shown. I guess Terminator takes care of font selection in this case? 🤷

I would appreciate any input on the subject. I do not know whether this warrants a bug report, since for all I know my whole setup is working "as intended" for some value of "intended".

Emacs version: GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.14.5)
Terminator version: terminator 0.97
Python version: Python 3.4.2
Geany version: geany 1.24.1 (built on 2014-04-19 with GTK 2.24.23, GLib 2.40.0)
OS: BunsenLabs GNU/Linux 8.5 (Hydrogen) (essentially Debian Jessie)

PS: I tried to reproduce on a Xubuntu 14.04 machine, and saw intricate glyphs composed of a square box, featuring the acronym (e.g. NUL, BS) in the bottom half and the weird symbol (e.g. heart, spades) in the top-right corner (could not take a screenshot unfortunately).

PS2: now that I've copy-pasted the above code-block in Firefox (49.0), I can also add that Firefox uses the same glyph than Terminator and Geany.

1

1 Answer 1

6

Fonts are harder than they look, in general. If you look at the details you pasted from Emacs you'll see that it actually used Symbola, not Monospace, to render that character. Probably the Monospace font didn't have any glyph for that character, and it had to go find a different font for it. Luckily you can tell Emacs which font to fall back to for a character range. You'll want to use the set-fontset-font command, as described in the answer to this previous question: https://stackoverflow.com/questions/6083496/how-do-you-specify-a-fallback-font-in-emacs.

For more details, check out sections 22.13 through 22.16, and section 14.19, of the Emacs manual.

Oh, and when you run Emacs inside of a terminal of any kind, Emacs loses all control of what fonts get used; the terminal renders all text in that case.

2
  • Thanks for the insights! Before I mark this solved, I'd like to get to the bottom of how my Emacs picks its fonts, and why other programs on my system make other choices. So I'm going to crawl those manual sections you mentioned, possibly some config files (eg .Xresources) and I'll ping back as soon as I'm happy with my understanding of the situation!
    – Peniblec
    Nov 10, 2016 at 20:53
  • Should be an interesting rabbit-hole. Have fun!
    – db48x
    Nov 10, 2016 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.