Fenriswolf 程式筆記

奮利斯狼的地盤,小綿羊勿入

在 JDK 1.4 顯示韓文

在用 swing 時會碰到一個問題,中文、日文顯示是沒問題,但是韓文只會顯示一堆四方格
JDK 1.5 之後對多國語言的支援還蠻完整的,但是在 1.4 預設的編碼 “Arial" 並不支援 unicode
要改成支援 unicode 的字型如 “Arial Unicode MS" 需修改 JDK 內的 font.properties

# @(#)font.properties    1.13 02/03/07
#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# Component Font Mappings
#
dialog.0=Arial Unicode MS,ANSI_CHARSET
dialog.1=WingDings,SYMBOL_CHARSET
dialog.2=Symbol,SYMBOL_CHARSET
dialog.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
dialog.4=\uad74\ub9bc,HANGEUL_CHARSET

dialog.bold.0=Arial Bold,ANSI_CHARSET
dialog.bold.1=WingDings,SYMBOL_CHARSET
dialog.bold.2=Symbol,SYMBOL_CHARSET
dialog.bold.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
dialog.bold.4=\uad74\ub9bc,HANGEUL_CHARSET

dialog.italic.0=Arial Italic,ANSI_CHARSET
dialog.italic.1=WingDings,SYMBOL_CHARSET
dialog.italic.2=Symbol,SYMBOL_CHARSET
dialog.italic.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
dialog.italic.4=\uad74\ub9bc,HANGEUL_CHARSET

dialog.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
dialog.bolditalic.1=WingDings,SYMBOL_CHARSET
dialog.bolditalic.2=Symbol,SYMBOL_CHARSET
dialog.bolditalic.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
dialog.bolditalic.4=\uad74\ub9bc,HANGEUL_CHARSET

dialoginput.0=Courier New,ANSI_CHARSET
dialoginput.1=WingDings,SYMBOL_CHARSET
dialoginput.2=Symbol,SYMBOL_CHARSET

dialoginput.bold.0=Courier New Bold,ANSI_CHARSET
dialoginput.bold.1=WingDings,SYMBOL_CHARSET
dialoginput.bold.2=Symbol,SYMBOL_CHARSET

dialoginput.italic.0=Courier New Italic,ANSI_CHARSET
dialoginput.italic.1=WingDings,SYMBOL_CHARSET
dialoginput.italic.2=Symbol,SYMBOL_CHARSET

dialoginput.bolditalic.0=Courier New Bold Italic,ANSI_CHARSET
dialoginput.bolditalic.1=WingDings,SYMBOL_CHARSET
dialoginput.bolditalic.2=Symbol,SYMBOL_CHARSET

serif.0=Times New Roman,ANSI_CHARSET
serif.1=WingDings,SYMBOL_CHARSET
serif.2=Symbol,SYMBOL_CHARSET
serif.3=\uff2d\uff33 \u660e\u671d,SHIFTJIS_CHARSET


serif.bold.0=Times New Roman Bold,ANSI_CHARSET
serif.bold.1=WingDings,SYMBOL_CHARSET
serif.bold.2=Symbol,SYMBOL_CHARSET

serif.italic.0=Times New Roman Italic,ANSI_CHARSET
serif.italic.1=WingDings,SYMBOL_CHARSET
serif.italic.2=Symbol,SYMBOL_CHARSET

serif.bolditalic.0=Times New Roman Bold Italic,ANSI_CHARSET
serif.bolditalic.1=WingDings,SYMBOL_CHARSET
serif.bolditalic.2=Symbol,SYMBOL_CHARSET

sansserif.0=Arial Unicode MS,ANSI_CHARSET
sansserif.1=WingDings,SYMBOL_CHARSET
sansserif.2=Symbol,SYMBOL_CHARSET
sansserif.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
sansserif.4=\uad74\ub9bc,HANGEUL_CHARSET

sansserif.bold.0=Arial Bold,ANSI_CHARSET
sansserif.bold.1=WingDings,SYMBOL_CHARSET
sansserif.bold.2=Symbol,SYMBOL_CHARSET
sansserif.bold.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
sansserif.bold.4=\uad74\ub9bc,HANGEUL_CHARSET

