Linux – Charset / font in the Linux console

consolefontslinuxunicode

I want to write a game which runs in a terminal. I do some terminal coloring and wanted to use some unicode characters for nice ascii art "graphics". But a lot of unicode characters aren't supported in the linux terminal (the non-X terminal, I don't know how you call it… VT100? I mean the terminal which uses the text mode for output, no graphic mode, so the same font as in bios is used to display the text.)

For example, I wanted to draw half character "pixels" using the "half block" characters U+2580 (▀) and U+2584 (▄) but these are not supported in the terminal. (These are only examples – I want to use a lot more special characters…)

Which characters does this font support? Is there any document or table listing these characters? Is this device-dependent or is there any "standard"?

Best Answer

That terminal is called the Linux console, or sometimes a “vt” (short for virtual terminal). The terminology can be confusing, especially since it's used inconsistently and sometimes incorrectly. You can find more information on terminology by reading What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?.

The Linux console supports user-configured fonts, so the answer to your question is “whatever the user set up”. The utility to change the font is consolechars, part of the Linux console tools. Only 8-bit fonts are supported by the hardware, though you can partly work around this by supporting unicode-encoded output but only having 256 glyphs (other characters are ignored). Read the lct documentation (online as of this writing, it should be included in your distribution's package) for more information.

If you use the Linux framebuffer, you can have proper unicode support, either directly or through fbterm.

The half-block characters are included in IBM code page 437, which is supported in ROM most PC video adapters. Depending on what characters you need, this may be enough.

Note that very few people use the Linux console these days. Some people cannot use it for various reasons (not running Linux, running on a remote X terminal, having a video adapter where text mode is buggy, …). I don't recommend spending much energy on supporting it.

Related Question