public abstract class

FontConfiguration

extends Object
java.lang.Object
   ↳ sun.awt.FontConfiguration

Class Overview

Provides the definitions of the five logical fonts: Serif, SansSerif, Monospaced, Dialog, and DialogInput. The necessary information is obtained from fontconfig files.

Summary

Constants
int NUM_FONTS
int NUM_STYLES
Fields
protected static String encoding
protected SunGraphicsEnvironment environment
protected static boolean isProperties
protected static Hashtable localeMap
protected static String osName
protected static String osVersion
protected boolean preferLocaleFonts
protected boolean preferPropFonts
protected HashMap reorderMap
protected static Locale startupLocale
protected static short[] table_awtfontpaths
public static boolean verbose
Public Constructors
FontConfiguration(SunGraphicsEnvironment environment)
FontConfiguration(SunGraphicsEnvironment environment, boolean preferLocaleFonts, boolean preferPropFonts)
Public Methods
CompositeFontDescriptor[] get2DCompositeFontInfo()
Returns an array of composite font descriptors for all logical font faces.
HashSet<String> getAWTFontPathSet()
String getExtraFontPath()
Returns a configuration specific path to be appended to the font search path.
abstract String getFallbackFamilyName(String fontName, String defaultFallback)
Returns a fallback name for the given font name.
String getFileNameFromPlatformName(String platformName)
Returns a file name for the physical font represented by this platform font name, if the font configuration has such information available, or null if the information is unavailable.
FontDescriptor[] getFontDescriptors(String fontName, int style)
Returns FontDescriptors describing the physical fonts used for the given logical font name and style.
static String getLogicalFontFaceName(String familyName, int style)
Returns the font face name for the given logical font family name and style.
int getNumberCoreFonts()
String[] getPlatformFontNames()
static String getStyleString(int style)
Returns the string typically used in properties files for the given style.
String getVersion()
static boolean hasMonoToPropMap()
static boolean isLogicalFontFaceName(String fontName)
Checks whether the given font face name is a valid logical font name.
static boolean isLogicalFontFaceNameLC(String fontName)
Checks whether the given font face name is a valid logical font name.
static boolean isLogicalFontFamilyName(String fontName)
Checks whether the given font family name is a valid logical font name.
static boolean isLogicalFontFamilyNameLC(String fontName)
Checks whether the given font family name is a valid logical font name.
static void loadBinary(InputStream inStream)
static void loadProperties(InputStream in)
boolean needToSearchForFile(String fileName)
static void saveBinary(OutputStream out)
static boolean willReorderForStartupLocale()
Protected Methods
String getCompatibilityFamilyName(String fontName)
Returns the 1.1 equivalent for some old 1.0 font family names for which we need to maintain compatibility in some configurations.
static short getComponentFontID(short scriptID, int fontIndex, int styleIndex)
static short getComponentFontIDMotif(short scriptID, int fontIndex, int styleIndex)
static String getComponentFontName(short id)
short[] getCoreScripts(int fontIndex)
abstract Charset getDefaultFontCharset(String fontName)
abstract String getEncoding(String awtFontName, String characterSubsetName)
Returns the java.io name of the platform character encoding for the given AWT font name and character subset.
abstract String getFaceNameFromComponentFontName(String componentFontName)
abstract String getFileNameFromComponentFontName(String componentFontName)
static FontConfiguration getFontConfiguration()
static int getFontIndex(String fontName)
static String getFontName(int fontIndex)
static String getString(short stringID)
static int getStyleIndex(int style)
static int getStyleIndex(String styleName)
static String getStyleName(int styleIndex)
abstract void initReorderMap()
String makeAWTFontName(String platformFontName, String characterSubsetName)
Returns the AWT font name for the given platform font name and character subset.
String mapFileName(String fileName)
Maps a file name given in the font configuration file to a format appropriate for the platform.
void setOsNameAndVersion()
Fills in this instance's osVersion and osName members.
String[] split(String sequence)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final int NUM_FONTS

Constant Value: 5 (0x00000005)

protected static final int NUM_STYLES

Constant Value: 4 (0x00000004)

Fields

protected static String encoding

protected SunGraphicsEnvironment environment

protected static boolean isProperties

protected static Hashtable localeMap

protected static String osName

protected static String osVersion

protected boolean preferLocaleFonts

protected boolean preferPropFonts

protected HashMap reorderMap

protected static Locale startupLocale

