Testing the updated IM support in GTK+
In Improving input method support in GTK+-based apps, we talked about some work to update the list of compose sequences that GTK+ knows to the latest version that comes from Xorg. From 691 compose sequences, we now support over 5000.
The patch has landed in GTK+ (trunk), and here are instructions for testing.
- If you have not used jhbuild before, read the jhbuild instructions and install it.
- Add the following to your ~/.jhbuildrc file
branches['gtk+'] = None # Makes sure you build from the trunk of GTK+
- Install gtk+ using the command (see the comment of James on this post on how to avoid Step 5 below)
jhbuild build gtk+
- About 40 minutes later, and about 700MB of space (~600MB for source, ~100MB for installation of files) consumed, you should get a working copy of GTK+ 2.12.
- You can use this compiled version of GTK+ by running
jhbuild shell
This should give you a new shell, and whatever you run from here will use our fresh GTK+. Try running “gedit”. You will notice that the theme is different; it uses the default theme due to the special GTK+. This shell has set special environment variables so that program that run will use the fresh GTK+. The rest of the libraries come from our distribution.
If you try to type compose sequences, you will notice no improvement. This is because at the moment jhbuild builds the branch 2.12 of GTK+ and not trunk. We need to download GTK+ from trunk and rebuild.cd ~/checkout/gnome2/ mv gtk+ gtk+-branch-2.12 svn co svn://svn.gnome.org/svn/gtk+/trunk gtk+ jhbuild build --no-network gtk+Perform Step 4 and get gedit running.
How to test?
- Setup a keyboard layout that supports a good variety of dead keys. My preference is GBr (United Kingdom). Here, AltGr+[];’#/ and AltGr+{}:@~? produce different dead keys. You press one of these combinations and then you press a letter. If such a combination exists, then it gets printed. For example, the old GTK+ produces öõóôòx åōőxxx. The new GTK+ produces öõóôòọ åōőǒŏȯ (12 dead keys).
- Setup Greek, Polytonic (Ancient Greek). The dead keys are [];’ {}:@ AltGr+[] (10 dead keys). Produce characters such as ᾅᾂᾷῗὕὒᾥᾢῷ.
- Try compose sequences as described from the upstream file at XOrg. For example,
ComposeKey+( 1 0 ) produces ⑩. Try the same for 0-20, a-zA-Z.
- Other miscellaneous, Ṩǟấẫǡ (using GBr layout)
The next step would be to parse the list of compose sequences and produce a documentation file.
Keyboard layout for combining diacritics
Typically, if you want to type characters with accents, such as á, ë, ś, you need to configure a suitable keyboard layout that includes compose sequences for those characters. The produced characters are what we call as precomposed characters; which were included in the early stages of Unicode. Nowdays, the idea is that you do not need to define á as a distinct character because it can be represented as a and ´, where the latter is a combining diacritic.
When put together a character and a combining diacritic, they fuse together, producing a seemingly single character. á is a precomposed (really one character), while á is letter a and the combining diacritic called acute (two characters). You can type the latter á by
- Type a
- Press Ctrl+Shift+u, then type 301, then press space bar.
Western languages do not really require combining marks, so the existing keyboard layouts do not use them. Other scripts, such as the Congolese keyboard layout (based on Latin) make good use of them.
This is gedit showing off pango and DejaVu fonts (default font in major distributions).
Line 3 is a bit of an extreme, showing a sandwich of combining diacritics.
Line 4 shows the base character a with the combining diacritics from the Unicode range 0×300 to 0×315.
Both lines 3 and 4 were produced easily with a modified keyboard layout, which is show below.
Line 5 is just me being silly. You can have combining diacritics that enclose your base character.
$ cat /usr/share/X11/xkb/symbols/combining
partial alphanumeric_keys alternate_group
xkb_symbols "combining" {
name[Group1] = "Combining diacritics";
key.type[Group1] = "FOUR_LEVEL";
key <AD11> { [ NoSymbol, NoSymbol, 0x1000300, 0x1000301 ] }; // à á
key <AD12> { [ NoSymbol, NoSymbol, 0x1000302, 0x1000303 ] }; // â ã
key <AC10> { [ NoSymbol, NoSymbol, 0x1000304, 0x1000305 ] }; // ā a̅
key <AC11> { [ NoSymbol, NoSymbol, 0x1000306, 0x1000307 ] }; // ă ȧ
key <BKSL> { [ NoSymbol, NoSymbol, 0x1000308, 0x1000309 ] }; // ä ả
key <AB08> { [ NoSymbol, NoSymbol, 0x1000310, 0x1000311 ] }; // a̐ ȃ
key <AB09> { [ NoSymbol, NoSymbol, 0x1000312, 0x1000313 ] }; // a̒ a̓
key <AB10> { [ NoSymbol, NoSymbol, 0x1000314, 0x1000315 ] }; // a̔ a̕
};
$ diff -u /usr/share/X11/xkb/symbols/us.ORIGINAL /usr/share/X11/xkb/symbols/us
--- /usr/share/X11/xkb/symbols/us.ORIGINAL 2008-02-20 11:11:13.000000000 +0000
+++ /usr/share/X11/xkb/symbols/us 2008-02-20 13:02:07.000000000 +0000
@@ -492,3 +492,12 @@
name[Group1]= "U.S. English - Macintosh";
};
+partial alphanumeric_keys modifier_keys
+xkb_symbols "combining_us" {
+
+ include "us"
+ include "combining"
+
+ key.type[Group1] = "FOUR_LEVEL";
+ name[Group1] = "U.S. English - Combining";
+};
$ diff -u /usr/share/X11/xkb/rules/xorg.xml.ORIGINAL /usr/share/X11/xkb/rules/xorg.xml
--- /usr/share/X11/xkb/rules/xorg.xml.ORIGINAL 2008-02-20 11:27:00.000000000 +0000
+++ /usr/share/X11/xkb/rules/xorg.xml 2008-02-20 11:27:48.000000000 +0000
@@ -3643,6 +3643,12 @@
<description xml:lang="zh_TW">Macintosh</description>
</configItem>
</variant>
+ <variant>
+ <configItem>
+ <name>combining_us</name>
+ <description>Combining</description>
+ </configItem>
+ </variant>
</variantList>
</layout>
<layout>
$ _
Then, you select this keyboard layout (U.S. English) and variant (Combining) in the Keyboard Indicator applet.
Unlike dead keys, with combining diacritics you first type the base character (such as a) and then any combining diacritics.
Our sample layout variant puts the diacritics in the physical keys for [];’#,./. For example,
- a + AltGr+[ : à
- a + AltGr+Shift+[ : á
- a + AltGr+[ + AltGr+’ : ằ
If your language has needs that can be solved with combining diacritics, this is how they are solved.
It is quite important to create keyboard layouts for all languages, and actually make good use of them.
Cannot write Greek Polytonic in Linux
For up to date instructions for Greek and Greek Polytonic see How to type Greek, Greek Polytonic in Linux.
The following text is kept for historical purposes. Greek and Greek Polytonic now works in Linux, using the default Greek layout.
General Update: If you have Ubuntu 8.10, Fedora 10 or a similarly new distribution, then Greek Polytonic works out-of-the-box. Simply select the Greek Polytonic layout. For more information, see the recent Greek Polytonic post.
Update 3rd May 2008: If you have Ubuntu 8.04 (probably applies to other recent Linux distributions as well), you simply need to add GTK_IM_MODULE=xim to /etc/environment. Start a Terminal (Applications/Accessories/Terminal) and type the commands (the first command makes a backup copy of the configuration file, and the second opens the configuration file with administrative priviliges, so that you can edit and save):
$ gksudo cp /etc/environment /etc/environment.ORIGINAL
$ gksudo gedit /etc/environment
then append
GTK_IM_MODULE=xim
save, and restart your computer. It should work now. Try to test with the standard Text editor, found in Accessories.
In Ubuntu 8.10 (autumn 2008), it should work out of the box, just by enabling the Greek Polytonic layout.
Update 20th June 2008: If still some accents/breathings/aspirations do not work, then this is probably related to your system locale (whether it is Greek or not). It works better when it is Greek. If you are affected and you do not use the Greek locale, there is one more thing to do.
$ gksudo cp /usr/share/X11/locale/en_US.UTF-8/Compose /usr/share/X11/locale/en_US.UTF-8/Compose.ORIGINAL
$ gksudo cp /usr/share/X11/locale/el_GR.UTF-8/Compose /usr/share/X11/locale/en_US.UTF-8/Compose
The first command makes a backup copy of your original en_US Compose file (assuming you run an English locale; if in doubt, read /usr/share/X11/locale/locale.dir). The second command copies the Greek compose file over the English one. You then logout and login again.
End of updates
To write Greek Polytonic in Linux, a special file is used, which is called the compose file. There is a bit of complication here in the sense that the compose file depends on the current system locale.
To find out which compose file is active on your system, have a look at
/usr/share/X11/locale/compose.dir
Let’s assume your system locale is en_US.UTF-8 (Start Applications/Accessories/Terminal and type locale).
In the compose.dir file it says
en_US.UTF-8/Compose: en_US.UTF-8
Note that the locale is the second field. If you have a different system locale, match on the second field. Many people make a mistake here. Actually, I think be faster for the system to locate the entry if the compose.dir file was sorted by locale.
Therefore, the compose file is
/usr/share/X11/locale/en_US.UTF-8/Compose
So, what’s the problem then?
Well, for the Greek locale (el_GR.UTF-8) we have a different compose file, a compose file in which Greek Polytonic actually works
.
Therefore, there are numerous workarounds here to get Greek Polytonic working.
For example,
- If you speak modern Greek, you can install the Greek locale.
- You can edit /usr/share/X11/locale/compose.dir so that for your locale, the compose file is the Greek one, /usr/share/X11/locale/el_GR.UTF-8/Compose.
- You can edit the Greek compose file, take the Greek Polytonic section and update the Greek Polytonic section of en_US.UTF-8/Compose.
- You can copy the Greek compose file in your home directory under the name .XCompose. I did not try this one, and also you may be affected by this bug. (not tested)
Of course the proper solution is to update en_US.UTF-8/Compose with the updated Greek Polytonic compose sequences. There is a tendency to add the compose sequences of all languages to en_US.UTF-8/Compose, and this actually is happening now. In this respect, it would make sense to rename en_US.UTF-8/Compose into something like general/Compose.
Γράψιμο ελληνικών μέσα από GNOME
Ενημέρωση 2010: Δείτε τις νεώτερες οδηγίες στο How to type Greek, Greek Polytonic in Linux. Το να γράψουμε τώρα ελληνικά σε Linux είναι ό,τι πιο εύκολο.
Οι παρακάτω οδηγίες είναι για πολύ παλιά έκδοση του Linux και δεν τις συνιστούμε πια.
Υπάρχουν διάφοροι τρόποι να γράψει κανείς ελληνικά στο X.org. Εδώ θα δούμε τον τρόπο μέσα από το γραφικό περιβάλλον GNOME. Οι δοκιμές έγιναν σε Fefora Core 2.
Θεωρούμε ότι έχουμε καθορίσει το ελληνικό locale, δηλαδή:
$ locale
LANG=el_GR.UTF-8
LC_CTYPE="el_GR.UTF-8"
LC_NUMERIC="el_GR.UTF-8"
LC_TIME="el_GR.UTF-8"
LC_COLLATE="el_GR.UTF-8"
LC_MONETARY="el_GR.UTF-8"
LC_MESSAGES="el_GR.UTF-8"
LC_PAPER="el_GR.UTF-8"
LC_NAME="el_GR.UTF-8"
LC_ADDRESS="el_GR.UTF-8"
LC_TELEPHONE="el_GR.UTF-8"
LC_MEASUREMENT="el_GR.UTF-8"
LC_IDENTIFICATION="el_GR.UTF-8"
LC_ALL=
Όχι, el_GR δεν είναι ίδιο με el_GR.UTF-8. Είναι σημαντικό να εμφανίζεται el_GR.UTF-8. Δείτε την τεκμηρίωση της διανομής σας για να αλλάξετε το locale. Ακόμα, η χρήση του προγράμματος setxkbmap επηρεάζει αυτό που δοκιμάζουμε εδώ, οπότε μην το εκτελέσετε.

Κάνουμε δεξί κλικ στο ταμπλώ της επιφάνειας εργασίας.

Επιλέγουμε Ενδείκτη Πληκτρολογίου.

Στο ταμπλώ θα εμφανιστεί η προεπιλεγμένη γλώσσα, Αγγλικά Πληκτρολογίου USA.

Κάνουμε δεξί κλικ στο εφαρμογίδιο του Ενδείκτη Πληκτρολογίου (πάνω στο USA) και επιλέγουμε Άνοιγμα Προτιμήσεων Πληκτρολογίου.

Εμφανίζεται ο διάλογος των προτιμήσεων.

Κάνουμε κλικ στις διατάξεις. Προεπιλεγμένη είναι η διάταξη Αγγλικά Αμερικανικού Πληκτρολογίου. Τα ονόματα των διατάξεων έχουν πλέον μεταφραστεί και θα εμφανιστούν στα ελληνικά σε επόμενη έκδοση της διανομής σας.

Προσθέτουμε ελληνικά στις διατάξεις και μεταβαίνουμε στις Επιλογές Διάταξης.

Εδώ επιλέγουμε τον συνδιασμό πλήκτρων για την μεταφορά μεταξύ της αγγλικής και ελληνικής κατάστασης πληκτρολογίου. Λόγω ενός σφάλματος που διερευνούμε, δε λειτουργούν σωστά οι συνδιασμοί Alt-Shift, Ctrl-Shift κτλ. Ο συνδιασμός Left-Shift+Right-Shift λειτουργεί κανονικά και τον επιλέγουμε. Έπειτα πατάμε Κλείσιμο.

Ανοίγουμε τον επεξεργαστή κειμένου του GNOME και δοκιμάζουμε να γράψουμε κάτι στα ελληνικά.

Προσθέτουμε την διάταξη Greek Polytonic για να δοκιμάσουμε τη γραφή πολυτονικού.
Θα παρατηρήσουμε ότι υπάρχει πρόβλημα στη γραφή πολυτονικού και συγκεκριμένα με τα ποικίλα τονικά σημάδια.

Κάνουμε δεξί κλικ πάνω στο παράθυρο του επεξεργαστή κειμένου του GNOME και ελέγχουμε την Μέθοδο Εισαγωγής. Είναι Προεπιλογή.

Το αλλάζουμε σε Μέθοδο Εισαγωγής Χ.

Τώρα γράφουμε πολυτονικά.

Το πρόγραμμα αλλαγής πληκτρολογίου που χρησιμοποιήσαμε το έγραψε ο Sergey Oudaltsov.

Η μετάφραση έγινε από τα εικονιζόμενα άτομα.
