Keyboard chaos

Brocan

07-10-2008 21:58:20

I'm trying to translate the keyboard to spanish one but after I have no idea about how do this task.

I'm into the core_keyboard.xml, i have added a spanish lang and i have four questions:

- What are these codes?? and what is their meaning?
- What is the order of putting this codes? the keys in the keyboard? or what?
- How i can find non-english letters like ñ?
- Where i can write the letters putted by alt gr + ...?

Thanks!

kungfoomasta

07-10-2008 23:44:17

I believe these are code points. True Type Fonts assign each character in the map a code point. Not all code points will map to a symbol, for example pressing the escape key will cause OIS to give you a code point. You need to define which code points map to symbols from the TTF file.

If you don't know the code points, there is a tool on windows that can help:

start -> program files -> accessories -> system tools -> character map

For example I selected the "Times New Roman" font, and found ñ, it has a code point of 241.

Illidanz

08-10-2008 08:45:30

Hi Brocan,
I was trying to get the italian keyboard working, and I have the same problems as you.

I've tried to put the code of special letters like àèìòù etc, but I get only blank characters ... maybe I'm putting the wrong code, I'll try to do like kungfoomasta said

Also I have the need to get alt-gr keys working, like alt-gr+ò = @

I got all the other keys working, you just have to "swap" the keys referring to the english language, that is:
<Lang name="Eng">
0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 45, 61, 0, 0, 113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 91, 93, 0, 0, 97, 115, 100, 102, 103, 104, 106, 107, 108, 59, 39, 96, 0, 92, 122, 120, 99, 118, 98, 110, 109, 44, 46, 47, 0, 42, 0, 32,
0, 0, 33, 64, 35, 36, 37, 94, 38, 42, 40, 41, 95, 43, 0, 0, 81, 87, 69, 82, 84, 89, 85, 73, 79, 80, 123, 125, 0, 0, 65, 83, 68, 70, 71, 72, 74, 75, 76, 58, 34, 126, 0, 124, 90, 88, 67, 86, 66, 78, 77, 60, 62, 63, 0, 42, 0, 32
</Lang>

Brocan

08-10-2008 09:13:38

Yeah, i read your post few days ago, but i don't want only swap codes, i want to discover what are the codes, what is the order of putting them, etc...

We must wait to the expert voices :D

scanmaster_k

08-10-2008 09:18:07

Hi, the font definition must now about the code point too, I recently got the Swedish weird characters working, the only thing left for me is the alt gr too.


Good luck
// Scanmaster_K

Brocan

08-10-2008 16:08:29

Well i have created the basic, but I still have problems:

- This is the spanish keyboard:



Well, when i press the ç key (I think that this key is equivalent to ~ in the help keyboard) I got the simbol <, and when i press the key <, i get the <. So... i have 2 keys that gives me the same simbol, and into the keyboard script there aren't two equal codes (the code of < is 60, and it only appears one time in the script).

- Second, the altgr letters, any ideas?

- And last, how do you achieve the á é í ó ú à è ì ò ù ä ë ï .... because in the spanish keyboard you must press first the ´ key and release it, and after pressing the letter key (for example a) I get the letter á. Now if i press first the ´ key and after then the a, i get ´a.

Any ideas?

Thanks in advance !

Illidanz

08-10-2008 19:37:26

I can't get non-english characters to work.

For example "ì" is 236 in the character map, but if I try it i get only a blank character " "

Also, I'm still missing the keys that need one (or more) keys pressed like Brocan, think we have to wait the developer for that one
EDIT: I said more because in some italian keyboards there's no alt-gr, and to make a "[" without numpad you have to press leftctrl+leftalt+è, or for "{" leftctrl+leftalt+leftshift+è

Brocan

08-10-2008 20:37:00

I have the problem of blanks too, but it's easy solve them.

When you define the font, you put what characters are going to use.

In the core_font.xml in svn, the font is defined like this:

<Font name="Default" default_height="17" source="DejaVuSans.ttf" size="19" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="6" offset_height="0">
<Code range="33 126" />
<Code range="1025 1105" />
<Code range="8470 8470" help="�" />
<Code hide="128" />
<Code hide="1026 1039" />
<Code hide="1104" />
</Font>
....


Here you put that you are going to use the letters of the ttf between 33-126 and 1025-1105 and 8470. So if you put a letter with code 222, you get a blank character.

I'm my case, with the spanish letters I need only from 32 to 242, so my core_font.xml file seems like this:

<?xml version="1.0" encoding="UTF-8"?>

<MyGUI type="Font">

<Font name="Default" default_height="17" source="DejaVuSans.ttf" size="19" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="6" offset_height="0">
<Code range="32 242"/>
</Font>

<Font name="DejaVuSans.17" default_height="17" source="DejaVuSans.ttf" size="19" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="5" offset_height="0">
<Code range="32 242"/>
</Font>

<Font name="DejaVuSans.14" default_height="14" source="DejaVuSans.ttf" size="16" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="7" offset_height="0">
<Code range="32 242"/>
</Font>

</MyGUI>


I think that this maybe your problem ^^

Altren

08-10-2008 23:13:50

2 Illidanz Easy blanks used when you use fonts than wasn't ganerated in font texture. And as Brocan said you need to add your characters codes to core_font.xml.

About altgr and other letters that generated by pressing some special keys. I'm currently working on InputManager so it'll use values that OIS returns (OIS know about layouts and this keys).
If I succeed core_keyboard.xml won't be necessary anymore and altgr and all key combinations will work as they work in your OS.

Illidanz

09-10-2008 08:18:37

@Brocan: Thanks I'll try today

@Altren: That would be really awesome :D Let us know how that goes

Brocan

09-10-2008 09:25:08

:O

There will be awesome, good luck :D

Altren

11-10-2008 00:46:41

Done. Please try and say what do you think.
Everything you need is get latest MyGUI revision, add your characters utf codes to core_font.xml and use bool MyGUI::Gui::injectKeyPress(const OIS::KeyEvent & _arg);if you usedbool MyGUI::Gui::injectKeyPress(KeyCode _key);before.
For Russian keys it works fine. Also tested Spanish and Italian keyboard layouts a bit (without Spanish or Italian keyboard :) ) and didn't noticed any wrong keys, AltGr worked.

Brocan

11-10-2008 12:05:01

Great, i will try later :D

Illidanz

11-10-2008 13:09:30

Awesome work Altren, it indeed works!

I've noticed only one problem: atm I'm on a keyboard without alt-gr, and if I press leftCtrl+leftAlt i should get the same effect as alt-gr, but it doesn't work (dunno if it works with alt-gr, I can test it tomorrow). Any clue?

Can we delete the core_keyboard.xml file now?

my.name

11-10-2008 15:00:32

=)

Altren

11-10-2008 16:27:30

I've noticed only one problem: atm I'm on a keyboard without alt-gr, and if I press leftCtrl+leftAlt i should get the same effect as alt-gr, but it doesn't work (dunno if it works with alt-gr, I can test it tomorrow). Any clue?Hm, leftCtrl+leftAlt doesn't work for me too. I don't know why and don't have any ideas how to fix this.Can we delete the core_keyboard.xml file now?core_keyboard.xml will be used only if you don't use OIS input and defined #MYGUI_NO_OIS

Brocan

12-10-2008 17:47:48

Well, it works fine.

I only have a problem, the letters á, é, í, etc... don't work, but it is a minor problem :D

Great work :D

Altren

12-10-2008 18:51:05

Well, now it's OIS problem. not our. We creating GUI, not input system.

Fred

18-01-2009 19:44:57

Sorry but I also have my trouble with using multilingual keys.
At first: Have I to change the core.lang?

I want to include german umlauts in my application. But I am not able to do this.
I don't really know how I have to look for the "code points". The character-map of windows is not really a help, because there a lots of numbers and I don't know which to chose for example for an "ä".
I'have allready tried to modify the core.font like this:
<Font name="LinLib_40" source="LinLibertineC.otf" size="40" resolution="100" antialias_colour="false" space_width="a" tab_count="4" spacer="5">
<Code range="33 126"/>
<Code range="195 253"/>
<Code range="1025 1105"/>
<Code hide="128"/>
<Code hide="1026 1039"/>
<Code hide="1104"/>
</Font>

But if I try to read an 'ä' or something like this from a xml-file, I will get a runtime error.


Thanks for your help
Fred

Altren

19-01-2009 01:13:15

Just look at your error. I says you what code you need to add

Fred

19-01-2009 20:03:39

Okay thank you! It was my fault! I forgot to change the type of my XML-files into UTF-8.