Difference between revisions of "User:Thisoldman"

From ArchWiki
Jump to: navigation, search
Line 1: Line 1:
 
{{Article summary start}}
 
{{Article summary start}}
{{Article summary text|Instructions to improve the display of fonts in Java applications when using Sun Microsystem's Java Runtime Environment.}}
+
{{Article summary text|Instructions are given to improve the display of fonts in Java applications when using Sun Microsystem's Java Runtime Environment.}}
 
{{Article summary end}}
 
{{Article summary end}}
  
=Java Fonts: Sun JRE=
+
=Fonts: Java - Sun JRE=
  
 
Users may find the default Java fonts and their display in Java applications unpleasant. Several methods to improve font display in the '''Sun Java Runtime Environment (JRE)'''[http://java.sun.com/javase/6/docs/technotes/guides/index.html#jre-jdk] are available. The methods may be used separately, but many users will find better results by combining them.
 
Users may find the default Java fonts and their display in Java applications unpleasant. Several methods to improve font display in the '''Sun Java Runtime Environment (JRE)'''[http://java.sun.com/javase/6/docs/technotes/guides/index.html#jre-jdk] are available. The methods may be used separately, but many users will find better results by combining them.
Line 16: Line 16:
 
:*{{Codeline|on}} -- Full anti-aliasing
 
:*{{Codeline|on}} -- Full anti-aliasing
 
:*{{Codeline|gasp}} -- Use the font's built-in hinting instructions
 
:*{{Codeline|gasp}} -- Use the font's built-in hinting instructions
:*{{Codeline|lcd}} or {{Codeline|lcd_hrgb}} -- Setting useful for many popular LCD monitors
+
:*{{Codeline|lcd}} or {{Codeline|lcd_hrgb}} -- Anti-aliasing tuned for many popular LCD monitors
 
:*{{Codeline|lcd_hbgr}} -- Alternative LCD monitor setting
 
:*{{Codeline|lcd_hbgr}} -- Alternative LCD monitor setting
 
:*{{Codeline|lcd_vrgb}} -- Alternative LCD monitor setting
 
:*{{Codeline|lcd_vrgb}} -- Alternative LCD monitor setting
Line 29: Line 29:
 
==Font Selection==
 
==Font Selection==
  
===Enable TrueType Fonts===
+
===TrueType Fonts===
 
TrueType fonts appear to be the best supported format in Java. Java applications that are coded to use a specific TrueType font must be given the ''path'' to that font. These fonts are located in the directory {{Codeline|/usr/share/fonts/TTF}}. Add the following line to {{Codeline|~/.bashrc}} to enable these fonts.
 
TrueType fonts appear to be the best supported format in Java. Java applications that are coded to use a specific TrueType font must be given the ''path'' to that font. These fonts are located in the directory {{Codeline|/usr/share/fonts/TTF}}. Add the following line to {{Codeline|~/.bashrc}} to enable these fonts.
 
  export JAVA_FONTS=/usr/share/fonts/TTF
 
  export JAVA_FONTS=/usr/share/fonts/TTF
Line 36: Line 36:
 
  $ source ~/.bashrc
 
  $ source ~/.bashrc
  
===Change the Default Fonts===
+
===Default Fonts===
 
The '''Lucida''' fonts distributed along 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 font can be changed on a system-wide basis by the creation or editing of a file named {{Codeline|fontconfig.properties}}.
 
The '''Lucida''' fonts distributed along 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 font can be changed on a system-wide basis by the creation or editing of a file named {{Codeline|fontconfig.properties}}.
  
Line 46: Line 46:
 
|{{Note|Encodings other than '''Latin-1,''' or '''ISO 8859-1,'''[http://en.wikipedia.org/wiki/ISO/IEC_8859-1] are shown in other {{Codeline|fontconfig.properties.*.src}} files in {{Codeline|/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 {{Codeline|fontconfig.properties}}.}}
 
|{{Note|Encodings other than '''Latin-1,''' or '''ISO 8859-1,'''[http://en.wikipedia.org/wiki/ISO/IEC_8859-1] are shown in other {{Codeline|fontconfig.properties.*.src}} files in {{Codeline|/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 {{Codeline|fontconfig.properties}}.}}
 
|}
 
|}
The Java font names in this configuration file are in the form of ''genericFontName.style.subset'', for example,{{Codeline|serif.plain.latin}}. These generic fonts are mapped to the installed fonts using '''X Logical Font Description (XLFD)'''[http://en.wikipedia.org/wiki/X_logical_font_description] names. The {{Codeline|%d}}, in the example below, is used as a placeholder in the XLFD name for the point size. The Java application will replace {{Codeline|%d}} at runtime.
+
The Java font names in the configuration file are in the form of ''genericFontName.style.subset'', for example,{{Codeline|serif.plain.latin}}. These generic fonts are mapped to the installed fonts using '''X Logical Font Description (XLFD)'''[http://en.wikipedia.org/wiki/X_logical_font_description] names. The {{Codeline|%d}}, in the example below, is used as a placeholder in the XLFD name for the point size. The Java application replaces {{Codeline|%d}} at runtime.
 
  serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
 
  serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
  
 
{{Tip|The utility, '''xfontsel''', may be used to display fonts and to discover their XLFD name. Xfontsel is part of the '''xorg-utils''' package.}}
 
{{Tip|The utility, '''xfontsel''', may be used to display fonts and to discover their XLFD name. Xfontsel is part of the '''xorg-utils''' package.}}
  
Below is an excerpt of a {{Codeline|fontconfig.properties}} file after modifications have been made. The Lucida fonts have been replaced by variations of the '''DejaVu''' fonts.
+
Below is an excerpt of a {{Codeline|fontconfig.properties}} file after modifications have been made. The Lucida fonts have been replaced by '''DejaVu''' fonts.
 
  # Version -- a version number is required.
 
  # Version -- a version number is required.
 
  # IMPORTANT -- Do not delete the next line. Ever.
 
  # IMPORTANT -- Do not delete the next line. Ever.

Revision as of 13:27, 13 September 2009

Summary help replacing me
Instructions are given to improve the display of fonts in Java applications when using Sun Microsystem's Java Runtime Environment.

Fonts: Java - Sun JRE

Users may find the default Java fonts and their display in Java applications unpleasant. Several methods to improve font display in the Sun Java Runtime Environment (JRE)[1] are available. The methods may be used separately, but many users will find better results by combining them.

Anti-aliasing

Anti-aliasing[2] of fonts is available with Sun Java 1.6 on Linux. To do this on a per user basis, add the following line to the user's Template:Codeline.

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting'

Replace Template:Codeline with one of the following seven values: Template:Sn

The Template:Codeline and Template:Codeline settings work well in many instances.

For the above change to take effect, Template:Codeline must be sourced as the normal user.

$ source ~/.bashrc

Open a new instance of a Java application to test the changes made.

Font Selection

TrueType Fonts

TrueType fonts appear to be the best supported format in Java. Java applications that are coded to use a specific TrueType font must be given the path to that font. These fonts are located in the directory Template:Codeline. Add the following line to Template:Codeline to enable these fonts.

export JAVA_FONTS=/usr/share/fonts/TTF

Source Template:Codeline as the normal user for the change to take effect.

$ source ~/.bashrc

Default Fonts

The Lucida fonts distributed along 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 font can be changed on a system-wide basis by the creation or editing of a file named Template:Codeline.

As root, change directory to Template:Codeline. Copy Template:Codeline to Template:Codeline. Then, as root, open the new Template:Codeline in an editor.

# cd /opt/java/jre/lib
# cp fontconfig.properties.src fontconfig.properties
# nano fontconfig.properties      ## Editor is the user's choice.
Note: Encodings other than Latin-1, or ISO 8859-1,[3] are shown in other Template:Codeline files in Template:Codeline. Some users will find these files to be better sources to use for editing. In all cases the edited file should be saved as Template:Codeline.

The Java font names in the configuration file are in the form of genericFontName.style.subset, for example,Template:Codeline. These generic fonts are mapped to the installed fonts using X Logical Font Description (XLFD)[4] names. The Template:Codeline, in the example below, is used as a placeholder in the XLFD name for the point size. The Java application replaces Template:Codeline at runtime.

serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
Tip: The utility, xfontsel, may be used to display fonts and to discover their XLFD name. Xfontsel is part of the xorg-utils package.

Below is an excerpt of a Template:Codeline 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 Template:Codeline, the editor may be closed and the user should drop root privileges. Open a new instance of a Java application to test the changes.