Enable display of Vietnamese on Java components on Linux

Windows, Linux/Unix, Solaris, Mac OS X, Palm,...

Enable display of Vietnamese on Java components on Linux

Postby quân » Sun Apr 25, 2004 9:57 pm

Trên Linux với Java 1.4.x, để cho phép hiển thị chữ Việt mà không cần phải programmatically đặt font cho từng component, ta có thể chỉnh/thay file font.properties file dưới jre/lib subdirectory như sau:

On Linux with Java 1.4.x, to enable display of Vietnamese characters without programmatically setting font for each component, you may want to edit/replace the font.properties file under jre/lib subdirectory as follows:

Code: Select all
# @(#)font.properties.linux   1.7 02/03/07
#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# Component Font Mappings
#
serif.0=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
serif.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
serif.2=-monotype-Times New Roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1

serif.italic.0=-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1
serif.italic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
serif.italic.2=-monotype-Times New Roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1

serif.bold.0=-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1
serif.bold.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
serif.bold.2=-monotype-Times New Roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1

serif.bolditalic.0=-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1
serif.bolditalic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
serif.bolditalic.2=-monotype-Times New Roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1

sansserif.0=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
sansserif.2=-monotype-Arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1

sansserif.italic.0=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.italic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
sansserif.italic.2=-monotype-Arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1

sansserif.bold.0=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bold.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
sansserif.bold.2=-monotype-Arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1

sansserif.bolditalic.0=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
sansserif.bolditalic.2=-monotype-Arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1

monospaced.0=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
monospaced.2=-monotype-Courier New-medium-r-normal--*-%d-*-*-m-*-iso10646-1

monospaced.italic.0=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.italic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
monospaced.italic.2=-monotype-Courier New-medium-i-normal--*-%d-*-*-m-*-iso10646-1

monospaced.bold.0=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bold.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
monospaced.bold.2=-monotype-Courier New-bold-r-normal--*-%d-*-*-m-*-iso10646-1

monospaced.bolditalic.0=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
monospaced.bolditalic.2=-monotype-Courier New-bold-i-normal--*-%d-*-*-m-*-iso10646-1

dialog.0=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialog.2=-monotype-Arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1

dialog.italic.0=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.italic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialog.italic.2=-monotype-Arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1

dialog.bold.0=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bold.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialog.bold.2=-monotype-Arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1

dialog.bolditalic.0=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialog.bolditalic.2=-monotype-Arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1

dialoginput.0=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialoginput.2=-monotype-Courier New-medium-r-normal--*-%d-*-*-m-*-iso10646-1

dialoginput.italic.0=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.italic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialoginput.italic.2=-monotype-Courier New-medium-i-normal--0-0-0-0-m-0-iso10646-1

dialoginput.bold.0=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bold.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialoginput.bold.2=-monotype-Courier New-bold-r-normal--*-%d-*-*-m-*-iso10646-1

dialoginput.bolditalic.0=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.1=--standard symbols l-medium-r-normal--*-%d-*-*-p-*-urw-fontspecific
dialoginput.bolditalic.2=-monotype-Courier New-bold-i-normal--*-%d-*-*-m-*-iso10646-1

# Missing Glyph Character
#
default.char=274f

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

fontcharset.sansserif.0=sun.io.CharToByteISO8859_1
fontcharset.sansserif.1=sun.awt.CharToByteSymbol

fontcharset.monospaced.0=sun.io.CharToByteISO8859_1
fontcharset.monospaced.1=sun.awt.CharToByteSymbol

fontcharset.dialog.0=sun.io.CharToByteISO8859_1
fontcharset.dialog.1=sun.awt.CharToByteSymbol

fontcharset.dialoginput.0=sun.io.CharToByteISO8859_1
fontcharset.dialoginput.1=sun.awt.CharToByteSymbol

# Exclusion Ranges
#

# XFontSet Information
#
fontset.serif.plain=\
-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1,\
-monotype-Times New Roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1

fontset.serif.italic=\
-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-monotype-Times New Roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1

fontset.serif.bold=\
-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1,\
-monotype-Times New Roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1

fontset.serif.bolditalic=\
-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1,\
-monotype-Times New Roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1

fontset.sansserif.plain=\
-b&h-lucida-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1

fontset.sansserif.italic=\
-b&h-lucida-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1

fontset.sansserif.bold=\
-b&h-lucida-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1

fontset.sansserif.bolditalic=\
-b&h-lucida-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1

fontset.monospaced.plain=\
-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-medium-r-normal--*-%d-*-*-m-*-iso10646-1

fontset.monospaced.italic=\
-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-medium-i-normal--*-%d-*-*-m-*-iso10646-1

fontset.monospaced.bold=\
-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-bold-r-normal--*-%d-*-*-m-*-iso10646-1

fontset.monospaced.bolditalic=\
-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-bold-i-normal--*-%d-*-*-m-*-iso10646-1

fontset.dialog.italic=\
-b&h-lucida-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1

fontset.dialog.bold=\
-b&h-lucida-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1

fontset.dialog.bolditalic=\
-b&h-lucida-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1

fontset.dialog.plain=\
-b&h-lucida-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-monotype-Arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1

fontset.dialoginput.italic=\
-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-medium-i-normal--0-0-0-0-m-0-iso10646-1

fontset.dialoginput.bold=\
-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-bold-r-normal--*-%d-*-*-m-*-iso10646-1

