「Java Runtime Environment のフォント」の版間の差分
細 1版 をインポートしました |
|
(相違点なし)
| |
2015年1月12日 (月) 20:45時点における版
ユーザーによってはデフォルトの Java フォントや Java アプリケーションのフォントの表示モードが気に入らないという人もいるでしょう。Oracle Java Runtime Environment (JRE) のフォント表示を改善する方法は複数存在します。これらの方法は別々に使うこともできますが、多くの場合まとめて使うことでより良い結果が得られるでしょう。
TrueType フォントは Java で一番良くサポートされているフォーマットです。
アンチエイリアス
フォントのアンチエイリアスは Linux の Oracle Java 1.6 で利用可能です。ユーザーごとの設定でアンチエイリアスを使うには、次の行をユーザーの ~/.bashrc に追加してください:
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting'
setting は以下の7つの値のどれか一つに置き換えて下さい:
offまたはfalseまたはdefault– アンチエイリアスなしon– 完全なアンチエイリアスgasp– フォントに埋め込まれたヒント情報を使うlcdまたはlcd_hrgb– 多数派の LCD モニターにあわせてアンチエイリアスを調整するlcd_hbgr– もうひとつの LCD モニター設定lcd_vrgb– もうひとつの LCD モニター設定lcd_vbgr– もうひとつの LCD モニター設定
多くの場合 gasp と lcd の設定が上手く機能します。
任意で GTK のルックアンドフィールを使うには、代わりに下の行を .bashrc に追加してください。上述の Java オプションやこのオプションは Java で GUI を描写している Jdownloader などのアプリケーションでしか意味がありません。Java をバックエンドでしか利用していないアプリケーション、Openoffice.org や Matlab などでは表示が変わりません。
export _JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
上の変更を適用するには、通常ユーザーで ~/.bashrc を source してください。
$ source ~/.bashrc
Java アプリケーションの新しいインスタンスを開いて変更をテストしましょう。
フォント選択
TrueType フォント
Java アプリケーションによっては特定の TrueType フォントを使用するよう選択できたりしますが、こういったアプリケーションは使用したいフォントのディレクトリパスを指定できるようになっています。TrueType フォントは /usr/share/fonts/TTF ディレクトリにインストールされます。次の行を ~/.bashrc に追加してフォントを有効にしてください。
export JAVA_FONTS=/usr/share/fonts/TTF
変更を適用するには通常ユーザーで ~/.bashrc をロードする必要があります。
$ source ~/.bashrc
デフォルトフォント
The Lucida fonts distributed with the Sun JRE are the default for Java applications that do not specify a different font's use. The Lucida fonts were designed for low resolution displays and printers; many users will wish to use other fonts. The default Java fonts can be changed on a system-wide basis by the creation or editing of a file named fontconfig.properties.
As root, change directory to /opt/java/jre/lib. Copy fontconfig.properties.src to fontconfig.properties. Then, as root, open the new fontconfig.properties in an editor.
# cd /opt/java/jre/lib # cp fontconfig.properties.src fontconfig.properties # nano fontconfig.properties
fontconfig.properties.*.src files in /opt/java/jre/lib. Some users will find these files to be better sources to use for editing. In all cases the edited file should be saved as fontconfig.properties.The Java font names in the configuration file are in the form of genericFontName.style.subset, for example, serif.plain.latin-1. These generic fonts are mapped to the installed fonts using X logical font description (XLFD) names. The %d, in the example below, is used as a placeholder in the XLFD name for the point size. The Java application replaces %d at runtime.
serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
Change the Lucida fonts named in the fontconfig.properties file to your selected fonts using the XLFD names. Below is an excerpt of a fontconfig.properties file after modifications have been made. The Lucida fonts have been replaced by DejaVu fonts.
# Version -- a version number is required. # IMPORTANT -- Do not delete the next line. Ever. version=1 # Component Font Mappings # gen_name.style.subset= # -fndry-fmly-wght-slant-sWdth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWdth-rgstry-encdng serif.plain.latin-1=-misc-dejavu serif-medium-r-normal-*-*-%d-*-*-p-*-iso8859-1 serif.bold.latin-1=-misc-dejavu serif-bold-r-normal-*-*-%d-*-*-p-*-iso8859-1 serif.italic.latin-1=-misc-dejavu serif-medium-o-normal-*-*-%d-*-*-p-*-iso8859-1
After the changes have been saved to fontconfig.properties, the editor may be closed and the user should drop root privileges. Open a new instance of a Java application to test the changes.