New Tibetan Phone Project on Google Code

January 29th, 2010 Comments Off

I just started an open-source project, “Gyutrul Drawa” for a Tibetan phone environment, seeding it with the code to render Tibetan properly on Android, at:

https://code.google.com/p/gyutruldrawa/

gyutrul-drawa

“Gyutrul Drawa” is Tibetan for the “Magical Net,” which is one of the core texts of the Nyingma tradition, translated into Tibetan in the 8th century from Indian sources.  Since our own modern Magical Net has appeared in the last 20 or so years, it felt appropriate to bring the name forward and use it again.

It doesn’t do much yet, but at least it renders a Tibetan web page properly in Android once you’ve unlocked your phone and installed the Jomolhari font, following the instructions at Nathan Freitas’s blog. (Note that the Tibetan Machine Uni font he suggests installing will NOT work with this, you must use Jomolhari.)

Future plans are to write a Tibetan landing page, improve the browser, and add the following applications:

  • Connections to the various IM systems that support Unicode
  • E-mail client
  • Tibetan-English dictionary
  • PDF reader with Tibetan-language buttons (to support reading scanned texts such as those from TBRC)

It may be possible to perform a similar technique to render Tibetan properly on the iPhone (and iPod Touch and iPad, of course).  I hope to test that out when I get a chance.

Feel free to contact me if you’d like to help out with this project.

Proper Rendering of Tibetan in Android

January 18th, 2010 § 12

Summary: I managed to get Tibetan script rendering accurately on Android, even without Complex Script support, thanks to a Tibetan Unicode font with support for the GB/T20524-2006 standard.

Since I’ve been studying Tibetan, and have started programming on Android, I thought I’d try out Nathan Freitas’ instructions on enabling Tibetan font support in Android.  I’m not going to duplicate his instructions here, but they involve rooting your phone and installing a Tibetan Unicode font to replace the built-in DroidSansFallback font, used to display Chinese, Japanese, and Korean.

However, once I got it working, I realized that, though the characters were indeed Tibetan, they weren’t properly laid out.  Tibetan is a fairly complex language to render properly, since it allows for quite complex vertical stacks of characters with idiosyncratic joining rules.  Here is an example, taken from a supplication to Tara, showing how it was originally rendered on my cell phone:

badtibetansample

OM JE TSUN MA PAK MA DROL MA (Om, the Revered Lady Noble Tara)

If you don’t know Tibetan, that could look decent (and certainly mysteriously beautiful), so let me show the end result, how it’s supposed to look:

goodtibetansample

OM JE TSUN MA PAK MA DROL MA (Om, the Revered Lady Noble Tara)

Note that the letters don’t overlap anymore, and some of them have changed shape to accommodate their companions.  For example, the first syllable, an OM, has had its accents adjusted so they don’t overlap, and the shape of the NA-RO, the seagull-like accent, has been changed to anchor it off of the middle line.  The second syllable has more drastic changes, where the RA is simplified to blend in with the JA below it properly.  In the third syllable, the SHAB-KYU, the hook accent underneath, has been moved up snug to its letter.  The last major change is toward the end, where a RA subscript has been moved down to join up properly with the bottom of its stack.

Though the individual glyphs were being rendered perfectly, they were not being combined properly.  It turns out the need for better language support is a long-standing complaint about Android, and is in the Issues list as #5925.   Comment 15 is a very good description by an unidentified Google engineer of the core problems with Complex Script Support.  (If you’d like to encourage Android to support this properly, please add a comment to that issue.)  The main problem is that, though FreeType (used in Android for font rendering) renders fonts perfectly, there is no support for the ligatures necessary to render complex writing systems such as Arabic, Thai, Devanagiri, and Tibetan.

Chris Fynn is one of the main people who’s been working on Tibetan Unicode standards, and his font, Jomolhari, is my favorite Tibetan font (you can see it in the above pictures, and it’s available under the Open Font License).  He helped with Tibetan rendering in Pango, HarfBuzz, and ICU, any of which would render Tibetan properly, but none of these have yet been integrated into Android.  He lives in Bhutan, and I met him when I visited there.

Chris mentioned that there is a less-well-known Tibetan text encoding named GB/T20524-2006, which resides in the 0xF300 to 0xF8FF space. The “right way” to handle Tibetan has always been to combine glyphs on the fly.  However, since the Chinese are used to having a separate encoding of each unique combination of characters, they created a Chinese National Standard using the Unicode Private Use Area (PUA) to encode each combination of Tibetan glyphs as a single precomposed ligature.  Chris implemented support for this in Jomolhari partly in an effort to get Tibetan fonts working properly in some products (such as Adobe InDesign and Photoshop) that didn’t fully support Tibetan at the time.

He suggested using Andrew West’s BabelPad, which is a Unicode text editor that also supports all sorts of interesting conversions (including rewriting various Tibetan, Mongolian, Manchu, and Vietnamese encodings as Unicode), to re-encode whatever I wanted to display in Tibetan.  This worked once I installed Jomolhari on the handset as the DroidSansFallback.tff font.