fontset.dialoginput.bolditalic=\
-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-bold-i-normal--*-%d-*-*-m-*-iso10646-1

fontset.dialoginput.plain=\
-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1,\
-monotype-Courier New-medium-r-normal--*-%d-*-*-m-*-iso10646-1

fontset.default=\
-b&h-lucida-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1,\
-microsoft-Tahoma-medium-r-normal--*-%d-*-*-p-*-iso10646-1

# appendedfontpath=/usr/share/fonts/TrueType
# or set JAVA_FONTS environment variable to appropriate font path
# (Unicode TrueType font folder) and export it

Dĩ nhiên, các Windows Unicode TrueType fonts được sử dụng -- Times New Roman, Arial, Courier New, và Tahoma -- đã phải được cài vào system, chép vào thư mục /usr/share/fonts/TrueType, chẳng hạn. Về cách thức cài fonts trên Linux, xin tham khảo http://vnlinux.org.

Of course, the Windows Unicode TrueType fonts used -- Times New Roman, Arial, Courier New, and Tahoma -- must have already been installed on the system, copied into /usr/share/fonts/TrueType directory, for example. For information on how to install fonts on Linux, please consult http://vnlinux.org.
quân
 
Posts: 236
Joined: Sat Nov 16, 2002 1:51 am
Location: Oxnard, CA - USA

Postby quân » Mon May 31, 2004 7:57 pm

Java 1.5.0 Tiger vẫn chưa mặc định hỗ trợ hiển thị TV trên Swing components trong Linux vì thiếu các font TrueType tiêu chuẩn có ký tự Việt. Sau đây là giải pháp tạm thời. Tạo 1 text file có tên fontconfig.OS.Version.properties rồi copy vào <jdkhome>/jre/lib directory. OS là tên của operating system; cho Linux, những giá trị hợp lệ là "Sun", "RedHat", "Turbo", "SuSE". Cho Fedora Core 3, tên file sẽ là fontconfig.RedHat.3.properties.

Java 1.5.0 Tiger still does not support display of Vietnamese on Swing components in Linux by default due to a lack of standard TrueType fonts that have Vietnamese glyphs. Following is a temporary solution. Create a text file named fontconfig.OS.Version.properties then copy it into <jdkhome>/jre/lib directory. OS is name of the operating system; for Linux, the valid values are "Sun", "RedHat", "Turbo", "SuSE". For Fedora Core 3, the filename would be fontconfig.RedHat.3.properties.

Code: Select all
# @(#)linux.fontconfig.properties   1.2 03/10/28
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
#

# Version

version=1

# Component Font Mappings

serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
serif.bold.latin-1=-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1
serif.italic.latin-1=-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1
serif.bolditalic.latin-1=-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1
serif.plain.vietnamese=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
serif.bold.vietnamese=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
serif.italic.vietnamese=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
serif.bolditalic.vietnamese=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1

sansserif.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.plain.vietnamese=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
sansserif.bold.vietnamese=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
sansserif.italic.vietnamese=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
sansserif.bolditalic.vietnamese=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1

monospaced.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.plain.vietnamese=-monotype-courier new-medium-r-normal--*-%d-*-*-m-*-iso10646-1
monospaced.bold.vietnamese=-monotype-courier new-bold-r-normal--*-%d-*-*-m-*-iso10646-1
monospaced.italic.vietnamese=-monotype-courier new-medium-i-normal--*-%d-*-*-m-*-iso10646-1
monospaced.bolditalic.vietnamese=-monotype-courier new-bold-i-normal--*-%d-*-*-m-*-iso10646-1

dialog.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.plain.vietnamese=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
dialog.bold.vietnamese=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
dialog.italic.vietnamese=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
dialog.bolditalic.vietnamese=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1

dialoginput.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.plain.vietnamese=-monotype-courier new-medium-r-normal--*-%d-*-*-m-*-iso10646-1
dialoginput.bold.vietnamese=-monotype-courier new-bold-r-normal--*-%d-*-*-m-*-iso10646-1
dialoginput.italic.vietnamese=-monotype-courier new-medium-i-normal--0-0-0-0-m-0-iso10646-1
dialoginput.bolditalic.vietnamese=-monotype-courier new-bold-i-normal--*-%d-*-*-m-*-iso10646-1


# Search Sequences

sequence.allfonts=latin-1,vietnamese

# Exclusion Ranges

exclusion.vietnamese=0250-1e9f,1f00-20aa,20ad-ffff

hoặc/or:
Code: Select all
# @(#)linux.fontconfig.properties   1.2 03/10/28
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
#

# Version

version=1

# Component Font Mappings

allfonts.vietnamese=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1

# Search Sequences

sequence.allfonts=vietnamese

# Exclusion Ranges

exclusion.vietnamese=0250-1e9f,1f00-20aa,20ad-ffff


Tham khảo/References:
http://java.sun.com/j2se/1.5.0/docs/gui ... onfig.html
quân
 
Posts: 236
Joined: Sat Nov 16, 2002 1:51 am
Location: Oxnard, CA - USA

Postby quân » Sat Jun 23, 2007 3:17 pm

Cho Java 1.5 trên Fedora 7, tên file sẽ là fontconfig.RedHat.7.properties.

For Java 1.5 on Fedora 7, the filename would be fontconfig.RedHat.7.properties.
quân
 
Posts: 236
Joined: Sat Nov 16, 2002 1:51 am
Location: Oxnard, CA - USA


Return to Hệ Điều Hành - Operating System

Who is online

Users browsing this forum: No registered users and 1 guest