Java的中文字型

來源:互聯網
上載者:User

java中文支援(或亂碼的解決):java程式是跨平台的,但需要解決中文支援問題。
方法很簡單,就是在java安裝目錄下放進去一個中文字型即可。
cd /usr/lib/jvm/java-6-sun/jre/lib/fonts
  sudo mkdir fallback
  cd fallback
  sudo ln -s /usr/share/fonts/truetype/wqy/wqy-zenhei.ttf(把某個中文字型連結進 fallback 目錄,我選了最新的文泉驛夸父字型)
  sudo mkfontdir
  sudo mkfontscale

 

 

對於Java 1.4,其配置有所不同,設定檔名是font.properties,現將其內容附於下:

# %W% %E%
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# Component Font Mappings For RedhatLinux 8.0/zh_CN
#
serif.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
serif.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

serif.italic.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

serif.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

serif.bold.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

serif.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

serif.bolditalic.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

serif.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

sansserif.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.italic.0=-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.bold.0=-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1
sansserif.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.bolditalic.0=-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.italic.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.bold.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.bolditalic.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

dialog.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.italic.0=-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1
dialog.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.bold.0=-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1
dialog.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.bolditalic.0=-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.italic.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.bold.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.bolditalic.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

# Missing Glyph Character
#
default.char=274f

# Component Font Character Encodings
#
fontcharset.serif.0=sun.io.CharToByteISO8859_1
fontcharset.serif.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.sansserif.0=sun.io.CharToByteISO8859_1
fontcharset.sansserif.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.monospaced.0=sun.io.CharToByteISO8859_1
fontcharset.monospaced.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.dialog.0=sun.io.CharToByteISO8859_1
fontcharset.dialog.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.dialoginput.0=sun.io.CharToByteISO8859_1
fontcharset.dialoginput.1=sun.io.CharToByteUnicodeBigUnmarked

# Exclusion Ranges
#

# XFontSet Information
#
fontset.serif.plain=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.serif.italic=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.serif.bold=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.serif.bolditalic=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.plain=\
-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.italic=\
-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.bold=\
-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.bolditalic=\
-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.plain=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.italic=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.bold=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.bolditalic=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.italic=\
-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.bold=\
-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.bolditalic=\
-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.plain=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.italic=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.bold=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.bolditalic=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.plain=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.default=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

filename.-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1=/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc

filename.-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc

appendedfontpath=/usr/share/fonts/wqy-zenhei/

 

 

弄好後,將font.properties.*刪除,再看看ConsolePanel裡邊的字是不是好了?

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.