How to display conjunctive letters [Bengali] using LWUIT on a mobile phone?

I am trying to develop a simple J2ME application using LWUIT in Bengali. However, due to the heavy use of vowels as conjunctive letters in Bengali, I ran into some problems with LWUIT.

For example, say "X" is a consonant, and "@" works like a vowel in Bengali; they are now merged together when necessary to become the merged "X @" format. Using LWUIT, when I add vowels like this and try to display them as a concatenated consonant format in a real application, they are concatenated with their previous letter (which is in sequential order) as defined in the encoding. Interestingly though, in the LWUIT designer / designer preview, the symbols are displayed correctly.

See here ( http://dibbaa.com/lwuit/doc/lwuit.doc ) for details and see real examples.

I would be grateful if anyone can help me with this. Just let me know how I can set the LWUIT structure so that it does not line up the letters as defined in the encoding in sequential order as they are drawn. I used LWUIT version 1.3 and font "KarnaphuliP.ttf" for my application.

thanks

+2


a source to share


2 answers


I don't know anything about Bangali and I can't find the font you mentioned. But I managed to get an alternative font to recreate the problem: "Bengali-Progoty.TTF" (which unfortunately doesn't look like yours). You can get the font here: Bengali-Progoty.TTF .

These vowels are special because their width is zero and I'm pretty sure their point of origin is top right, not top left. Thus, vowels can be drawn on top of other characters that precede them.

When the lwuit designer generates a bitmap font, it draws each character (which I mean, a Unicode character) onto a large bitmap, calculates the width of the current character, adds that width to the current offset, and draws the next character. Since the vowel is zero-wide, it will be concatenated with the last unspoken character preceding it.

To fix this, you can either switch to a unicode font (Bangali has a place in unicode), or you can stick with the current font and do some work on customizing the font generation process.



1 Create your own class by overriding the class EditorFont

in lwuit editor.jar.
2 Override the method EditorFont#getBitmapFont()

, make your own drawing of each symbol. You can check if any character is a vowel, and if so, draw it with the previous space.
3 Override the FontTask

Ant task provided in the lwuit editor.jar file.
4 Override the method FontTask#addToResources()

, insert your own EditorFont instance instead of the original one.
5 Override the LWUITTask class, add a method AddXXX

to support your redundant FontTask.
6 Create a resource with ant and use your version of LWUITTask and FontTask instead of the original version.
7 . Since vowels have become regular characters, they will occupy the same space as other characters and can no longer be drawn over other characters. You have to draw them on top of other characters by hand. The class com.sun.lwuit.CustomFont

can be overridden to draw these vowels correctly.

Given the complexity introduced, I highly recommend switching to unicode font. But as I said, I don't know anything about Bangali and can't tell if using a Unicode font is enough. You may have to do it anyway.

Good luck.

+2


a source


I think you might be better off implementing your own virtual keyboard. There is a sample in the LWUIT developer guide and demo. I'm sure if you take the time it will be helpful later.



0


a source







All Articles