protected static short[] table_awtfontpaths

public static boolean verbose

Public Constructors

public FontConfiguration (SunGraphicsEnvironment environment)

public FontConfiguration (SunGraphicsEnvironment environment, boolean preferLocaleFonts, boolean preferPropFonts)

Public Methods

public CompositeFontDescriptor[] get2DCompositeFontInfo ()

Returns an array of composite font descriptors for all logical font faces. If the font configuration file doesn't specify Lucida Sans Regular or the given fallback font as component fonts, they are added here.

public HashSet<String> getAWTFontPathSet ()

public String getExtraFontPath ()

Returns a configuration specific path to be appended to the font search path.

public abstract String getFallbackFamilyName (String fontName, String defaultFallback)

Returns a fallback name for the given font name. For a few known font names, matching logical font names are returned. For all other font names, defaultFallback is returned. defaultFallback differs between AWT and 2D.

public String getFileNameFromPlatformName (String platformName)

Returns a file name for the physical font represented by this platform font name, if the font configuration has such information available, or null if the information is unavailable. The file name returned is just a hint; a null return value doesn't necessarily mean that the font is unavailable, nor does a non-null return value guarantee that the file exists and contains the physical font. The file name can be an absolute or a relative path name.

public FontDescriptor[] getFontDescriptors (String fontName, int style)

Returns FontDescriptors describing the physical fonts used for the given logical font name and style. The font name is interpreted in a case insensitive way. The style argument is interpreted as in java.awt.Font.Font.

public static String getLogicalFontFaceName (String familyName, int style)

Returns the font face name for the given logical font family name and style. The style argument is interpreted as in java.awt.Font.Font.

public int getNumberCoreFonts ()

public String[] getPlatformFontNames ()

public static String getStyleString (int style)

Returns the string typically used in properties files for the given style. The style argument is interpreted as in java.awt.Font.Font.

public String getVersion ()

public static boolean hasMonoToPropMap ()

public static boolean isLogicalFontFaceName (String fontName)

Checks whether the given font face name is a valid logical font name. The check is case insensitive.

public static boolean isLogicalFontFaceNameLC (String fontName)

Checks whether the given font face name is a valid logical font name. The check is case sensitive.

public static boolean isLogicalFontFamilyName (String fontName)

Checks whether the given font family name is a valid logical font name. The check is case insensitive.

public static boolean isLogicalFontFamilyNameLC (String fontName)

Checks whether the given font family name is a valid logical font name. The check is case sensitive.

public static void loadBinary (InputStream inStream)

Throws
IOException

public static void loadProperties (InputStream in)

Throws
IOException

public boolean needToSearchForFile (String fileName)

public static void saveBinary (OutputStream out)

Throws
IOException

public static boolean willReorderForStartupLocale ()

Protected Methods

protected String getCompatibilityFamilyName (String fontName)

Returns the 1.1 equivalent for some old 1.0 font family names for which we need to maintain compatibility in some configurations. Returns null for other font names.

protected static short getComponentFontID (short scriptID, int fontIndex, int styleIndex)

protected static short getComponentFontIDMotif (short scriptID, int fontIndex, int styleIndex)

protected static String getComponentFontName (short id)

protected short[] getCoreScripts (int fontIndex)

protected abstract Charset getDefaultFontCharset (String fontName)

protected abstract String getEncoding (String awtFontName, String characterSubsetName)

Returns the java.io name of the platform character encoding for the given AWT font name and character subset. May return "default" to indicate that getDefaultFontCharset should be called to obtain a charset encoder.

protected abstract String getFaceNameFromComponentFontName (String componentFontName)

protected abstract String getFileNameFromComponentFontName (String componentFontName)

protected static FontConfiguration getFontConfiguration ()

protected static int getFontIndex (String fontName)

protected static String getFontName (int fontIndex)

protected static String getString (short stringID)

protected static int getStyleIndex (int style)

protected static int getStyleIndex (String styleName)

protected static String getStyleName (int styleIndex)

protected abstract void initReorderMap ()

protected String makeAWTFontName (String platformFontName, String characterSubsetName)

Returns the AWT font name for the given platform font name and character subset.

protected String mapFileName (String fileName)

Maps a file name given in the font configuration file to a format appropriate for the platform.

protected void setOsNameAndVersion ()

Fills in this instance's osVersion and osName members. By default uses the system properties os.name and os.version; subclasses may override.

protected String[] split (String sequence)