Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's stranger than that. The Linux terminal runs VGA adapters in an EGA mode that is rarely if ever used in DOS/WIndows systems. The mode provides up to 512 characters. One of the high-byte bits if each word is sacrificed to select from the first or second set of 256 characters; and another is sacrificed to specify underline on or off. That leaves 8 foreground and background colors, instead of the 16 foreground and background characters that you would get on a PC. Linux doesn't appear to have any concept of code-page. Which characters can be displayed on the terminal depends entirely on which EGA font is loaded. And that is determined (by default) by the currently configured locale, although the choice of font can be manually overridden. Having 512 characters to choose from allows the Linux VGA terminal to include a superset of characters that would be provided in a DOS/Windows codepage, while also guaranteeing at least the single-line line-drawing characters in CP437.There are, for example, fonts that allow display of glyphs in all Eastern European codepages, and fonts that provide a superset of European codepages and Cyrillic.

ncurses renders to an underlying framebuffer which contains 32-bit Unicode characters, plus attributes (FG/BG color pair, and 8 additional attributes like underline, bold, blink). I'm not sure which layer of crust this framebuffer belongs to -- something related to TERMINFO, I think. The intermediate framebuffer is then rendered to the actual VGA framebuffer in a separate pass, which maps 32-bit unicode characters onto glyph indexes in the currently-loaded VGA font.

There are some provisions for Asian character sets (Vietnamese, for example, is plausibly supported). I'm not sure if Chinese or Japanese VGA terminals were ever adequately supported in Linux.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: