f



problem with java displaying unicode, under ms-windows

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?

0
phil178 (84)
7/22/2012 5:31:30 AM
comp.lang.java.programmer 52711 articles. 1 followers. Post Follow

14 Replies
1133 Views

Similar Articles

[PageSpeed] 4

hil@bolthole.com 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.

> 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.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
0
noone7 (4050)
7/22/2012 6:48:16 AM
On Sat, 21 Jul 2012 22:31:30 -0700 (PDT), phil@bolthole.com 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?
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.

rossum

0
rossum48 (719)
7/22/2012 11:53:31 AM
On Saturday, July 21, 2012 11:48:16 PM UTC-7, Lew wrote:
> 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)

0
phil178 (84)
7/22/2012 12:00:26 PM
On Sunday, July 22, 2012 4:53:31 AM UTC-7, rossum wrote:
> >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 o=
f 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 availab=
le
> 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.
>=20

That's what I'm trying to do: have the jre change which font it uses for th=
e 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" m=
apping. The default seems like it should be using the already-installed fon=
ts.

Except it isnt.

Could someone who knows about these things, and is currently running ms-win=
dows, 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 pro=
vide a java program that I can freely download and run, that will show unic=
ode chars in a GUI window. I havent found any third party test cases, which=
 is why a long time ago, I wrote my own trivial little unicode GUI tester c=
lass.
( http://www.bolthole.com/java/unicode)

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

0
phil178 (84)
7/22/2012 12:47:21 PM
On 7/22/2012 5:47 AM, Philip Brown wrote:

> 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);
          }
       });

    }
}
0
markspace
7/22/2012 3:46:27 PM
On 7/21/2012 10:31 PM, phil@bolthole.com 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);
             }
         });
     }
}


0
nospam8071 (1252)
7/22/2012 4:22:52 PM
On Sunday, July 22, 2012 9:22:52 AM UTC-7, Knute Johnson wrote:
> ....
> 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 Sunday, July 22, 2012 9:22:52 AM UTC-7, Knute Johnson wrote:
> On 7/21/2012 10:31 PM, phil@bolthole.com 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);
>              }
>          });
>      }
> }

0
phil178 (84)
7/22/2012 4:55:51 PM
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.


0
markspace
7/22/2012 5:10:28 PM
On Sunday, July 22, 2012 10:10:28 AM UTC-7, markspace wrote:
> 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.
0
phil178 (84)
7/22/2012 5:37:13 PM
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?


#
#
# 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


0
markspace
7/22/2012 6:31:04 PM
On Sunday, July 22, 2012 11:31:04 AM UTC-7, markspace wrote:
> 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.
0
phil178 (84)
7/22/2012 6:40:45 PM
On 7/22/2012 10:37 AM, Philip Brown wrote:
>
> step 1: copy (jre)/lib/fontconfig.properties.src to

I found some more info, which I think I'll archive in this thread.

Some older documentation on the fontconfig.properties file:


http://docs.oracle.com/javase/1.5.0/docs/guide/intl/fontconfig.html


This software is referenced by the Java 7 release notes, apparently for 
building fontconfig files.

http://www.freedesktop.org/wiki/Software/fontconfig

http://docs.oracle.com/javase/7/docs/technotes/guides/2d/enhancements70.html
0
markspace
7/22/2012 6:47:54 PM
On Sunday, July 22, 2012 10:37:13 AM UTC-7, Philip Brown wrote:
>
> 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.

 
 
> 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
> 
0
phil178 (84)
7/22/2012 7:09:18 PM
Philip Brown wrote:
> Lew wrote:
>> 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.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
0
noone7 (4050)
7/22/2012 8:15:42 PM
Reply: