Unicode beyond FFFF

How to display Unicode sets beyond FFFF, such as Gothic or Old Italic?

I tried the code below, but it just doesn't work, even though the font "Code2001" (downloaded from http://home.att.net/~jameskass/code2001.htm) works well in browsers.

My poor Java:

import java.awt.*;

import javax.swing.*;

class UnicodeFonts

{

JFrame frame;

JLabel label;

JButton button;

Font font;

Container contentPane;

publicstaticvoid main(String[] args)

{

new UnicodeFonts();

}

UnicodeFonts()

{

String sUnicode="";

int codePoints;

label=new JLabel("default label");

button=new JButton("default button");

int start=0;

int tamil=0x0b80;

int oldItalic=0x10300;

int devanagari=2304;

start=devanagari;

for(int i=0;i<16;i++)

{

for(int j=0;j<16;j++)

{

codePoints= j + i*16 + start;

sUnicode=sUnicode+(char)codePoints;

}

}

font=new Font("Courier", Font.PLAIN, 16);

label.setFont(font);

label.setText(sUnicode);

sUnicode="";

start=oldItalic;

for(int i=0;i<16;i++)

{

for(int j=0;j<16;j++)

{

codePoints= j + i*16 + start;

sUnicode=sUnicode+(char)codePoints;

}

}

//downloaded from http://home.att.net/~jameskass/code2001.htm

font=new Font("Code2001", Font.PLAIN, 26);

button.setFont(font);

button.setText(sUnicode);

frame=new JFrame("UnicodeFonts");

frame.setSize(600,400);

contentPane=frame.getContentPane();

contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));

contentPane.add(label);

contentPane.add(button);

frame.setVisible(true);

}

}

My lucky HTML:

<!DOCTYPE html PUBLIC'-//W3C//DTD XHTML 1.0 Transitional//EN''http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>

<html xml:lang='en' lang='en' xmlns='http://www.w3.org/1999/xhtml'><head>

<meta http-equiv='content-type' content='text/html;charset=x-user-defined'/>

<title>Etruscan</title>

</head>

<body style='font-family:"Code2001","Etruscan Epigraphic", "Etruscan", "Etruscan mid/late Bold";'>

&#x10300; &#x10301; &#x10302; &#x10303; &#x10304; &#x10305; &#x10306; &#x10307; &#x10308; &#x10309; &#x1030A; &#x1030B; &#x1030C; &#x1030D; &#x1030E; &#x1030F; &#x10310; &#x10311; &#x10312; &#x10313;

&#x10314; &#x10315; &#x10316; &#x10317; &#x10318; &#x10319; &#x1031A; &#x1031B; &#x1031C; &#x1031D; &#x1031E; &#x1031F; &#x10320; &#x10321; &#x10322; &#x10323; &#x10324; &#x10325; &#x10326; &#x10327;

&#x10328; &#x10329; &#x1032A; &#x1032B; &#x1032C; &#x1032D; &#x1032E; &#x1032F;

</body>

</html>

[4795 byte] By [astlandaa] at [2007-10-3 2:22:28]
# 1
You can't just cast those high codepoint values to char; they won't fit. You have to convert them to surrogate pairs with [url= http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Character.html#toChars(int)]this method[/url].
uncle_alicea at 2007-7-14 19:21:26 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thank you, uncle_alice!

I found the solution on my own already.

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=592090

Explanations :

http://java.sun.com/developer/technicalArticles/Intl/Supplementary/

I had to upgrade my Java to jdk1.5 as well.

my regards.

astlandaa at 2007-7-14 19:21:26 > top of Java-index,Desktop,Core GUI APIs...
# 3
int codePoint=0x10300; String sUnicode=sUnicode+new String(Character.toChars(codePoint));Sorry
astlandaa at 2007-7-14 19:21:26 > top of Java-index,Desktop,Core GUI APIs...