PDA

View Full Version : Why weird Chinese text display on Preview Frame, but correct



Anonymous
09-14-2002, 01:36 AM
Why does the Preview Frame show strange Chinese text (a little skewed and mixed) that is to be printed? When really printed, the text looks fine on the printed pager.

My environment is:
JDK 1.3.1
Windows ME
JFreeReport 0.7.6

Thanks in advance!

Best Regards,
Scott

Anonymous
09-15-2002, 03:12 PM
Hi,

please give me a hint: You don't intend to print chinese text, don't you? Can you send or post the font definitons you use for your report? And do you use unicode sequences to fill the text into the report or do you use plain ascii text?

Have more fun,
said Thomas

Anonymous
09-16-2002, 01:36 PM
Thanks for your reply!

I tried to use the example provided by the tutorial "com.jrefinery.report.demo.First" and it's XML definition first.xml. When executed, the sample program had its preview frame which allowed one to move on to the next preview page. On the next preview page, the page header section included a "date" information, the month field of which was displayed in a native language, i.e. Chinese in my case. I could see the Chinse "August," but the Chinse "August" seemed uneasy to identify with what it ought to be because it looks a little skewed and mixed. When I tried to add more Chinese into the header section, the situation remained unchanged. Up to this point, I kept using all the settings in the first.xml. Then, I even tried to change the setting fontname="Bia-Kai-Ti," where "Biau-Kai-Ti" (phonetically translated) is a kind of Chinese font, but nothing worked. As to whether Unicode sequence was filled into the report, I would think it did because I could still see the Chinese "August", though somewhat skewed, mixed, and not easy to identify. If the Unicode was erroneously interpreted, there should not be Chinese-"August"-like words.

Best Regards,
Scott

Anonymous
09-16-2002, 03:03 PM
Hi,

this seems to be a locale specific problem. The date field definition in first.xml is written as "d-MMM-yyyy" and is interpreted as "day-(Month as text (locale specific))-year". So if you see a weird August, then this name is defined in your JDK, and not in the report.

As you recognized the letters and could read the word "August", I believe that the font "Biau-Kai-Ti" is able to display the needed unicode sequences. Is the word "August" displayed weird if you print it using a label? If the word is ok, I would beliefe that your JDK is producing this buggy month name.

Have more fun anyway,
said Thomas

Anonymous
09-17-2002, 08:16 AM
I've tried the following code. The preview frame, where I included a "Chinese August" JLabel, showed pretty fine, i.e. the right and easily recognized "Chinese August" on my added JLabel. But still, the wield "Chinese August" on the printed scrollable pages.



// the 3rd line is my added trial
PreviewFrame frame = new PreviewFrame(this.report);
frame.setToolbarFloatable(true);
frame.getContentPane().add( new javax.swing.JLabel("Chinese August"), BorderLayout.SOUTH );
frame.pack ();

Thank you, anyway!

Best Regards,
Scott