problem with java displaying unicode, under ms-windows

P

phil

Hi folks,
I'm hoping someone can tell me the magic to get java (6 or 7) to display unicode chars under ms-windows?

This is a standalone program, not an applet:

http://bolthole.com/jdrill/jdrill2_3_1.jar

The program itself works; I know this, because it displays fine under macos.
Unfortunately, the exact same jar file displays empty boxes instead of nice kanji chars, under ms-windows. Using java version 6 or 7.

Looking in the font properties type files, it seems like they are referencing ms-gothic and ms-mincho fonts. which ARE present on the system.
I see ms-gothic and ms-mincho in Control panel->fonts
And my browser successfully displays unicode pages such as
http://www.mainichi.co.jp/

So... why isnt java displaying unicode properly???

Some years ago, it was neccessary to download a special "international" version of java on windows, to display 16-bit-wide fonts.
but there does not even seem to be that option any more.
So.. what should I do?
 
L

Lew

I'm hoping someone can tell me the magic to get java [sic] (6 or 7) to display unicode [sic] chars under ms-windows [sic]?

This is really an OS question.

Java will emit characters using the target OS's encoding by default.

The fact is that Java is already displaying Unicode characters. However it is
Windows that is failing to render them.

Do you set the encoding explicitly in your program.
This is a standalone program, not an applet:

http://bolthole.com/jdrill/jdrill2_3_1.jar

The program itself works; I know this, because it displays fine under macos.
Unfortunately, the exact same jar file displays empty boxes instead of nice kanji chars, under ms-windows. Using java version 6 or 7.

Looking in the font properties type files, it seems like they are referencing ms-gothic and ms-mincho fonts. which ARE present on the system.
I see ms-gothic and ms-mincho in Control panel->fonts
And my browser successfully displays unicode pages such as
http://www.mainichi.co.jp/

So... why isnt java displaying unicode properly???

Some years ago, it was neccessary to download a special "international" version of java on windows, to display 16-bit-wide fonts.
but there does not even seem to be that option any more.
So.. what should I do?

See if specifying the encoding in your output commands helps.
 
P

Philip Brown

Philip Brown wrote:
> I'm hoping someone can tell me the magic to get java [sic] (6 or 7) to display unicode [sic] chars under ms-windows [sic]?

This is really an OS question.

Java will emit characters using the target OS's encoding by default.

The fact is that Java is already displaying Unicode characters. However it is
Windows that is failing to render them.

Do you set the encoding explicitly in your program.

I think I did.
If I didnt, wouldnt it fail under macos?

It works under macos, as I said.

Similarly, if I failed to set the encoding properly... wouldnt it just display gibberish chars?

Instead, its displaying the old empty square "no font mapping for this char" glyph.

Similarly.. when it attempts to display a char, it is displaying ONE empty-square.
If the encoding was not set, it would display two empty chars, since it's displaying a 2-byte "widechar"

Not to mention that the same program has worked under earlier versions of windows and jre.
(And by "same program", I mean *same* program)
 
P

Philip Brown

>http://bolthole.com/jdrill/jdrill2_3_1.jar
>
>The program itself works; I know this, because it displays fine undermacos.
>Unfortunately, the exact same jar file displays empty boxes instead of nice kanji chars, under ms-windows. Using java version 6 or 7.
...
Does your Windows font have those kanji characters available? The box
character is a replacement for "I do not have this character available
in the font you specify so I will show this box instead". Try
changing your Windows font to one which includes the required kanji
characters.

That's what I'm trying to do: have the jre change which font it uses for the unicode->local font mapping.
Unfortunately, there are no directions for this. And even me poking around behind the scenes, suggests that it already should be doing the "correct" mapping. The default seems like it should be using the already-installed fonts.

Except it isnt.

Could someone who knows about these things, and is currently running ms-windows, please take a moment to download the program and verify that java on windows isnt working right, and how to fix it?

It works out of the box in macos.
It works out of the box in solaris.
Therefore, seems like my program is fine, but there's something wrong with the java 7 setup on ms-windows.

Contrariwise, if you still think it's my program that is broken: please provide a java program that I can freely download and run, that will show unicode chars in a GUI window. I havent found any third party test cases, whichis why a long time ago, I wrote my own trivial little unicode GUI tester class.
( http://www.bolthole.com/java/unicode)

All the examples for "java unicode" I've found, merely use System.out.println(). Not what is needed here!!
 
M

markspace

Could someone who knows about these things, and is currently running
ms-windows, please take a moment to download the program and verify


I don't download code, as a rule. Can you produce a simple, short,
complete, compilable example that prints a few characters from the range
you are interested in, and post the source here? That I will look at.

Contrariwise, if you still think it's my program that is broken:
please provide a java program that I can freely download and run,


This works for me:

package quicktest;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;

/**
*
* @author Brenden
*/
public class UpperCodepoint {

public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
StringBuilder stb = new StringBuilder();
stb.appendCodePoint(0x20FF0);
JFrame frame = new JFrame();
JTextArea ta = new JTextArea();
frame.add(ta);
ta.setText(stb.toString());

frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setSize(500, 500);
frame.setVisible(true);
}
});

}
}
 
K

Knute Johnson

Hi folks,
I'm hoping someone can tell me the magic to get java (6 or 7) to display unicode chars under ms-windows?

This is a standalone program, not an applet:

http://bolthole.com/jdrill/jdrill2_3_1.jar

The program itself works; I know this, because it displays fine under macos.
Unfortunately, the exact same jar file displays empty boxes instead of nice kanji chars, under ms-windows. Using java version 6 or 7.

Looking in the font properties type files, it seems like they are referencing ms-gothic and ms-mincho fonts. which ARE present on the system.
I see ms-gothic and ms-mincho in Control panel->fonts
And my browser successfully displays unicode pages such as
http://www.mainichi.co.jp/

So... why isnt java displaying unicode properly???

Some years ago, it was neccessary to download a special "international" version of java on windows, to display 16-bit-wide fonts.
but there does not even seem to be that option any more.
So.. what should I do?

I copied some text from www.mainichi.co.jp into Libre Office. I saved
the text as UTF-8. I used the program below to display it. It isn't
quite correct though, I get a dot before the text that wasn't on the web
page. Other than that it works fine.

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.nio.charset.*;
import javax.swing.*;

public class test extends JPanel {
private char[] buffer = new char[256];
private int n;

public test() {
setPreferredSize(new Dimension(320,240));
try {
FileInputStream fis = new FileInputStream("xxx");
InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
n = isr.read(buffer,0,256);
isr.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}

public void paintComponent(Graphics g) {
g.setFont(new Font("MS Mincho",Font.PLAIN,12));
g.drawChars(buffer,0,n,10,20);
}

public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.add(new test(),BorderLayout.CENTER);
f.pack();
f.setVisible(true);
}
});
}
}
 
P

Philip Brown

....
I copied some text from www.mainichi.co.jp into Libre Office. I saved
the text as UTF-8. I used the program below to display it. It isn't
quite correct though, I get a dot before the text that wasn't on the web
page. Other than that it works fine.


Interesting. But it breaks the concept of "write once run anywhere", to set a platform specific font. My issue centers on how to make it work WITHOUT that hack.
As I mentioned, my program currently runs fine on MacOS, Solaris, linux, .....
I dont want any OS-specific code in my program (nor should I have to have any?!)

btw: thanks to markspace for his code, but I'm using AWT.
Kindasorta like Knute's code, but with plain Frame, not JFrame, as top.


On 7/21/2012 10:31 PM, (e-mail address removed) wrote:
> Hi folks,
> I'm hoping someone can tell me the magic to get java (6 or 7) to display unicode chars under ms-windows?
>
> This is a standalone program, not an applet:
>
> http://bolthole.com/jdrill/jdrill2_3_1.jar
>
> The program itself works; I know this, because it displays fine under macos.
> Unfortunately, the exact same jar file displays empty boxes instead of nice kanji chars, under ms-windows. Using java version 6 or 7.
>
> Looking in the font properties type files, it seems like they are referencing ms-gothic and ms-mincho fonts. which ARE present on the system.
> I see ms-gothic and ms-mincho in Control panel->fonts
> And my browser successfully displays unicode pages such as
> http://www.mainichi.co.jp/
>
> So... why isnt java displaying unicode properly???
>
> Some years ago, it was neccessary to download a special "international" version of java on windows, to display 16-bit-wide fonts.
> but there does not even seem to be that option any more.
> So.. what should I do?
>

