How to easily modify a program in Ubuntu (updated)?
Some time ago we talked about how to modify easily a program in Ubuntu. We gave as an example the modification of gucharmap; we got the deb source package, made the change, compiled, created new .deb files and installed them.
We go the same (well, similar) route here, by modifying the gtk+ library (!!!). The purpose of the modification is to allow us to type, by default, all sort of interesting Unicode characters, including ⓣⓗⓘⓢ , ᾅᾷ, ṩ, and many more.
The result of this exercise is to create replacement .deb packages for the gtk+ library that we are going to install in place of the system libraries. Because these new libraries will not be original Ubuntu packages, the update manager will be pestering us to rollback to the official gtk+ packages. This is actually good in case you want to switch back; you will have the enhanced functionality for as long as you postpone that update.
There is a chance we might screw up our system, so please make backups, or have a few drinks first and come back. I take no responsibility if something bad happens on your system. If you are having any second thoughts, do not follow the next steps; use the safer alternative procedure. You may try however this guide just for the kicks; up to the dpkg command below, no changes are being made to your system.
We use Ubuntu 7.10 here. This should work in other versions, though your mileage may vary.
The compilation procedure takes time (about 30 minutes) and space. Make sure you use a partition with >2GB of free space. We are not going to use up 2GB (a bit less than 1GB), but it's nice not to fill up partitions.
We are going to use the generic instructions on how to recompile a debian package by ducea.
First of all, install the development packages,
sudo apt-get install devscripts build-essential
Next, we use the apt-get source command to get the source code of the GTK+ 2 library,
cd /home/ubuntu/bigpartition_over2GB/apt-get source libgtk2.0-0
We then pull in any dependencies that GTK+ may require. They are normally about a dozen packages, but we do not have to worry for the details.
apt-get build-deplibgtk2.0-0
At this stage we need to touch up the source code of GTK+ before we go into the compilation phase. Visit the bug report #321896 – Synch gdkkeysyms.h/gtkimcontextsimple.c with X.org 6.9/7.0 and download the patch (look under the Attachment section). You should get a file named gtk-compose-update.patch. If you have a look at the patch, you will notice that it expects to find the source of gtk+ in a directory called gtk+. Making a link solves the problem,
ln -s libgtk2.0-0 gtk+
We then attempt to apply the patch (perform a dry run), just in case.
patch -p0 --dry-run < /tmp/gtk-compose-update.patch
If this does not show an error message, you can the command again without the --dry-run.
patch -p0 < /tmp/gtk-compose-update.patch
Finally, we are ready to build our fresh GTK+ library.
cd libgtk2.0-0debuild -us -uc
This will take time to complete, so go and do some healthy cooking.
At the end of the compilation, if all went OK, you should have about a dozen .deb files created. These are one directory higher (do a "cd .."). To install, use dpkg,
dpkg -i *.deb
If you have any other deb files in this directory, it's good to move them away before running the command. If all went ok, the .deb files should install without a hitch.
The final step is to restart your system. To test the new support, see the last section at this post. Use Firefox and OpenOffice.org to type those Unicode characters.
If you managed to wade through all these steps, I would appreciate it if you could post a comment.
Good luck!
Typing squiggles and dots in GNOME and GTK+ applications
Garrett asks how to type squiggles and dots in GNOME; that is, how to type characters such as á à ä ã â ą ȩ ę ő ǰ ǩ ǒ ġ ṅ ȯ ṁ ė.
There are several ways, and one can choose depending on how frequently they need to type them or how much time they need to invest learning.
① One option is to start the Character Map (Applications/Accessories/Character Map), pick the character, copy and paste it. This is good for rare characters and weird situations such as
┏━━━━━━━━━━━━━━━━━━━━━━━┓
⟁⟁⟁⟁♥♀★★▶◀☆♀░░░▒▒▒▓▓▓▙▚▛▙▙▙▞
The Unicode standard, apart from defining characters for languages, it also defines symbols, dingbats and all sort of things. If your distribution is based on the DejaVu fonts (such as Ubuntu), then you are probably covered for many of these symbols. If you do not have a suitable font, or you use Windows, you will be wondering what the hell I am talking about.
② Another option is to use the Character Palette applet which shows an applet on the panel with a configurable small repertoire of characters such as áàéíñó½©ث€. You select one of the characters with the mouse, and wherever you middle-click, this character is typed. This is an improvement over ①, and good when you want to type often rare characters. It is not convenient to type characters found normally on a keyboard layout.
③ To type characters normally found in a specific language(s), it is good to setup a suitable keyboard layout. For this, it is good to add the Keyboard Indicator applet; right click on the panel, click Add to panel... and choose the Keyboard Indicator from the Utilities section. The US English keyboard layout (Default variant) does not provide any interesting characters apart from those shown printed on the keys of a US Keyboard.

The US English International (with dead keys) variant might be a better option,
Or the United Kingdom layout.
You can get a similar image for your layout when you right-click on the Keyboard Indicator applet, then click Show Current Layout.
Each key in the images contain up to four letters. Starting from bottom-left and going clock-wise, these are the keys produced when
ⓐ you press the key
ⓑ you press the key with Shift (or Caps Lock)
ⓒ you press the key with AltGr and Shift (or Caps Lock)
ⓓ you press the key with AltGr
For example, with the UK keyboard layout, the key G produces g, G, Ŋ, ŋ.
If AltGr + Shift + letter does not work for you, see the FDO Bug #2871 Different results for shift-altgr and altgr-shift.
Using the appropriate keyboard layout is the way to go when writing text that require squiggles. You can either choose a layout with dead keys (meaning that some keys lose their normal functionality), or you can pick a layout that still allows you to have dead keys but are available when you press AltGr + key. For example, in the UK Keyboard layout - Default variant, AltGr + ; + a produces á, or AltGr+Shift+]+e produces ē.
Photo by titanas.The OLPC uses those four level for the keyboard layout. You can see the all the variations printed on the keyboard. Click on the image, choose Large size for the details.
④ Another option to produce more characters on the keyboard is to enable the compose key, and use compose sequences. A compose sequence looks similar to what we described above (i.e. AltGr+Shift+]+e to ē) but the idea is that we use it for characters we want to be available across different keyboard layouts that you may have enabled.

The compose key is very powerful functionality, thus it is not enabled by default, and lays hidden in the Layout Options tab. I prefer to set it to Menu, but every person has their own preference.
For example,
- Compose key + - + a produces ã,
- Compose key + < + c produces č
- Compose key + 1 + s produces ¹ (Superscript on 1. Try to replace 1 with 2.)
- Compose key + + + - procudes ±
Currently, GTK+ provides 640 such compose sequences involving the Compose key, and hopefully soon it will increase to over 3000.
The Compose key is known as Multi_key in the source code (Xorg, GTK+, etc).
The Compose key compose sequences offer the ability to define smart mnemonics on how to produce characters. It is much easier to type ComposeKey + 1 + s rather than remembering the codepoint value of ¹ (1 superscript). As with many things open-source, there are too many options, and with the Compose key there is the issue of which shall we pick as a sensible default, and how to make it prominent for those who might want to use it.
It appears to me that there should be more effort to promote the functionality that is provided with the standard keyboard layouts (choose a better keyboard layout, produce characters provided in the third and fourth levels, etc). In this respect, Compose key compose sequences should complement after the main discussion on keyboard layouts take place.
⑤ There is a last issue on switching keyboard layouts to cover in a separate post.
Can you read Coptic?

Coptic is the most recent phase of ancient Egyptian. It is the direct descendant of the ancient language written in Egyptian hieroglyphic, hieratic, and demotic scripts. The Coptic alphabet is a slightly modified form of the Greek alphabet, with some letters (which vary from dialect to dialect) deriving from demotic. As a living language of daily conversation, Coptic flourished from ca. 200 to 1100. The last record of its being spoken was during the 17th century. Coptic survives today as the liturgical language of the Coptic Orthodox Church. Egyptian Arabic is the spoken and national language of Egypt today.
Source: Wikipedia on Coptic Language
Coptic, as used today, has signs of influence from the Greek language. If you speak Greek, you should be able to recognise every entry in the screenshot (it comes from the dictionary that is available from http://copticlang.bizhat.com/).
There is a Coptic Unicode block and there are at least three Unicode fonts available with Coptic glyphs.
I am not aware of a keyboard definition to write Unicode Coptic; Coptic uses several combining diacritical marks (accents) and appears to surpass even Ancient Greek/Polytonic in this respect. An easy way to create (easy to write with?) method would be to start from the Greek keyboard layout and replace the codepoints with the Coptic ones. For the 9 combining diacritical marks, three keys should be dedicated, accessible through 1) pressing as is, 2) pressing with shift, 3) pressing with Alt. To avoid using dead keys, there would be a requirement to type first the letter and then the diacritical mark.
In modern Greek we use the ";:" key (on the right of L) to produce the acute and the diaeresis (with Shift) accents. The second suitable key could be the ' " key while the third the "/?" (debateable).
There are several efforts to convert non-Unicode fonts distributed by the Coptic Church. website. Moheb added the Coptic glyphs to the Freefonts. There is more work required to get them added by default to Linux distros. There is a discussion forum on Coptic.
Therefore, the most important task is to create a keyboard layout so that one can write in Unicode Coptic.
Then, existing (non-Unicode) text should be converted to Unicode Coptic so that there is material available. Moheb created support for this in iconv (glibc). There should be a bug report at http://sources.redhat.com/bugzilla/ under product glibc, component libc.

Source: Wikipedia (Coptic script)
There exist free Unicode fonts already to have the text displayed. The conversion of the Coptic Church fonts to Unicode would be beneficial as well. To have them included in Linux distros, the distribution license should be set to one of the FLOSS licenses. An option could be to add to the DejaVu fonts (allowed by the license) so that there is a general purpose open font that is easy to work with.
I, for one, would love to write Greek using a Coptic keyboard layout and a Coptic Unicode font.
Update: Screenshot that demonstrates how well Unicode Coptic fonts behave when combining marks are used.

Update #2: You can test the above on your system by opening this OpenDocument file using OpenOffice.org or any other OpenDocument-compatible application. OpenOffice.org was verified that it can show combining marks. Your mileage may vary, your comments will be appreciated.

