我尝试了很多方法在J2ME应用程序中打印tamil字符
வ
,其unicode值为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) {
}
}
但是它总是单独显示白盒子,如图所示。
在Netbeans模拟器中也显示相同的内容,我的目标是CLDC 1.1和MIDP 2.0的配置。如何在不使用该字符的Bitmap字体(图像)文件的情况下显示该字符?
答案 0 :(得分:0)
方框通常表示Font无法显示该字符。编码很好,但你需要一个不同的字体。
此链接说明如何更改模拟器上的字体:http://www.devarticles.com/c/a/Java/J2ME-and-Unicode/1/
答案 1 :(得分:0)
与评论一样,正确的位图文件可以在j2me app上生成字体。 MJbookmaker是能够为j2me应用程序生成所需格式的工具