I copied some text from www.mainichi.co.jp into Libre Office. I saved
the text as UTF-8. I used the program below to display it. It isn't
quite correct though, I get a dot before the text that wasn't on the web
page. Other than that it works fine.

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.nio.charset.*;
import javax.swing.*;

public class test extends JPanel {
private char[] buffer = new char[256];
private int n;

public test() {
setPreferredSize(new Dimension(320,240));
try {
FileInputStream fis = new FileInputStream("xxx");
InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
n = isr.read(buffer,0,256);
isr.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}

public void paintComponent(Graphics g) {
g.setFont(new Font("MS Mincho",Font.PLAIN,12));
g.drawChars(buffer,0,n,10,20);
}

public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.add(new test(),BorderLayout.CENTER);
f.pack();
f.setVisible(true);
}
});
}
}
 
M

markspace

btw: thanks to markspace for his code, but I'm using AWT.
Kindasorta like Knute's code, but with plain Frame, not JFrame, as top.


It works the same for AWT. They all use the same drawChars() method
underneath.
 
P

Philip Brown

On 7/22/2012 9:55 AM, Philip Brown wrote:
> btw: thanks to markspace for his code, but I'm using AWT.
> Kindasorta like Knute's code, but with plain Frame, not JFrame, as top.


It works the same for AWT. They all use the same drawChars() method
underneath.

Yeah, I figured.
The good news is, I found a solution to get the JRE working properly in windows, so it can work as well as MacOS.


step 1: copy (jre)/lib/fontconfig.properties.src to fontconfig.properties
step 2: modify the line

sequence.allfonts=alphabetic/default,dingbats,symbol

to be
sequence.allfonts=alphabetic/default,dingbats,symbol,japanese

The odd thing is,the MacOS fontconfig.properties, is not set up that way. But It Works. Oh well.
 
M

markspace

step 1: copy (jre)/lib/fontconfig.properties.src to
fontconfig.properties step 2: modify the line

sequence.allfonts=alphabetic/default,dingbats,symbol

to be sequence.allfonts=alphabetic/default,dingbats,symbol,japanese


Thanks for reporting your solution back to us, it helps out everyone.
However I'm concerned that you may have, or have now, a defective
installation. Here's my file; there's already a different line for
Japanese script set. Is your file very different from mine?


#
#
# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights
reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

# Version

version=1

# Component Font Mappings

allfonts.chinese-ms936=SimSun
allfonts.chinese-ms936-extb=SimSun-ExtB
allfonts.chinese-gb18030=SimSun-18030
allfonts.chinese-gb18030-extb=SimSun-ExtB
allfonts.chinese-hkscs=MingLiU_HKSCS
allfonts.chinese-ms950-extb=MingLiU-ExtB
allfonts.devanagari=Mangal
allfonts.dingbats=Wingdings
allfonts.lucida=Lucida Sans Regular
allfonts.symbol=Symbol
allfonts.thai=Lucida Sans Regular
allfonts.georgian=Sylfaen

serif.plain.alphabetic=Times New Roman
serif.plain.chinese-ms950=MingLiU
serif.plain.chinese-ms950-extb=MingLiU-ExtB
serif.plain.hebrew=David
serif.plain.japanese=MS Mincho
serif.plain.korean=Batang

serif.bold.alphabetic=Times New Roman Bold
serif.bold.chinese-ms950=PMingLiU
serif.bold.chinese-ms950-extb=PMingLiU-ExtB
serif.bold.hebrew=David Bold
serif.bold.japanese=MS Mincho
serif.bold.korean=Batang

serif.italic.alphabetic=Times New Roman Italic
serif.italic.chinese-ms950=PMingLiU
serif.italic.chinese-ms950-extb=PMingLiU-ExtB
serif.italic.hebrew=David
serif.italic.japanese=MS Mincho
serif.italic.korean=Batang

serif.bolditalic.alphabetic=Times New Roman Bold Italic
serif.bolditalic.chinese-ms950=PMingLiU
serif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
serif.bolditalic.hebrew=David Bold
serif.bolditalic.japanese=MS Mincho
serif.bolditalic.korean=Batang

sansserif.plain.alphabetic=Arial
sansserif.plain.chinese-ms950=MingLiU
sansserif.plain.chinese-ms950-extb=MingLiU-ExtB
sansserif.plain.hebrew=David
sansserif.plain.japanese=MS Gothic
sansserif.plain.korean=Gulim

