[fpc-devel] UTF-8 patch for the video unit

Nikolay Nikolov nickysn at users.sourceforge.net
Sat Aug 29 22:54:47 CEST 2009

Hi all,

spent some time today, trying to make the text mode IDE look pretty 
under modern Linuxes and here's the result - a patch for UTF-8 console 
output. Previously, only BeOS used UTF-8. Tested with:

- the linux console
- xterm
- gnome-terminal
- konsole
- rxvt-unicode

all under Fedora 11. Known "features":

- high intensity colours were actually normal intensity, with a bold 
attribute set. This worked fine under gnome-terminal, but xterm didn't 
have bold versions of all cp437 characters, which screwed up the window 
borders in the IDE. And although konsole had them, I didn't like the 
font - it converted all the double window borders to a very thick 
single-line border. So I disabled the bolding of high intensity colours 
in all X11 terminals (TERM=xterm) and replaced it with another ANSI 
attribute, that actually sets high intensity colours, but is not (in 
theory) supported by all terminals. The linux console doesn't support it 
- it actually wants a bold attribute, to set high intensity, so that's 
why I enabled it only for X11 terminals. All the ones, that I tried, 
worked fine (xterm, gnome-terminal, konsole, rxvt-unicode, also the 
plain old rxvt, with a non-UTF-8 locale).
- Fedora 11 by default uses a 512-characters font, called 
latarcyrheb-sun16 for the linux text mode console, which disables the 
high intensity colours, effectively reducing the set of available 
colours to only 8. This is a hardware limitation of the VGA hardware and 
can be avoided by using a 256-character font. It does not need to be 
cp437, but it has to have an unicode mapping.
- I haven't tried other linux distros (and unix-like OSes, i.e. FreeBSD 
and Mac OS X) - although they should work in theory, they might look 
bad, due to different fonts, etc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: video_utf8_patch.diff
Type: text/x-patch
Size: 6476 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090829/aa39fda6/attachment.bin>

More information about the fpc-devel mailing list