Difference between revisions of "User:Thisoldman"

From ArchWiki
Jump to: navigation, search
Line 8: Line 8:
 
'''Anti-aliasing'''[http://en.wikipedia.org/wiki/Anti-aliasing] 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 '''~/.bashrc'''.
 
'''Anti-aliasing'''[http://en.wikipedia.org/wiki/Anti-aliasing] 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 '''~/.bashrc'''.
 
  export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'
 
  export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'
The value, ''gasp,'' is one of seven possible settings for ''-Dawt.useSystemAAFontSettings.''[http://java.sun.com/javase/6/docs/technotes/guides/2d/flags.html] These settings are:{{sn|'''TrueType'''[http://en.wikipedia.org/wiki/TrueType] fonts have a '''GASP''' table[http://www.microsoft.com/typography/otspec/gasp.htm] ('''G'''rid-fitting '''A'''nd '''S'''can-conversion '''P'''rocedure) containing the font creator's display recommendations for font use at different point sizes. Some sizes are recommended to be fully anti-aliased, others are to be hinted, and some sizes are recommended to be displayed as bitmaps. Combinations are sometimes used for font display at certain point sizes.}}
+
The value, ''gasp,'' is one of seven possible settings for ''-Dawt.useSystemAAFontSettings.''[http://java.sun.com/javase/6/docs/technotes/guides/2d/flags.html] These settings are:{{sn|'''TrueType'''[http://en.wikipedia.org/wiki/TrueType] fonts have a '''GASP''' table[http://www.microsoft.com/typography/otspec/gasp.htm] ('''G'''rid-fitting '''A'''nd '''S'''can-conversion '''P'''rocedure) containing the font creator's recommendations for font display at different point sizes. Some sizes are recommended to be fully anti-aliased, others are to be hinted, and some sizes are recommended to be displayed as bitmaps. Combinations are sometimes used for font display at certain point sizes.}}
  
{|
+
*No anti-aliasing -- {{Codeline|off}} or {{Codeline|false}} or {{Codeline|default}}
|*{{Codeline|off}} or {{Codeline|false}} or {{Codeline|default}} || These are equivalent values for no anti-aliasing.
+
*Full anti-aliasing -- {{Codeline|on}}
|}
+
*Use the font's built-in hinting instructions -- {{Codeline|gasp}}
*{{Codeline|on}}
+
*Setting useful for many popular LCD monitors -- {{Codeline|lcd}} or {{Codeline|lcd_hrgb}}
*{{Codeline|gasp}} -- Uses the font's built-in hinting instructions.
+
*Alternative LCD monitor setting -- {{Codeline|lcd_hbgr}}
*{{Codeline|lcd}} or {{Codeline|lcd_hrgb}} -- Equivalent settings
+
*Alternative LCD monitor setting -- {{Codeline|lcd_vrgb}}
*{{Codeline|lcd_hbgr}}
+
*Alternative LCD monitor setting -- {{Codeline|lcd_vbgr}}
*{{Codeline|lcd_vrgb}}
+
*{{Codeline|lcd_vbgr}}
+
  
 
The ''gasp'' and ''lcd'' settings work well in many instances.
 
The ''gasp'' and ''lcd'' settings work well in many instances.
Line 28: Line 26:
 
== Font Selection ==
 
== Font Selection ==
  
The '''Lucida fonts'''[http://en.wikipedia.org/wiki/Lucida] distributed with the Sun JRE are used by many Java applications by default. These fonts were designed for low resolution CRT displays and printers.[http://www.tug.org/store/lucida/designnotes.html] Many users will wish to use other 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. TrueType fonts are located in the directory '''/usr/share/fonts/TTF.''' Add the following line to '''~/.bashrc''' to enable these fonts.
+
 
 +
=== Enable 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. TrueType fonts are located in the directory '''/usr/share/fonts/TTF'''. Add the following line to '''~/.bashrc''' to enable these fonts.
 
  export JAVA_FONTS=/usr/share/fonts/TTF
 
  export JAVA_FONTS=/usr/share/fonts/TTF
  
Line 36: Line 35:
 
  $ source ~/.bashrc
 
  $ source ~/.bashrc
  
Java applications that don't specify a font will use the default Lucida fonts. This default can be changed to a different installed font, on a system-wide basis, by the creation or editing of a file named '''/opt/java/jre/lib/fontconfig.properties'''.
+
=== Change the Default Fonts ===
 +
The '''Lucida'''[http://en.wikipedia.org/wiki/Lucida] fonts distributed along with the Sun JRE are used as 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[http://www.tug.org/store/lucida/designnotes.html], many users will wish to use other fonts. This default Java font can be changed on a system-wide basis by the creation or editing of a file named '''/opt/java/jre/lib/fontconfig.properties'''.
  
As root, change directory to '''/opt/java/jre/lib''' and copy '''fontconfig.properties.src''' to '''fontconfig.properties''' and then, still as root, open '''fontconfig.properties''' in an editor.
+
As root, change directory to '''/opt/java/jre/lib'''. Copy '''fontconfig.properties.src''' to '''fontconfig.properties'''. Then, as root, open fontconfig.properties in an editor.
 
  # cd /opt/java/jre/lib
 
  # cd /opt/java/jre/lib
 
  # cp fontconfig.properties.src fontconfig.properties
 
  # cp fontconfig.properties.src fontconfig.properties
 
  # nano fontconfig.properties      ## Editor is the user's choice.
 
  # nano fontconfig.properties      ## Editor is the user's choice.
 
+
{|
{{Note|Encodings other than '''Latin-1,''' or '''ISO 8859-1,'''[http://en.wikipedia.org/wiki/ISO/IEC_8859-1] are shown in the '''RedHat,'''[http://www.redhat.com/] '''SuSE,'''[http://www.novell.com/linux/] '''Sun'''[http://www.sun.com/] and '''Turbo'''[http://www.turbolinux.com/] '''fontconfig.properties.*.src''' files. Some users will find these files to be better sources for editing than the simple fontconfig.properties.src file used in this article. In all cases the edited file should be saved as '''fontconfig.properties'''.}}
+
|{{Note|Encodings other than '''Latin-1,''' or '''ISO 8859-1,'''[http://en.wikipedia.org/wiki/ISO/IEC_8859-1] are shown in the '''RedHat,'''[http://www.redhat.com/] '''SuSE,'''[http://www.novell.com/linux/] '''Sun'''[http://www.sun.com/] and '''Turbo'''[http://www.turbolinux.com/] '''fontconfig.properties.*.src''' files. Some users will find these files to be better sources for editing than the simple fontconfig.properties.src file used in this article. In all cases the edited file should be saved as '''fontconfig.properties'''.}}
 
+
|}
The font names used by Java applications are in the form of '''genericFontName.style.subset''', for example,"{{Codeline|serif.plain.latin}}". These generic fonts are mapped to installed fonts using names in the format specified by the '''X Logical Font Description (XLFD)'''[http://en.wikipedia.org/wiki/X_logical_font_description] convention. This convention names a font using fourteen descriptors, in this manner: -foundry-family-weight-slant-setWidth-additionalStyle-
+
The font names used by Java applications 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 ''%d'', in the line below, is used as a placeholder in the XLFD name for the point size. The Java application will replace ''%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
The '''Java''' fonts are mapped to '''TrueType''' fonts using '''X Logical Font Description (XLFD)'''[http://en.wikipedia.org/wiki/X_logical_font_description] conventions. The '''''%d''''' is used as a placeholder in the font description for the point size. The '''Java''' application will replace '''''%d''''' at runtime.
 
  
You may find the utility, '''xfontsel''', useful 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 are portions of a '''fontconfig.properties''' file after modifications have been completed. All the '''Lucida''' fonts have been replaced by variations of '''DejaVu'''[http://en.wikipedia.org/wiki/DejaVu_fonts] fonts. Because the '''DejaVu''' fonts don't have italic versions, the oblique versions were substituted for them; '''''-o-''''' replaces '''''-i-''''' in the '''XLFD.'''
+
Below is an excerpt of a fontconfig.properties file after modifications have been made. The Lucida fonts have been replaced by variations of the '''DejaVu'''[http://en.wikipedia.org/wiki/DejaVu_fonts] 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.
Line 63: Line 62:
 
  serif.bold.latin-1=-misc-dejavu serif-bold-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-i-normal-*-*-%d-*-*-p-*-iso8859-1
 
  serif.italic.latin-1=-misc-dejavu serif-medium-i-normal-*-*-%d-*-*-p-*-iso8859-1
serif.bolditalic.latin-1=-misc-dejavu serif-bold-i-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.
sansserif.plain.latin-1=-misc-dejavu sans-medium-r-normal-*-*-%d-*-*-p-*-iso8859-1
+
+
--- [Omitted] ---
+
+
dialoginput.italic.latin-1=-misc-dejavu sans mono-medium-o-normal-*-*-%d-*-*-m-*-iso8859-1
+
dialoginput.bolditalic.latin-1=-misc-dejavu sans mono-bold-o-normal-*-*-%d-*-*-m-*-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.
+

Revision as of 01:13, 12 September 2009

Java (Sun) Fonts

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 ~/.bashrc.

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'

The value, gasp, is one of seven possible settings for -Dawt.useSystemAAFontSettings.[3] These settings are:Template:Sn

The gasp and lcd settings work well in many instances.

For the above change to take effect, ~/.bashrc must be sourced as the normal user.

$ source ~/.bashrc

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

Font Selection

Enable 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. TrueType fonts are located in the directory /usr/share/fonts/TTF. Add the following line to ~/.bashrc to enable these fonts.

export JAVA_FONTS=/usr/share/fonts/TTF

Source ~/.bashrc as the normal user for the change to take effect.

$ source ~/.bashrc

Change the Default Fonts

The Lucida[4] fonts distributed along with the Sun JRE are used as 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[5], many users will wish to use other fonts. This default Java font can be changed on a system-wide basis by the creation or editing of a file named /opt/java/jre/lib/fontconfig.properties.

As root, change directory to /opt/java/jre/lib. Copy fontconfig.properties.src to fontconfig.properties. Then, as root, open fontconfig.properties 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,[6] are shown in the RedHat,[7] SuSE,[8] Sun[9] and Turbo[10] fontconfig.properties.*.src files. Some users will find these files to be better sources for editing than the simple fontconfig.properties.src file used in this article. In all cases the edited file should be saved as fontconfig.properties.

The font names used by Java applications 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)[11] names. The %d, in the line below, is used as a placeholder in the XLFD name for the point size. The Java application will replace %d 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 fontconfig.properties file after modifications have been made. The Lucida fonts have been replaced by variations of the DejaVu[12] 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-i-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.