sansserif.bold.alphabetic=Arial Bold
sansserif.bold.chinese-ms950=PMingLiU
sansserif.bold.chinese-ms950-extb=PMingLiU-ExtB
sansserif.bold.hebrew=David Bold
sansserif.bold.japanese=MS Gothic
sansserif.bold.korean=Gulim

sansserif.italic.alphabetic=Arial Italic
sansserif.italic.chinese-ms950=PMingLiU
sansserif.italic.chinese-ms950-extb=PMingLiU-ExtB
sansserif.italic.hebrew=David
sansserif.italic.japanese=MS Gothic
sansserif.italic.korean=Gulim

sansserif.bolditalic.alphabetic=Arial Bold Italic
sansserif.bolditalic.chinese-ms950=PMingLiU
sansserif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
sansserif.bolditalic.hebrew=David Bold
sansserif.bolditalic.japanese=MS Gothic
sansserif.bolditalic.korean=Gulim

monospaced.plain.alphabetic=Courier New
monospaced.plain.chinese-ms950=MingLiU
monospaced.plain.chinese-ms950-extb=MingLiU-ExtB
monospaced.plain.hebrew=Courier New
monospaced.plain.japanese=MS Gothic
monospaced.plain.korean=GulimChe

monospaced.bold.alphabetic=Courier New Bold
monospaced.bold.chinese-ms950=PMingLiU
monospaced.bold.chinese-ms950-extb=PMingLiU-ExtB
monospaced.bold.hebrew=Courier New Bold
monospaced.bold.japanese=MS Gothic
monospaced.bold.korean=GulimChe

monospaced.italic.alphabetic=Courier New Italic
monospaced.italic.chinese-ms950=PMingLiU
monospaced.italic.chinese-ms950-extb=PMingLiU-ExtB
monospaced.italic.hebrew=Courier New
monospaced.italic.japanese=MS Gothic
monospaced.italic.korean=GulimChe

monospaced.bolditalic.alphabetic=Courier New Bold Italic
monospaced.bolditalic.chinese-ms950=PMingLiU
monospaced.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
monospaced.bolditalic.hebrew=Courier New Bold
monospaced.bolditalic.japanese=MS Gothic
monospaced.bolditalic.korean=GulimChe

dialog.plain.alphabetic=Arial
dialog.plain.chinese-ms950=MingLiU
dialog.plain.chinese-ms950-extb=MingLiU-ExtB
dialog.plain.hebrew=David
dialog.plain.japanese=MS Gothic
dialog.plain.korean=Gulim

dialog.bold.alphabetic=Arial Bold
dialog.bold.chinese-ms950=PMingLiU
dialog.bold.chinese-ms950-extb=PMingLiU-ExtB
dialog.bold.hebrew=David Bold
dialog.bold.japanese=MS Gothic
dialog.bold.korean=Gulim

dialog.italic.alphabetic=Arial Italic
dialog.italic.chinese-ms950=PMingLiU
dialog.italic.chinese-ms950-extb=PMingLiU-ExtB
dialog.italic.hebrew=David
dialog.italic.japanese=MS Gothic
dialog.italic.korean=Gulim

dialog.bolditalic.alphabetic=Arial Bold Italic
dialog.bolditalic.chinese-ms950=PMingLiU
dialog.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
dialog.bolditalic.hebrew=David Bold
dialog.bolditalic.japanese=MS Gothic
dialog.bolditalic.korean=Gulim

dialoginput.plain.alphabetic=Courier New
dialoginput.plain.chinese-ms950=MingLiU
dialoginput.plain.chinese-ms950-extb=MingLiU-ExtB
dialoginput.plain.hebrew=David
dialoginput.plain.japanese=MS Gothic
dialoginput.plain.korean=Gulim

dialoginput.bold.alphabetic=Courier New Bold
dialoginput.bold.chinese-ms950=PMingLiU
dialoginput.bold.chinese-ms950-extb=PMingLiU-ExtB
dialoginput.bold.hebrew=David Bold
dialoginput.bold.japanese=MS Gothic
dialoginput.bold.korean=Gulim

dialoginput.italic.alphabetic=Courier New Italic
dialoginput.italic.chinese-ms950=PMingLiU
dialoginput.italic.chinese-ms950-extb=PMingLiU-ExtB
dialoginput.italic.hebrew=David
dialoginput.italic.japanese=MS Gothic
dialoginput.italic.korean=Gulim

