0

I tried a many way to print tamil character in J2ME application whose unicode value U0BB5.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.midlet.*;

/**
 * @author arun kumar non ascii
 */
public class SampleMidlet extends MIDlet {

    Display display;
    Form form = null;
    String ms = null;
    NewClass obj;

    public void startApp() {
        display = Display.getDisplay(this);
        form = new Form("Unicode Test");
        byte[] b = new byte[2];
        b[0] = 0x0b;
        b[1] = (byte) 0xb5;
        try {
            form.append("type0" + "வ");
            form.append("type1" + new String(b, "UTF-16"));
            form.append("type2" + new StringItem("", "\u0bb5").getText());
            form.append("type3" + "\u0bb5");
            form.append("type4" + new StringBuffer("\u0bb5"));
            form.append("type5" + new StringBuffer().append((char) Integer.parseInt("2997", 10)));
            form.append("type6" + ((char) Integer.parseInt("0bb5", 16)));

            char[] text = new char[]{'\u0bb5'};
            form.append(new String(text));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        display.setCurrent(form);

    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}

but all the time it shows white box alone as shown. OnMicroEmultor

where as in Netbeans emulator also shows the same, I'm targeting configuration for CLDC 1.1 and MIDP 2.0 .How to display that character without using Bitmap font (Image)file of that character ?

Arunkumar Chandrasekaran
  • 1,211
  • 4
  • 21
  • 40

2 Answers2

0

Square boxes normally mean that the Font is unable to display that character. The encoding is fine, but you need a different Font.

This link explains how to change the Fonts on the emulator: http://www.devarticles.com/c/a/Java/J2ME-and-Unicode/1/

David Lavender
  • 8,021
  • 3
  • 35
  • 55
  • of course its unable to display that character,My question is how to display that one on mobile. – Arunkumar Chandrasekaran Feb 28 '13 at 09:18
  • have added link to answer. Not sure how you get new fonts on to the phone though, but that should work with the emulator. – David Lavender Feb 28 '13 at 09:21
  • I already came across that link it works for japanese,Arabic on emulator not for Tamil,but though tamil is unicode why it is not supporting.don't you seem the code where merely same – Arunkumar Chandrasekaran Feb 28 '13 at 09:24
  • Why the down vote? Seems a little harsh. Fonts are the problem, and weren't mentioned in the question. – David Lavender Feb 28 '13 at 09:37
  • question is about displaying Unicode character ,font or visual glyph are inter related to the question, – Arunkumar Chandrasekaran Feb 28 '13 at 09:41
  • @arun I have no idea how you expect to *display* a character without a *visual* glyph. – R. Martinho Fernandes Feb 28 '13 at 11:30
  • did i said anything without visual glyph? i just need to display character in any feasible way. – Arunkumar Chandrasekaran Feb 28 '13 at 11:44
  • 1
    As far as I was told, J2ME only supports a subset of the unicode characters. So Tamil might very well just not be supported. When/if you see Tamil in apps/games, they're most probably created using bitmap fonts. That means, a PNG file containing all the characters + some code to render a String using those characters. It's not that difficult to code. Sadly though, I don't think you can use a bitmap font on a highlevel app (meaning one that uses Forms). I think you'll need to use Canvas/GameCanvas when using Bitmap fonts. – mr_lou Mar 01 '13 at 06:59
0

As with comment proper bitmap file can capable to produce the font on j2me app. MJbookmaker is capable tool which produce desire format for j2me application

Arunkumar Chandrasekaran
  • 1,211
  • 4
  • 21
  • 40