Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-08

UTF-8 patch for the video unit

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Nikolay Nikolov

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.

Reply by email

Olivier Coursiere
to Nikolay Nikolov: spent some time today, trying to make the text mode IDE look pretty under modern Linuxes…

Hi,

Nikolay Nikolov wrote 5 lines
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.

Nice ! What used to be a hack for the limited BeOS terminal now become a "feature".

I will probably tune the new TerminalSupportsHighIntensityColors and TerminalSupportsBold variable later this weekend to achieve the best results under BeOS and Haiku.

Olivier

Reply by email

Nikolay Nikolov
to Olivier Coursiere
Olivier Coursiere wrote
Nice ! What used to be a hack for the limited BeOS terminal now become a "feature".

Well, initially I was just trying to fix the "feature" that switched the linux console out of UTF-8 mode, which caused most non-ascii characters to look wrong (if your locale uses UTF-8 encoding, which most modern linux distros use) after you've run the IDE and then exited it. So I tried to figure out how to detect whether the console was in UTF-8 mode, so that it can be restored on exit, but found out there's no other way, besides looking at the LANG environment variable. So, while figuring this out, I saw that beos used utf-8 output, so I decided to try to adapt this feature to linux and other unices and see how it looks. So no switching in/out of utf-8 mode, no switching between normal and "graphical" character sets, no redefining the low 32 "special" ascii characters, no modes of any kind, etc... And it turned out perfect, especially on graphical terminals (xterm, gnome-terminal, konsole). :)

I will probably tune the new TerminalSupportsHighIntensityColors and TerminalSupportsBold variable later this weekend to achieve the best results under BeOS and Haiku.

Yep, I intentionally made it flexible, so it can be tuned for different terminals.

Show quoted text 5 lines
Olivier _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email