dialoginput.bolditalic.alphabetic=Courier New Bold Italic
dialoginput.bolditalic.chinese-ms950=PMingLiU
dialoginput.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
dialoginput.bolditalic.hebrew=David Bold
dialoginput.bolditalic.japanese=MS Gothic
dialoginput.bolditalic.korean=Gulim

# Search Sequences

sequence.allfonts=alphabetic/default,dingbats,symbol

sequence.serif.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb
sequence.sansserif.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb
sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol,chinese-ms936-extb
sequence.dialog.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb
sequence.dialoginput.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb

sequence.serif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb
sequence.sansserif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb
sequence.monospaced.GB18030=chinese-gb18030,alphabetic,dingbats,symbol,chinese-gb18030-extb
sequence.dialog.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb
sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb

sequence.serif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb
sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb
sequence.monospaced.x-windows-950=chinese-ms950,alphabetic,dingbats,symbol,chinese-ms950-extb
sequence.dialog.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb
sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb

sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb

sequence.serif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.sansserif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.monospaced.x-MS950-HKSCS-XP=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.dialog.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
sequence.dialoginput.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb

sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol
sequence.allfonts.UTF-8.ja=alphabetic,japanese,devanagari,dingbats,symbol

sequence.allfonts.windows-1255=hebrew,alphabetic/1252,dingbats,symbol

sequence.serif.windows-31j=alphabetic,japanese,dingbats,symbol
sequence.sansserif.windows-31j=alphabetic,japanese,dingbats,symbol
sequence.monospaced.windows-31j=japanese,alphabetic,dingbats,symbol
sequence.dialog.windows-31j=alphabetic,japanese,dingbats,symbol
sequence.dialoginput.windows-31j=alphabetic,japanese,dingbats,symbol

sequence.serif.x-windows-949=alphabetic,korean,dingbats,symbol
sequence.sansserif.x-windows-949=alphabetic,korean,dingbats,symbol
sequence.monospaced.x-windows-949=korean,alphabetic,dingbats,symbol
sequence.dialog.x-windows-949=alphabetic,korean,dingbats,symbol
sequence.dialoginput.x-windows-949=alphabetic,korean,dingbats,symbol

sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol

sequence.fallback=lucida,\

chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\

japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian

# Exclusion Ranges

exclusion.alphabetic=0700-1e9f,1f00-20ab,20ad-f8ff
exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be
exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac

# Monospaced to Proportional width variant mapping
# (Experimental private syntax)
proportional.MS_Gothic=MS PGothic
proportional.MS_Mincho=MS PMincho
proportional.MingLiU=PMingLiU
proportional.MingLiU-ExtB=PMingLiU-ExtB

# Font File Names

filename.Arial=ARIAL.TTF
filename.Arial_Bold=ARIALBD.TTF
filename.Arial_Italic=ARIALI.TTF
filename.Arial_Bold_Italic=ARIALBI.TTF

filename.Courier_New=COUR.TTF
filename.Courier_New_Bold=COURBD.TTF
filename.Courier_New_Italic=COURI.TTF
filename.Courier_New_Bold_Italic=COURBI.TTF

filename.Times_New_Roman=TIMES.TTF
filename.Times_New_Roman_Bold=TIMESBD.TTF
filename.Times_New_Roman_Italic=TIMESI.TTF
filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF

filename.SimSun=SIMSUN.TTC
filename.SimSun-18030=SIMSUN18030.TTC
filename.SimSun-ExtB=SIMSUNB.TTF

filename.MingLiU=MINGLIU.TTC
filename.MingLiU-ExtB=MINGLIUB.TTC
filename.PMingLiU=MINGLIU.TTC
filename.PMingLiU-ExtB=MINGLIUB.TTC
filename.MingLiU_HKSCS=hkscsm3u.ttf

filename.David=DAVID.TTF
filename.David_Bold=DAVIDBD.TTF

filename.MS_Mincho=MSMINCHO.TTC
filename.MS_PMincho=MSMINCHO.TTC
filename.MS_Gothic=MSGOTHIC.TTC
filename.MS_PGothic=MSGOTHIC.TTC

filename.Gulim=gulim.TTC
filename.Batang=batang.TTC
filename.GulimChe=gulim.TTC

filename.Lucida_Sans_Regular=LucidaSansRegular.ttf
filename.Mangal=MANGAL.TTF
filename.Symbol=SYMBOL.TTF
filename.Wingdings=WINGDING.TTF

filename.Sylfaen=sylfaen.ttf
 
P

Philip Brown

On 7/22/2012 10:37 AM, Philip Brown wrote:

> step 1: copy (jre)/lib/fontconfig.properties.src to
> fontconfig.properties step 2: modify the line
>
> sequence.allfonts=alphabetic/default,dingbats,symbol
>
> to be sequence.allfonts=alphabetic/default,dingbats,symbol,japanese


Thanks for reporting your solution back to us, it helps out everyone.
However I'm concerned that you may have, or have now, a defective
installation. Here's my file; there's already a different line for
Japanese script set. Is your file very different from mine?

I'm not sure what you mean by "japanese script set".
Please identify the specific line you mean.

If you mean, "Hey there are lines in here that reference japanese, so it should work already"..
well, yes, that was exactly my first impression, too! :) but I found it was neccessary to make the above tweak.

I'm going to reference my full source code in a followup post.
 
M

markspace

P

Philip Brown

Yeah, I figured.
The good news is, I found a solution to get the JRE working properly in windows, so it can work as well as MacOS.

fyi, if anyone is curious as to what exactly my program is doing:

I thought I had lost the source code, which made me very sad:( but I found an ooold version of it.

For the terminally curious, I've made it available at

http://www.bolthole.com/jdrill/jdrill-2.0-src.tar.gz

Warning: It was written in 1999, and in AWT :)

It's rather long, so for anyone interested, I'll suggest that you look at the GamePanel class (which is the main window), and specifically the (Label) MAIN_B object, which is the object that initially comes up with a Kanji char in it.

It should be noted that it does "set a font"; however, it just grabs the generic "dialog" font. Paraphrasing the code a bit:
font = new Font("dialog", 0, 24);

This gets its label string set to a value cached from a
KanjiDicLine obj, either from obj.getEnglish or obj.getKanji

The Kanji object is a regular String object, populated by an operational chain that looks something like
BufferedReader(InputStreamReader(file, "EUCJIS")).readLine
->String ->StringBuffer ->char[] -> String
(mostly in parseKDLine(). which is used to parse a line from the dictionary file "KanjiDic", a small version of which is in the source code tarfile)

So basically, it is a raw unicode string.
Which is supposed to be handled by java transparently, I thought.

I set the Label's label to be a raw unicode string, and expect it to "do the right thing".

On MacOS, it does the right thing. On windows, it doesnt, unless I do that hack.
 
L

Lew

Philip said:
Lew said:
Philip Brown wrote:
I'm hoping someone can tell me the magic to get java [sic] (6 or 7) to display unicode [sic] chars under ms-windows [sic]?

This is really an OS question.

Java will emit characters using the target OS's encoding by default.

The fact is that Java is already displaying Unicode characters. However it is
Windows that is failing to render them.

Do you set the encoding explicitly in your program.

I think I did.

Then show us the line of code where you did.

You don't need to guess. Look at the code. You either will see an encoding
specified or you won't.
If I didnt, wouldnt it fail under macos [sic]?

Not if the default encoding of the platform and available fonts just
coincidentally happen to be what you want.
It works under macos [sic], as I said.

Yes, and that's not relevant.
Similarly, if I failed to set the encoding properly... wouldnt it just display gibberish chars?

No. It will either display the characters that correspond according to its own
encoding, or the placeholder for characters that it doesn't recognize or for
which it doesn't have an appropriate font.

And what do you mean by "gibberish"?
Instead, its displaying the old empty square "no font mapping for this char" glyph.

Eh, so absent your answer about what encoding you specified, I can only guess
that either the Windows encoding doesn't give you what you want, which
historically has been an issue with Windows but I don't know about your
version, or you don't have the fonts you need.

Since you won't confirm your encoding choices, or even show the code you
vaguely describe with respect to the fonts you select, it's a little difficult
to take the answer any further.
Similarly.. when it attempts to display a char, it is displaying ONE empty-square.
If the encoding was not set, it would display two empty chars, since it's displaying a 2-byte "widechar"

Maybe. Maybe not. It depends on what the default platform encoding is.
Not to mention that the same program has worked under earlier versions of windows and jre.
(And by "same program", I mean *same* program)

OK, whatever.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top