6

My xterm supports uni-code. For instance, it displays the Euro sign:

echo -e '\xe2\x82\xac'

But it does not display one particular character:

PL_BRANCH=$'\ue0a0'
echo $PL_BRANCH

This character displays properly in another terminal (terminator). I am using same font in both terminals (Inconsolata).

What could be the reason and how can I fix it ?

intika
  • 14,406
Martin Vegter
  • 358
  • 75
  • 236
  • 411

2 Answers2

6

The character is actually not in the font you indicated. You can see this using xfd:

xfd -fa inconsolata

That shows the last codepoint is U+2423. Reading a little further, it turns out that the character is in the Unicode private use area, and (notwithstanding the fact that some font may provide it) has no standard meaning.

Since late 2018, xterm can load multiple TrueType fonts, but none of the fonts at hand have U+E0A0.

If you can identify the actual font which is used, someone can point out which versions of xterm can deal with it.

Addressing a comment about terminator (which I don't happen to have installed), terminator doesn't use the same library interfaces as xterm, which affect the font-searching (none of either is well documented). You could use strace to see which font-files it actually opens.

For example, exploring this a little with strace, konsole and pterm on my Debian/testing both open one of the OpenOffice fonts for this character:

2600  openat(AT_FDCWD, "/users/tom/foo", O_RDONLY               
2600  )             = 3                                     
2586  openat(AT_FDCWD, "/usr/share/fonts/truetype/openoffice/opens___.ttf", O_R>
2601  openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC   
2601  )             = 4                 

(That's the "OpenSymbol" family's file).

On the other hand, I see that rxvt-unicode does not display the character, in spite of having several font-patterns added to its search-list to (try to) work around problems such as this (which ultimately reflects a problem in fontconfig). Very likely you'd find something similar (but different) in the libraries which support konsole and pterm.

Thomas Dickey
  • 76,765
  • thank you. But the weird thing is, I am using the same font in terminator, and there it works. – Martin Vegter Oct 25 '19 at 07:51
  • So assuming the OP has access to a truetype font like https://raw.githubusercontent.com/powerline/powerline/develop/font/PowerlineSymbols.otf that has a glyphs for U+E0A0, how would they invoke/configure xterm so it renders characters using a generic font like DejaVu Sans Mono, but falls back to that PowelineSymbols font (assuming it's installed system-wide) for U+E0A0 (and other characters not covered by DejaVu but covered by that font)? Where can we find a specification for the format of the argument to -fa/faceName? – Stéphane Chazelas Jun 21 '20 at 16:18
  • xterm's manpage, and (of course) the fontconfig documentation, e.,g FcFontSort, which needs a tutorial... – Thomas Dickey Jun 21 '20 at 16:38
1

Modern terminal application uses additional fonts other than the default one when a character is unknown but xterm uses exclusively a single font (except for the special cases of double-width characters)

The needed char $'\ue0a0', echo $'\ue0a0' is part of OpenSymbol font, we can use it with xterm but as that font does not include normal characters this would make it unusable, thus one solution is to use a patched font that include the needed special char and load it with the following

xterm -fa 'Inconsolata for Powerline'

We can as well set the size of the font as follow

xterm -fa 'Inconsolata for Powerline' -fs 16

This settings can be applied to the current user by adding the following to ~/.Xresources or system widely on /etc/X11/app-defaults/XTerm

XTerm*faceName: Inconsolata for Powerline

Links: 1, 2, 3, 4, 5 and 6

intika
  • 14,406