Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java 1.5 + AWT + Japanese character problem while creating tiff file.

843807Apr 2 2009

Below mentioned sample code works fine in java 1.4 but not is java1.5 running on windows 2003


import java.awt.Font;
import java.awt.font.TextAttribute;
import java.util.Map;
import java.util.Hashtable;


public class ShowFonts
{
public static void main ( String [] args )
{
Map fontMap;
Font f;
String japaneseFont;
japaneseFont = "MS Gothic";
fontMap = new Hashtable();
fontMap.put(TextAttribute.FAMILY, japaneseFont);
fontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR);
fontMap.put(TextAttribute.WIDTH, TextAttribute.WIDTH_EXTENDED);
fontMap.put(TextAttribute.SIZE, new java.lang.Float(25.0f));
f = new Font(fontMap);


// prints "Courier", what you originally asked for
System.out.println( f.getName() );


// prints "monospaced", the family you actually got
System.out.println( f.getFamily() );


// prints "monospaced.italic", includes style you got
System.out.println( f.getFontName());


}
}

Please find below output for both java1.4/java1.5


D:\cb_appl\cds\classes>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)


D:\cb_appl\cds\classes>java ShowFonts
MS Gothic
‚l‚r ƒSƒVƒbƒN
‚l‚r ƒSƒVƒbƒN



D:\cb_appl\cds\classes>java -version
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)


D:\cb_appl\cds\classes>java ShowFonts
MS Gothic
MS Gothic
MS Gothic


D:\cb_appl\cds\classes>

I already changed the fontconfig.properties file for japanese character settings but still same error.

allfonts.japanese=MS Gothic
sequence.allfonts=alphabetic/default,dingbats,symbol,japanese

Please help to resolve this problem

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2009
Added on Apr 2 2009
0 comments
119 views