I realized that, using Android’s WebView and WebViewClient classes, I could build a Tibetan web browser that intercepted url requests, downloaded the HTML, and rewrote any Tibetan Unicode as precomposed characters.  I would just have to implement a massive conversion table to do it.  Fortunately, Andrew West gave me a code sample in C++ that implemented this 1500-line table, and I was able to quickly port it to Java.  (BTW, for future reference, don’t cut-and-paste large C++ code files directly into Eclipse’s java editor.  It grinds away for a long time, patiently highlighting all the syntax errors for you, before it lets you fix any of them.)  It worked the first time I got it to compile, resulting in a beautiful, properly rendered web page.

A screenshot of the Tibetan WebView app.

A screenshot of the Tibetan WebView app.

I’m planning to clean up the rough edges on the browser, and release that code soon as the seed of a Tibetan open-source Android suite.  I thought that I’d make the Java code implementing the conversion available right away, even though it could also use some optimizing & clean-up, so that others can work with it.  It’s available at:

http://tom.to/code/TibConvert.java

It’s very easy to use:

composedData = TibConvert.convertUnicodeToPrecomposedTibetan(data);

I look forward to being able to help out with other useful Tibetan apps, such as a custom keyboard, IM and e-mail apps, and a dictionary.  Please contact me if you’re interested in working together on these types of things.

I’ve really been enjoying the Android development process.   Running code and debugging code directly on the handset is working well, and I like how the libraries are structured.  This might be what it takes for me to get back into having fun with developing client-side Java.

May there be a great flourishing of Tibetan apps on the Android!  Ge-lek pel!

BTW, I spent some time trying to get Tibetan font support working on a stock Android phone, without having to root it, using the font embedding technique described here.  I couldn’t get it to work (just lots of beautiful boxes showing up instead of Tibetan), but they say that some fonts just don’t work to embed.  Of course, embedding a 2.2MB font inside an app might be pushing the envelope a bit, but it would be great if someone could get this to work.  Though it appears that the only widgets you can set the font for are TextView widgets, so you wouldn’t get a web browser that way, and you’d also have to re-implement a new widget set derived from TextView to get it to show up properly.

Google Nexus and Android Development

January 14th, 2010 Comments Off

Now that lots of Android-based devices have come out, and especially now that it’s moving past being used “just” for phones, but also for tablets & netbooks, I’ve decided to buckle down and really get involved in developing for the platform.  I was at CES last week, and there were several e-readers and other devices being shown there running Android, so it’s obviously getting ready to go big time. I wouldn’t be surprised if there will be Android-based TVs, microwaves, and even washing machines next year.

I’ve been working my way through the substantial platform documentation, and am quite impressed with the programming model.  Though it’s Java, it feels much more like working with ActionScript, in that it uses a lot of the more modern approaches to getting things working.  And the platform gives you a LOT more control over what kinds of apps you can develop that the iPhone platform, since you can easily create background processes and services that other apps can use, run multiple apps at the same time, etc.  This is getting me excited about developing in Java again, after having left it behind for ActionScript and Python.

I started working with Java back in the days when it was called Oak, and was a Sun research project, and spent a lot of time developing interactive client-side applications in the Java 1.0 and 1.1 days (mostly interactive e-commerce and advertising applications).  Though, at the time, the libraries were fairly simple, that was also one of the beauties of Java.  As it started being used for more server-side development, and the libraries started growing, I felt that Java had lost a lot of that purity of design.  In fact, I started calling it the “COBOL of the Internet,” since it seemed that developing in Java had become one of the most verbose ways possible to get anything done.  In my opinion, the committees extending it had massively overused design patterns to the point where you had to write a dozen lines of code to get the simplest things working.

I know a lot of people complained that Google had broken compatibility with J2ME and other mobile platforms by creating their own Java libraries, but I feel it was a necessary step to get things back to a more sane development environment.

I ordered a Nook and a Nexus, so I could work with two completely different Android form factors.  The Nook’s back-ordered for a month, so my review of that will have to wait, but the Nexus is quite a nice phone.  I love the animated boot-up screen and the animated home-screen background, but the apps I’ve downloaded and played with so far don’t feel as polished as the iPhone apps.  There’s a bit of a lack of polish, but that could be due to the relative newness of the platform, and due to the different developer culture that Android attracts (not as focused on beautiful interactions as the iPhone community).  One thing that I really dislike about the default Android skin is that it’s difficult to tell what’s a button, since the regular buttons are just bits of text with no border.  If you know you’re supposed to press them, that’s great, but without some indication that something’s able to be pressed, it’s pretty confusing.  In general, though, it shows a lot of promise.

If I were a  device manufacturer, Android would be my first choice to look at as the basis for developing  a hardware product.

CES “Butterflies”

January 8th, 2010 Comments Off

I’m at CES, but since there’s plenty of coverage of all the big announcements, I thought I’d feature some of the more beautiful yet seemingly impractical products out there on the show floor.  For some reason, these seem to be coming from Korea.  Perhaps they even have a word for something strikingly beautiful yet impractical in Korean; let me know if someone knows the word for such a thing.  They feel as if they are relics from the future, where technology is so deeply integrated into stuff that it just becomes part of the background of the object.

Unfortunately, I took these photos without keeping track of the names of the companies that produced them, so you may have to treat this as a bit of a treasure hunt.  Please let me know if you know who produced them, and I’ll give them proper credit.  Or, if I have time, I’ll track them down again today before I leave.

The first set is from a small booth in the North Hall, in the Korean section of the International Gateway.  Each of these pieces has small, iPhone-size video screens embedded in them, with animated versions of the types of traditional paintings you would find on a folding multi-panel rice-paper screen.

Video Folding Screen

Video Folding Screen

This first one is the most straightforward; it’s just over a foot high, and has eight animated videos playing on it.

Video Boat

Video Boat

This uses the same technology with six animated screens to make something reminiscent of a sailboat.  This is the first one I saw, and is quite beautifully finished with lacquer and gold leaf.

Video Fan

Video Fan

This is my favorite one, and resembles a folding fan with twelve video screens forming a continuous series of animated panels.  Due to the electronics involved that appear to be hidden in the base, I don’t believe it could be used as a fan (though it’s believable that it could fold and unfold), but in a few years, I wouldn’t be surprised if something like this becomes an actual portable product.

"Music Baggie"

"Music Baggie"

The “Music Baggie” is from another Korean company showing in South Hall 2, that has used flat, bendable Electrostatic speakers to create audio devices that can be part of textiles.  Electrostatic speakers aren’t as commonly seen now, but they used to be targeted at audiophiles.  They were also showing electrostatic headphones, but those  didn’t look as interesting, so I didn’t photograph them.  This seems like a semi-reasonable product, perhaps for high-end shopping bags.

Music Roll

Music Roll

This is by the same company and uses the same technology to create a speaker consisting of a cylindrical roll.  They claim that you can vary the audio characteristics to suit your tastes by rolling it tighter or looser.  This sounded pretty decent, actually.

Music Boat

Music Boat

My final photo is from a different Korean company also located in the South Hall, using similar electrostatic speaker technology.  Their main product appears to be transparent speaker films that you can place over displays, so you don’t have to have separate speakers from the displays.  However, I really liked this example, where they made boat sails out of the speaker film, and integrated it with a sailboat design.  Perhaps next year, we’ll see a combination of the boat-sail video screen with the boat-sail speaker to make a perfect multimedia model boat.

Bodies the Exhibition

January 7th, 2010 Comments Off

I arrived in Las Vegas yesterday morning, the day before CES, since my brother and his wife are in town for their own conference (ending today).  Rather than just wandering around looking at the pretty blinkenlights or, worse yet, putting money into all the slot-machines scattered around the floor, we went to go see the plasticized bodies exhibit at Luxor.

I’ve been wanting to see them for years, so was really glad to have some time to do it, though it took a bit of convincing before my squeamish sister-in-law would come along (she stopped watching House once there was too much blood & guts).

I always thought there was just the single exhibition, but I’ve learned while researching this post that there are at least three different companies that prepare these bodies and exhibit them.  The best one seems to be Body Worlds, which was started by Gunther von Hagens, and is managed through a body donation program where people offer their bodies to be part of the exhibit.  For me, this is totally acceptable.  If someone wants to offer their body for education, that is their complete right, and we should be thankful for their generosity.  The one at the Luxor, Bodies the Exhibition, unfortunately, has been dogged by controversy because the bodies are prepared in China without documentation of consent, and may even have been Chinese prisoners.  If I’d known that, I wouldn’t have gone.

Nevertheless, the idea of housing preserved human remains inside a giant pyramid (admittedly not a traditional one) at least makes more sense than most of the overall postmodernity of Las Vegas.  I just wish that they’d worked with an exhibition that showed more care and respect for the human condition.

Since I didn’t know this while viewing the exhibit (I thought it was a version of the von Hagens exhibit), we really found it quite interesting and informative.  You really do develop a deeper understanding of how the body works, where the organs are, and how everything fits together.  And it’s not as gross as we thought it might be.  My sister-in-law found it fascinating, except that the display of embryonic and fetal development was a bit difficult for her.

Turns out that I really don’t like the thought of the human body being sliced in half vertically; there were two of those there, and though I was able to detach myself to examine them, it was much more difficult than the other bodies there.

The amount of delicate and careful work to remove major muscles while preserving delicate nerves and veins intact was also quite impressive.  Regardless of the ethical issues involved, it was very beautifully done.  The preserved veins and arteries, where they injected plastic into the blood vessels of an organ, and then removed the surrounding flesh, had an amazing coral-like quality.

I wish I could recommend this to others, but the issues regarding body sourcing outweigh everything else in this exhibit for me.  Instead, please go see Body Worlds, if you can.

Where am I?

You are currently viewing the archives for January, 2010 at tom at tom dot to.