简体   繁体   中英

J2ME Tamil(UniCode) Character Display

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 ?

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM