You are not logged in.

#1 2014-09-07 11:34:34

wujek.srujek
Member
Registered: 2013-06-12
Posts: 38

Linux console and diactric character input, setfont -m

Hi,

I have a question about my /etc/vconsole.conf setup: why do I need to use FONT_MAP=8859-2 for special characters to be shown correctly while I type them in the console?

Before I begin with details, I would like to say that I did try to understand it myself, and I did a lot of reading (man: setfonts, console_codes, loadunimap, mapscrn, vconsole.conf; many other internet sources). That's how I was able to configure it so that it works fine but I don't fully understand one part.

My setup:

/etc/locale.conf:

LANG=pl_PL.utf8

/etc/vconsole.conf:

KEYMAP=pl
FONT=Lat2-Terminus16 # lat2-16 behaves the same way
FONT_MAP=8859-2

Now, everything works as I would like it to (I had some problem and had to put the i915 module in /etc/mkinitcpio MODULES, otherwise /etc/vconsole.conf settings would be reset), but there is one thing I fail to understand: why do I need to specify FONT_MAP? If I don't do it, when I type special characters, I see something different (like some +- character, question marks, squares, ...)

From man pages, I understand that:
1. my font is a .psfu font and has the Unicode map embedded - I can see that this is true because I have a file with Polish diactric characters and when I do a 'cat test.text', it all works, even without FONT_MAP or even with a wrong mapping e.g. when I invoke 'setfont Lat2-Terminus16 -m 8859-1' (which makes sense, as it is for something different)
2. I need to use 'setfont -m' (or the obsolete mapscrn, or the FONT_MAP in /etc/vconsole.conf) only when my console is not in utf-8 mode, in which case the mapping is the user-defined mapping of incoming bytes to Unicode code points (from 'man setfont', section 'Console Maps', and 'man console_codes', the sections 'Description' and 'Character sets')
3. my console is in utf-8 mode (I think, please correct my if I'm wrong, as this is probably the fault in my reasoning) - 'stty' outputs 'iutf8'

From the above, 2. and 3. seem to be at odds with each other: my console mode is utf-8 but I need to specify a mapping.

'man mapscrn' says at one point:

A command like
mapscrn 8859-2
sets up a user-to-unicode table that assumes that the user uses ISO 8859-2.

If I comment out FONT_MAP=8859-2 from /etc/vconsole.conf and reboot, I can't input polish characters. But then, calling 'mapscrn 8859-2' fixes it and it works. What I don't understand is, where am I using ISO 8859-2 in my system? I just happen to be using a latin2 (iso 8895-2) font, but this font has it's own mapping Unicode code point -> font glyph index and this one has nothing to do with mapscrn / setfont -m / FONT_MAP, it is the loadunimap / setfont -u / FONT_UNIMAP part, right?

Could somebody please give me a tip about what I'm missing?

Offline

#2 2014-09-12 20:18:51

wujek.srujek
Member
Registered: 2013-06-12
Posts: 38

Re: Linux console and diactric character input, setfont -m

So I think I don't really understand this part of 'man setfont':

Several mappings are involved in the path from user program output to console display. If the console is in utf8 mode (see unicode_start(1)) then the  kernel  expects
that  user program output is coded as UTF-8 (see utf-8(7)), and converts that to Unicode (ucs2).  Otherwise, a translation table is used from the 8-bit program output
to 16-bit Unicode values. Such a translation table is called a Unicode console map.  There are four of them: three built into the kernel, the  fourth  settable  using
the  -m  option of setfont.  An escape sequence chooses between these four tables; after loading a cmap, setfont will output the escape sequence Esc ( K that makes it
the active translation.

What does this 'otherwise' relate to? The console not being in UTF-8 mode, or the program not outputting UTF-8 bytes?
So either my console is not in UTF-8 mode (but again 'stty' has 'iutf8' in its output), or some program is not outputting UTF-8 bytes, but rather ISO-8859-2 - but what program would it be? And why is it 8859-2 and not 8859-1 or yet another one, where is this defined?

Offline

Board footer

Powered by FluxBB