2

I'm trying to display Unicode Supplementary Multilingual Plane (Plane 1) glyphs in xterm. Those glyphs are in the U+010000..U+01FFFF range (https://unifoundry.com/pub/unifont/unifont-15.0.01/unifont_plane1-15.0.01.bmp).

The font is a merged version of unifont-15.0.01.hex and unifont_upper-15.0.01.hex converted to bdf and is loaded via my .Xresources file:

*locale: true
*ut8: true
xterm*font: -*-merged-*-*-*-16-*

Plane 0 (U+0000..U+FFFF) glyphs are working.

I think it could be a locale issue similar to this post: Cannot display 8-bit characters in xterm in ubuntu 18.04.

I tried LANG=en_US.UTF-8 and LANG=en_US without success.

EDIT: When LANG=en_US.UTF-8 is set Unicode Supplementary Multilingual Plane (Plane 1) glyphs in xterm are displayed as a "weird square". When I start xterm with en-US locale LC_ALL=en_US LANG=en-US xterm Plane 1 glyphs are not displayed and/or wrongly encoded.

Should I use a different locale? If so, which one and how? Additionally, would it be better to define "unifont_upper" as a fallback instead of merging it?

2 Answers 2

3

Bitmap fonts use the X library interface XDrawString16 (see source code), which as the name implies, are limited to 16-bit font indices.

Possibly XmbDrawString could exceed this limit (but since the skimpy manpage gives no clues, one could only determine that by studying the source code). It is not a simple replacement, as you might see from this discussion.

If you want to go past BMP, you have to use TrueType fonts.

1
  • Thank you for the clarification. I'll have a look at XDrawString16 and fall back to True Type Fonts if I don't find anything.
    – grrr
    Commented May 22, 2023 at 11:50
0

Since you have trouble with range more than xFFFF, I am guessing you printing with echo -e "\u1234"? There is a simple trick in this escape codes:

  • \u1234 - print unicode symbol in the range 0000-ffff
  • \U12345678 - print unicode symbol in the range 00000000-ffffffff
1
  • I'm not specifically using echo -e to display symbol, they could be copy pasted, in a text file, etc. echo -e "\u1234" works as intended and print while echo -e \U12345678 prints a weird glyph with en_US.UTF-8 locale and prints \u12345678 with en_US locale
    – grrr
    Commented May 19, 2023 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .