Hangul (Korean) Layout?

Asked by alexbottoni on 2017-05-14

Is there any Hangul (Korean) layout for OnBoard? See: https://en.wikipedia.org/wiki/Hangul .

As an alternative, is there any documentation regarding how to create a new layout (or modify an existing one)?

I could try to create a Hangul layout for OnBoard if someone can tell me how to do.

(I'm using OnBoard on Linux Mint 17.1 with the support for Hangul / Korean installed. Everything works fine but... it looks like there isn't any Hangul layout for OnBoard. Is there?)

Question information

Language:
English Edit question
Status:
Answered
For:
Onboard Edit question
Assignee:
No assignee Edit question
Last query:
2017-05-16
Last reply:
2018-04-21
marmuta (marmuta) said : #1

There is no Hangul layout yet, but we'd love to have one. We're lacking the Korean language skills, so any help you can provide is highly appreciated.

How would such a keyboard look, is it mostly about entering Jamo, perhaps the green ones in
https://en.wikipedia.org/wiki/Hangul_Jamo_(Unicode_block)
?

I've been trying to get a hangul input method going in Ubuntu Artful to get a feeling for what is required, but haven't been successful.
Things like
GTK_IM_MODULE=hangul2 gedit
just crash, etc.
How did you go about enabling Hangul support in Linux Mint?

There is some information about layout creation in Onboard's help pages. Find the help item in the menu of the status icon, or run
yelp help:onboard
Francesco and me are happy to help with any questions that arise.

I'd recommend to start out with the "New" button in Preferences->Layout in order to create a copy of an existing layout.

alexbottoni (alexbottoni) said : #2

Marmuta: There is no Hangul layout yet, but we'd love to have one. We're lacking the Korean language skills, so any help you can provide is highly appreciated.

Alex: OK, I will try to give you all the support I can and I will try to develop the Hangul layout. I'm not an expert but I know Hangul and the Korean language a little bit and I know Python (that seems to be the main language used to develop OnBoard. Isn't it?).

Marmuta: How would such a keyboard look, is it mostly about entering Jamo, perhaps the green ones in https://en.wikipedia.org/wiki/Hangul_Jamo_(Unicode_block)?

Yes. Hangul is more similar to our roman alphabet than to the hanzi (Chinese) and kanji (Japanese) character sets. It is also quite similar to the hiragana and katakana syllabaries used by Japanese people.

Hangul just has 21 vowels and 19 consonants and is usually mapped onto a regular 101/104 keys keyboard using some kind of multi-character input support. Any single key of the keyboard corresponds to a single "jamo" character but two or more jamos have to be assembled in a single "syllable" so Hangul uses some kind of multi-character input editor (like Cangjie) beyond the scene.

A couple of different Hangul keyboards can be seen here:

http://koreangenealogy.org/wp-content/uploads/2013/01/k1.png

http://koreangenealogy.org/wp-content/uploads/2013/01/image047.png

https://cdn-standard4.discourse.org/uploads/memrise/original/2X/6/60f68ebd3d40b3ef1bea885bbcb4896baaa17833.png

(The shift key is used to create five "double consonants".)

Marmuta: I've been trying to get a hangul input method going in Ubuntu Artful to get a feeling for what is required, but haven't been successful.
Things like
GTK_IM_MODULE=hangul2 gedit
just crash, etc.
How did you go about enabling Hangul support in Linux Mint?

In Linux Mint 17.1, you have to install the language pack for the Korean language, one or more Hangul font and any one of the available "input method editors" (IME), like iBus, Fcitx, UIM, Maliit or SCIM. As I said, Hangul requires a multi-character input system to handle the complex mechanism used to assemble the "syllable" element.

See: https://en.wikipedia.org/wiki/Input_method .

At the moment, I'm using iBus.

Once installed and activated the IME software, you can change the OS language with CTRL-Space or using the supplied tray applet. When Hangul/Korean is selected, you can see Hangul characters in LibreOffice, Gedit and other editors.

Here you can find a screenshot of Gedit accepting Hangul text from a standard 104-keys Italian USB keyboard on my Linux box. The image in the foreground is the static PNG of a Hangul keyboard I use to find the keys on my Italian keyboard.

http://i61.photobucket.com/albums/h65/alexbottoni/gedit-hangul_zpsu5eebrlj.png

BEWARE: you could be forced to enable iBus explicitly (Preferences->Keyboard Input Method) and on my linux box the Cinnamon desktop applet used to switch language usually does not show up at all...

Marmuta: There is some information about layout creation in Onboard's help pages. Find the help item in the menu of the status icon, or run
yelp help:onboard
Francesco and me are happy to help with any questions that arise.

OK, Thanks. I will study it.

Of course, both you and Francesco can contact me in Italian at this same email address.

Marmuta: I'd recommend to start out with the "New" button in Preferences->Layout in order to create a copy of an existing layout.

OK, I will try.

See you soon.

alexbottoni (alexbottoni) said : #3

FYI: the 1.0.1 version supplied with Ubuntu Trusty / Linux Mint 17.1 (Updates) does not contain the Help. There isn't any "Help" voice in the menu.

The 1.4.1 version, available as a PPA from http://ppa.launchpad.net/onboard/stable/ubuntu, does not launch the "Preferences" UI. There isn't any way to access the Preferences->Layout->New command.

I printed a copy of the help and downgraded OnBoard to Rel. 1.0.1.

Francesco Fumanti (frafu) said : #4

Hi,

I would suggest to continue in english, as it will be easier for marmuta, afaik.

After reading your hint about hangul having 21 vowels and 19 consonants, I wondered whether it is really necessary to use the multi-character input. Did you have a look at the Whiteboard layout shipping with Onboard? Onboard also supports mapping utf-8 characters directly to Onboard keys. Thus, I could imagine a layout showing the 40 letters of the hangul alphabet, so that any letter of the hangul alphabet can be typed by simply clicking on one key.

To reduce the number of keys, the five double consonants could be available in the popup of the corresponding single consonants (similar to typing the ò by holding down the "o" on a latin layout). Additional reductions of the number of keys might also be possible by using the popups. This would probably need the intervention of marmuta to define the new popups in the source code; but this should be no problem for him.

I don't know hangul, so I am not able to determine whether the above approach mapping the hangul alphabet directly to Onboard keys can be a solution. The direct input, if possible with the particularities of hangul, would simplify its input, but on the other hand, that layout would not be useful to learn the multi-character input used on regular keyboards.

Have a nice day.

Francesco Fumanti (frafu) said : #5

Hi again,

The version in our Snapshots PPA should fix the problem about the Preferences dialog of Onboard not opening.
https://launchpad.net/~onboard/+archive/ubuntu/snapshots

Cheers

alexbottoni (alexbottoni) said : #6

Hi Francesco,
I had the same feeling.

Having just 40 characters, Hangul does not seems to really need a multi-character input system but, as long as I can see, all of the existing implementations use this approach (more precisely, they require an IME at install-time). I suspect that it has something to do with the strange way Hangul assembles its syllables. As long as I can understand at the moment, the iBus system uses a sequence of jamo to select a pre-built "syllable" from a vast repertoire (probably because this is the only way to build the syllable in a reliable way without using a complex algorithm) and this selection step is delegated to the IME.

Anyway, I will look at the Whiteboard layout and see if it can be used as a basis for our needs.

For the meantime, many thanks for your kind help (to both of you). I will install the last snapshot from the PPA and go on.

alexbottoni (alexbottoni) said : #7

I just realize that all of the existing implementations have a very strong and very specific reason to require an IME: they all implement a hanja keyboard, as well. Hanja is the korean name for chinese hanzi and japanese kanji.

I do not use hanja with korean (it is neither required nor particularly useful) so I completely forgot it but the system still implements it and still requires a multi-character IME.

I thing we could focus on a Hangul-only, UTF-8 layout, at least as a first step.

Francesco Fumanti (frafu) said : #8

You might be interested to know that the alternative characters shown in the popups are defined in the following file:
http://bazaar.launchpad.net/~onboard/onboard/trunk/view/head:/Onboard/canonical_equivalents.py

To rapidly test your layout, simply put it into the onboard layouts folder in your user directory and switch to another layout and back. On Ubuntu it is: ~/.local/share/onboard/layouts/
However, I don't know at what point the canonical_equivalents are loaded; thus if there are changes to the canonical_equivalent file, simply switching layout might not be sufficient.

@marmuta

Does Onboard load the canonical_equivalents only at startup or at every layout switch?

alexbottoni (alexbottoni) said : #9

It looks like we have a problem. See this screenshot:

http://s61.photobucket.com/user/alexbottoni/media/hangul-keyboard-first-key-test_zps9y2bae43.png.html

The first line of text in Gedit is the word "밥" ("pab", that means "rice" and "meal") in Korean as typed from my 104 keys IT_it standard USB keyboard using iBus and the Hangul language support package.

As you can see, these three characters get assembled into a single syllable (a 2D grid of characters).

The second line is what we get using an embryonal prototype of OnBoard with a new layout file. I just changed one single key (q -> ㅂ) to perform this test.

As you can see, in this case the sequence of characters are not assembled into a single syllable.

The corresponding layout file is here:

https://gist.github.com/alexbottoni/b479033a0776fe673d5da3e8eb991024

As long as I can understand, when you type the text on the physical keyboard, the stream of characters is sent to iBus, iBus use them to select a specific pre-assembled syllable (a single character) and sends the resulting single character to Gedit. This is exactly the same mechanism used by the multi-character input systems used for hanzi/kanji/hanja (chinese ideograms).

When we use OnBoard, the text is sent directly to Gedit and printed as a sequence of characters.

If this is the source of this problem, the only way to get the right Korean text is to implement multi-character support into OnBoard (iBus or other types). As long as I can understand, it should be a matter to redirect the output of OnBoard to the input slot of iBus (at the moment I have no idea regarding how to do so).

Francesco Fumanti (frafu) said : #10

I could imagine defining the "밥" as a canonical equivalent of "ㅂ". In other words, you would choose the "밥" the same way, you chose the "ò" by holding down the "o" on the onboard latin (italian) keyboard. By using the popup to type the "ò", there is no composition of accent and "o" taking place; as far as I know, the utf-8 "ò" gets directly typed.

For it however, you have to define the "밥" syllabe as an equivalent of the "ㅂ" key. This is done in the canonical_equivalent.py file that you find in Onboard directory. You might have a look at that file.

This however, will probably only make sense if the number of syllabes is not very huge.

Finally, I wonder how marmuta feels about using the canonical equivalents to offer syllabes to the user.

Francesco Fumanti (frafu) said : #12

I was already wondering whether it would be possible to do it with canonical equivalents. Doing it with the multi-character input system might probably be the better approach.

marmuta (marmuta) said : #13

So, I went back to Ubuntu 16.04 and finally got Hangul IBus working there. It wasn't even hard to do, just a few steps, logging out twice and it worked. I guess Artful is too much of a construction site at the moment.

From that experience, I'd say I'm definitely missing Jamo keyboard labels. That is something Onboard could really help with. However, implementing actual multi-character to syllables mappings, or even Hanja in Onboard seems at first sight a bit pointless, as these tasks are performed quite well (as far as I can tell) by the input method.

alexbottoni, from your example images, this one stood out to me
https://cdn-standard4.discourse.org/uploads/memrise/original/2X/6/60f68ebd3d40b3ef1bea885bbcb4896baaa17833.png
as it shows, what I believe is called the Dubeolsik layout, and includes the Han/Yeong and Hanja keys. Instead of awkward (for an osk) key combinations, you'd switch with dedicated keys between English, Hangule and Hanja.

This similar one
https://en.wikipedia.org/wiki/File:KB_South_Korea.svg
has the extra keys and also a (supposedly common) L-shaped return key. That shape would be possible have in Onboard.

More things that came to mind:

Onboard's layouts are mostly language independent, meaning you pick a layout you like, then select whatever system keymap you want and Onboard adapts. Question is, will this still be possible with Hangul or do we really need one or more dedicated layouts, e.g. Compact-Hangul, Small-Hangul, Phone-Hangul, ...?
I tend to think, we should at least try to add Hangul support to the existing layouts, and only if that gets out of hand, add new dedicated layouts.

We have the attribute "layout" that allows to have layout elements depend on the current keymap. E.g.
          <key group="alphanumeric" id="AB07" label="'" char="'" layout="be,fr,cm(azerty)"/>
          <key group="alphanumeric" id="AB07"/>

The first line would be active for AZERTY layouts (French) that second for all others. That works for all tags, not just individual keys, so whole sections of a layout could be assigned only to Korean.

Problem is, IBus settings aren't known to "layout" yet. It only knows what XKb provides, and that is "kr", no matter what is currently active in the IME. Also key labels seem unavailable through XKb (different with libinput?).

Perhaps we can get state information directly from the IME - IBus in particular. That would be the state of the Han/Yeong (and Hanja if it is a toggle, but I believe not) key and label strings for all keys as UTF-8 or Unicode. This way we could support all the layouts the IME supports too, e.g. Dubeolsik, Sebeolsik, etc.

marmuta (marmuta) said : #14

Francesco:
> @marmuta
> Does Onboard load the canonical_equivalents only at startup or at every layout switch?
It's a python module and only loaded on first import, so basically once. I agree though that canonical_equivalents are probably not the right way to approach this. AFAICT there is more going with Hangul than that simple system could provide. Also, maybe we don't really need much more than Jamo labels.

alexbottoni:
> When we use OnBoard, the text is sent directly to Gedit and printed as a
> sequence of characters.
>
> If this is the source of this problem, the only way to get the right Korean text is to
> implement multi-character support into OnBoard (iBus or other types). As long as
> I can understand, it should be a matter to redirect the output of OnBoard to
> the input slot of iBus (at the moment I have no idea regarding how to do so).
Hmm, actually that seemed to just work in Xenial. Is it different in Mint? With the Hangul IM active I could create syllables and Hanja by typing with Onboard. It worked in gedit at least, I'm not 100% sure elsewhere, I'd have to try again. I was basically just wishing for Jamo key labels.

alexbottoni (alexbottoni) said : #15

@Marmuta
ASAP, I will finish a Full Keyboard layout with Hangul (Jamo) labels so we will be able to see a complete prototype and we can make some experiments.

Unfortunately, I will be able to supply a Hangul keymap only. I do not know Hanzi/Hanja/Kanji and their input methods. I think, however, that we can "steal" an existing keymap from other sources (Wikipedia?) if needed.

I think that the only two layouts that are actually required for Hangul are a Full Keyboard and maybe a Compact one. On phones and tablets other OSKs are normally used (Google Input on Android, similar stuff on iPhone) so it would be redundant to offer other ones.

I agree with you that re-implementing multi-character-to-syllable composition in OnBoard would an overkill and probably will also be redundant. AFAIK, this is the main task performed by the IM library so we just have to find a way to feed IM with our keystream (it should work this way already AFAIK but... as I told you, on LM17.1 it does not).

Unfortunately, at the moment I do not know IME and iBus at all so I cannot be of any help regarding the best way to communicate with this software layer.

I do not have a Xenial installation at hand so I cannot confirm that OnBoard works on this distro.

I would not be surprised at all by the fact that OnBoard communicates flawlessly with iBus on Xenial and does not on Linux Mint 17.1. Ubuntu uses Unity (and Gnome 2, I think) while Mint uses Cinnamon and Gnome 3. It is quite common to see desktop-related software that works well on one distro and does not work at all on the other.

Anyway, I will supply you with a Full Keyboard Hangul (only, no Hanja) map ASAP, so you will be able to test it on Xenial.

alexbottoni (alexbottoni) said : #16

It looks like it works, now. Have a look at this screenshot:

http://i61.photobucket.com/albums/h65/alexbottoni/Hangul-Keyboard-Test-Working_zpsf1xcb291.png

The first line has been written using the USB keyboard.

The second line has been written using OnBoard with the same layout used yesterday with a single change (see below).

As you can see, in both cases the Hangul syllable is assembled in the correct way (by iBus IM).

I just changed this line:

<key group="alphanumeric" id="AD01" char="ㅂ" label="ㅂ" />

to this line:

<key group="alphanumeric" id="AD01" label="ㅂ" />

inside the "Hangul Keyboard.onboard" XML configuration file.

That is: you have to rely on the operating system keyboard mapping to have iBus IM to work in the right way. If you force OnBoard to send a specific charID, iBus will not be able to replace it with the sub-script/super-script version used to assemble the syllable.

Of course, you still have to manually set the OS keyboard language map to Hangul using the iBus Tray Applet, CTRL+Space shortcut or other tools AND set the OnBoard layout to Hangul using its own Tray Applet. I do not know if there is a way to automatically synchronize the OnBoard layout with the OS language.

I will send you the complete layout soon.

marmuta (marmuta) said : #17

Let me create a bug report, then we can attach images there.

marmuta (marmuta) said : #18

(photobucket doesn't work that well for me)

If you don't mind, we can move the discussion to
https://bugs.launchpad.net/onboard/+bug/1691115

ulliperk (kimchiii) said : #19

Hello Onboard Team

i am new to this forum,

i am not a programmer just a koreanist.
looking for a korean onboard layout i came across this homepages

http://kalten.tistory.com/25
and
https://forum.ubuntu-kr.org/viewtopic.php?t=15696

there you will find a korean layout for ONboard,
it was written for an older version but i am sure experienced coders will be able to adjust it

Can you help with this problem?

Provide an answer of your own, or ask alexbottoni for more information if necessary.

To post a message you must log in.