3

While I'm able to display the cute little snowman ☃ in both GUI and terminal I'm not able to display these unicode characters in the terminal although it works in the GUI : Ⓐ Ⓑ ... I've got the usual blank squares.

I'm using the same font (DejaVu Sans Mono or Source Code Pro) in both GUI and terminal. The terminal is rxvt-unicode.

My coding settings are all utf-8.

Why does little snowman work and circled letters don't ? Is this because we are in winter ? :-)

describe-char for Ⓐ:

Terminal:

            position: 7194 of 78709 (9%), column: 47                                                                                                                              
            character: Ⓐ (displayed as Ⓐ) (codepoint 9398, #o22266, #x24b6)                                                                                                        
    preferred charset: unicode (Unicode (ISO10646))                                                                                                                                 

code point in charset: 0x24B6                                                                                                                                                      
               script: symbol                                                                                                                                                      
               syntax: w  which means: word                                                                                                                                        
             category: .:Base, L:Left-to-right (strong), l:Latin                                                                                                                   
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"                                                                                                          
          buffer code: #xE2 #x92 #xB6                                                                                                                                              
            file code: #xE2 #x92 #xB6 (encoded by coding system utf-8-unix)                                                                                                        
              display: terminal code #xE2 #x92 #xB6                                                                                                                                                                                      

Character code properties: customize what to show                                                                                                                                  
  name: CIRCLED LATIN CAPITAL LETTER A                                                                                                                                             
  general-category: So (Symbol, Other)                                                                                                                                             
  decomposition: (circle 65) (circle 'A')                                                                                                                                                                                                                                                                                                                              

There are text properties here:                                                                                                                                                    
  face                 font-lock-string-face                                                                                                                                       
  fontified            t                                                                                                                                                           

GUI:

            position: 7194 of 78709 (9%), column: 47
            character: Ⓐ (displayed as Ⓐ) (codepoint 9398, #o22266, #x24b6)
    preferred charset: unicode (Unicode (ISO10646))

code point in charset: 0x24B6
               script: symbol
               syntax: w    which means: word
             category: .:Base, L:Left-to-right (strong), l:Latin
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #xE2 #x92 #xB6
            file code: #xE2 #x92 #xB6 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-unknown-Apple SD Gothic Neo-normal-normal-normal-*-13-*-*-*-*-0-iso10646-1 (#x20C4)

Character code properties: customize what to show
  name: CIRCLED LATIN CAPITAL LETTER A
  general-category: So (Symbol, Other)
  decomposition: (circle 65) (circle 'A')

There are text properties here:
  face                 font-lock-string-face
  fontified            t

EDIT: Here is my working Xdefaults settings for an Ubuntu box:

URxvt.font: xft:Source Code Pro:pixelsize=13, \
            xft:Nanum Pen Script:pixelsize=9:antialias=true
URxvt.letterSpace: -1

I hope it will save some time to other people ☃☃☃

  • 3
    I bet it's fallback the GUI version of Emacs is doing for you, but urxvt isn't. Inspect the fonts of both the snowman and the circled characters in the GUI Emacs by putting point on them and perusing M-x describe-char. – wasamasa Dec 22 '14 at 22:10
  • Thank you! Indeed the GUI has a fall back, so if I understand correctly I have to find a way to define these fallbacks in the Terminal. Question updated with the output of describe-char. – syl20bnr Dec 23 '14 at 5:05
6

There's a very underappreciated feature most libraries that handle fonts provide for us, automatic fallback to different fonts if the font one has specified does not have all glyphs necessary to display the requested text correctly.

urxvt however does intentionally not come with automatic font fallback, at least not if you're not using fonts with the xft: specifier. If you wish to use fallback, you need to specify the fonts for it explicitly in its configuration. This can be done by interspersing all fonts in the intended fallback order with a comma and using that value as the font name in its configuration. More details on that can be found in its manual.

Alternatively, you could try using a terminal emulator that makes full use of the OS X font technology that comes with automatic fallback as last resort.

  • There is something wrong with urxvt and emacs. Even if I choose a font with Ⓐ it is not displayed in a urxvt terminal. I tried recompiling urxvt with unicode3 support, same thing. Of course providing fallback fonts have no effect. In a gnome-terminal the glyph is displayed. Unfortunately Google provides very little info where to look at... – syl20bnr Dec 23 '14 at 15:32
  • Even in Vim the glyph does not appear... – syl20bnr Dec 23 '14 at 15:33
  • So it works if I change the size of the fallback font to something very tiny like 6. On my Linux box it gives: URxvt.font: xft:DejaVu Sans Mono for Powerline:size=10, \ xft:Nanum Pen Script:size=6 URxvt.letterSpace: -2 – syl20bnr Dec 23 '14 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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