Keyboard help

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Keyboard help

Post by bubach »

You could just change your font at bootup, and you would be sure that it works after that.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
mystran

Re:Keyboard help

Post by mystran »

Ok, my suggestion version 2: load a regional font on boot, whether that'd be latin1 or something else.

You can map Unicode into that where possible, but remember that Unicode is all but simple: you now have to deal with codepoints (the values), characters (one or more codepoints combined) and glyphs (the visual shapes on screen). Your font contains glyphs, so you really want to map the glyphs into the regional character set.

Futher complication of the whole Unicode mess is that you actually have to deal with several different representations of the same characters: ? can be code either as a latin1-compatible ?, or a+"compose umlaut" (which happens to be the canonical representation, and should be converted to before matching two strings). Because composes can be done in almost arbitary ways, you have almost unlimited number of different characters in Unicode. In graphical display this is usually no problem, since you can compose glyphs too if you want. And all these with LATIN scripts alone. Other scripts can cause even weirder issues.

So, basicly, either take Latin1 (or similar regional charset), forget about 8th bit, or do your console in graphics mode even if you only used "fixed"-width (CJK glyphs are usually double-wide) fonts in a text-mode like grid.

But you are free to select alternative methods, this is just my suggestion. :)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Keyboard help

Post by Pype.Clicker »

note that if you really want to, you can reprogram the palette so that first and last 8 colors are identical and then use bit 3 of the attribute as the "font selector", enabling up to 256 'irregular' characters in your map ... Speculating that you don't have more than 256 "non-latin" characters displayed at a given time, you can just allocate them dynamically ...

But that'd certainly be a pain to use ...
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Keyboard help

Post by Brendan »

Hi,
Pype.Clicker wrote:note that if you really want to, you can reprogram the palette so that first and last 8 colors are identical and then use bit 3 of the attribute as the "font selector", enabling up to 256 'irregular' characters in your map ... Speculating that you don't have more than 256 "non-latin" characters displayed at a given time, you can just allocate them dynamically ...

But that'd certainly be a pain to use ...
It'd be possible to dynamically redefine up to 254 or 510 characters transparently (such that applications don't need to care). It'd be a nice feature, even for straight english (for e.g. allowing UK/english users to see a euro currency sign).

I see 2 problems, the first is what to do when more than 254 or 510 unique characters need to be displayed. Here I'd use a "can't be displayed" character ('?'), which is why I said 254 or 510 rather than 255 or 511. The other character would be for space. With a little intelligence you could count how many times each Unicode character is used and define the most frequently used characters first.

The other problem is that you'd need a full Unicode character set and the code to convert the character data into pixel data - the same stuff you'd need to display Unicode in graphics modes. Once you've got this, dynamically redefining text mode character sets wouldn't be that difficult. It'd also open up other possibilities, like rotating the text by 90 degrees or displaying limited/small pictures (icons?).

At this stage my OS is a long way from being able to display Unicode characters in graphics modes, so (for my purposes) it's also far too early to dynamically create text mode font data. It isn't too early to allow for it in the design of the video interface though, so passing Unicode data through a simplistic "convert to screen code" function before displaying it isn't a bad idea (even if the only thing this conversion does is convert any code point above 127 into a '?')...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Keyboard help

Post by bubach »

Switch to mode 0x10/0x12 and draw you own font? In the case of mode 0x10 it supports both text and graphics.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Keyboard help

Post by Solar »

The "Extended ASCII" link above describes IBM Code Page 437. With a bit of bad luck you might come across e.g. German laptop BIOS' that default to Code Page 850 (DOS default for Germany), or Code Page 1252 (WIndows default for Western Europe) instead.

But it's a good place to start with.

You might want to check out http://www.answers.com/topic/extended-ascii for more info on charsets, code pages et al.
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Keyboard help

Post by Pype.Clicker »

http://www.pango.org/resources.shtml

might be interresting for later use :)
Post Reply