sansserif.italic.0=Arial Italic,ANSI_CHARSET
sansserif.italic.1=WingDings,SYMBOL_CHARSET
sansserif.italic.2=Symbol,SYMBOL_CHARSET
sansserif.italic.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
sansserif.italic.4=\uad74\ub9bc,HANGEUL_CHARSET

sansserif.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
sansserif.bolditalic.1=WingDings,SYMBOL_CHARSET
sansserif.bolditalic.2=Symbol,SYMBOL_CHARSET
sansserif.bolditalic.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
sansserif.bolditalic.4=\uad74\ub9bc,HANGEUL_CHARSET


monospaced.0=Courier New,ANSI_CHARSET
monospaced.1=WingDings,SYMBOL_CHARSET
monospaced.2=Symbol,SYMBOL_CHARSET
monospaced.3=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET

monospaced.bold.0=Courier New Bold,ANSI_CHARSET
monospaced.bold.1=WingDings,SYMBOL_CHARSET
monospaced.bold.2=Symbol,SYMBOL_CHARSET

monospaced.italic.0=Courier New Italic,ANSI_CHARSET
monospaced.italic.1=WingDings,SYMBOL_CHARSET
monospaced.italic.2=Symbol,SYMBOL_CHARSET

monospaced.bolditalic.0=Courier New Bold Italic,ANSI_CHARSET
monospaced.bolditalic.1=WingDings,SYMBOL_CHARSET
monospaced.bolditalic.2=Symbol,SYMBOL_CHARSET

# Font File Names
#
filename.\uad74\ub9bc=gulim.TTC
filename.\ubc14\ud0d5=batang.TTC
filename.\uad74\ub9bc\uccb4=gulim.TTC

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.WingDings=WINGDING.TTF
filename.Symbol=SYMBOL.TTF

filename.\uff2d\uff33_\u660e\u671d=MSMINCHO.TTC
filename.\uff2d\uff33_\u30b4\u30b7\u30c3\u30af=MSGOTHIC.TTC

# Missing Glyph Character
#
default.char=2751

# Component Font Character Encodings
#
fontcharset.dialog.0=sun.io.CharToByteCp1252
fontcharset.dialog.1=sun.awt.windows.CharToByteWingDings
fontcharset.dialog.2=sun.awt.CharToByteSymbol

fontcharset.dialoginput.0=sun.io.CharToByteCp1252
fontcharset.dialoginput.1=sun.awt.windows.CharToByteWingDings
fontcharset.dialoginput.2=sun.awt.CharToByteSymbol

fontcharset.serif.0=sun.io.CharToByteCp1252
fontcharset.serif.1=sun.awt.windows.CharToByteWingDings
fontcharset.serif.2=sun.awt.CharToByteSymbol

fontcharset.sansserif.0=sun.io.CharToByteCp1252
fontcharset.sansserif.1=sun.awt.windows.CharToByteWingDings
fontcharset.sansserif.2=sun.awt.CharToByteSymbol

fontcharset.monospaced.0=sun.io.CharToByteCp1252
fontcharset.monospaced.1=sun.awt.windows.CharToByteWingDings
fontcharset.monospaced.2=sun.awt.CharToByteSymbol

# Text Input Character Set
#
inputtextcharset=ANSI_CHARSET

複製這個檔案到 /jre/lib 下並命名為 font.properties
不過目錄下有好幾個 font.properties.XXX,系統會依環境讀取優先權較高的那個檔案
想知道規則請看參考資料並把檔案重新命名
不想研究的話把其他的檔案殺掉只留 font.properties 就好了
 
 
執行環境
windows 2000
JDK 1.4.2_14

參考資料
Loading Font Configuration Files
font.properties file should include a unicode font to catch unusual characters

程式下載
font.properties

廣告

2012/03/19 - Posted by | Java SE

仍無迴響。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

w

連結到 %s

%d 位部落客按了讚: