public abstract class

SunGraphicsEnvironment

extends GraphicsEnvironment
implements DisplayChangedListener FontSupport
java.lang.Object
   ↳ java.awt.GraphicsEnvironment
     ↳ sun.java2d.SunGraphicsEnvironment

Class Overview

This is an implementation of a GraphicsEnvironment object for the default local GraphicsEnvironment.

Summary

Nested Classes
class SunGraphicsEnvironment.T1Filter  
class SunGraphicsEnvironment.TTFilter  
class SunGraphicsEnvironment.TTorT1Filter  
Constants
String lucidaFileName
String lucidaFontName
Fields
public static boolean debugFonts
protected SunDisplayChanger displayChanger
public static String eudcFontFileName
protected String fontPath
public static boolean isLinux
public static boolean isSolaris
public static boolean isWindows
public static String jreFontDirName
public static String jreLibDirName
protected static Logger logger
public static boolean noType1Font
protected HashSet registeredFontFiles
protected GraphicsDevice[] screens
public static final SunGraphicsEnvironment.T1Filter t1Filter
public static final SunGraphicsEnvironment.TTFilter ttFilter
Public Constructors
SunGraphicsEnvironment()
Public Methods
void addDisplayChangedListener(DisplayChangedListener client)
Add a DisplayChangeListener to be notified when the display settings are changed.
void createCompositeFonts(ConcurrentHashMap<StringFont2D> altNameCache, boolean preferLocale, boolean preferProportional)
abstract FontConfiguration createFontConfiguration(boolean preferLocaleFonts, boolean preferPropFonts)
Graphics2D createGraphics(BufferedImage img)
Returns a Graphics2D object for rendering into the given BufferedImage.
void displayChanged()
From the DisplayChangedListener interface; called when the display mode has been changed.
static boolean fontSupportsDefaultEncoding(Font font)
This method is provided for internal and exclusive use by Swing.
Font[] getAllFonts()
Returns all fonts available in this environment.
Font[] getAllInstalledFonts()
Returns all fonts installed in this environment.
String[] getAvailableFontFamilyNames(Locale requestedLocale)
Returns an array containing the names of all font families in this GraphicsEnvironment localized for the specified locale.
String[] getAvailableFontFamilyNames()
Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale, as returned by Locale.getDefault().
String getDefaultFontFaceName()
Returns face name for default font, or null if no face names are used for CompositeFontDescriptors for this platform.
String getDefaultFontFile()
Returns file name for default font, either absolute or relative as needed by registerFontFile.
GraphicsDevice getDefaultScreenDevice()
Returns the default screen graphics device.
FontConfiguration getFontConfiguration()
Return the default font configuration.
String[] getInstalledFontFamilyNames(Locale requestedLocale)
String[] getPlatformFontDirs()
Get all directories which contain installed fonts.
synchronized GraphicsDevice[] getScreenDevices()
Returns an array of all of the screen devices.
static Locale getSystemStartupLocale()
static Rectangle getUsableBounds(GraphicsDevice gd)
Return the bounds of a GraphicsDevice, less its screen insets.
static boolean isLogicalFont(Font f)
Determines whether the given font is a logical font.
static boolean isOpenJDK()
A few things in Java 2D code are different in OpenJDK, so need a way to tell which implementation this is.
void loadFontFiles()
void loadFonts()
void paletteChanged()
Part of the DisplayChangedListener interface: propagate this event to listeners
void register1dot0Fonts()
void registerFontsInDir(String dirName)
void removeDisplayChangedListener(DisplayChangedListener client)
Remove a DisplayChangeListener from Win32GraphicsEnvironment
static void useAlternateFontforJALocales()
Protected Methods
void addFontToPlatformFontPath(String platformFontName)
Notifies graphics environment that the logical font configuration uses the given platform font name.
void addToMissingFontFileList(String fileName)
abstract FontConfiguration createFontConfiguration()
Creates this environment's FontConfiguration.
String getFileNameFromPlatformName(String platformFontName)
Returns a file name for the physical font represented by this platform font name.
void getJREFontFamilyNames(TreeMap<StringString> familyNames, Locale requestedLocale)
String[] getNativeNames(String fontFileName, String platformName)
abstract int getNumScreens()
String getPlatformFontPath(boolean noType1Font)
void getPlatformFontPathFromFontConfig()
abstract GraphicsDevice makeScreenDevice(int screennum)
void registerFontDir(String path)
void registerFontDirs(String pathName)
void registerFontFile(String fontFileName, String[] nativeNames, int fontRank, boolean defer)
void registerJREFontsWithPlatform(String pathName)
void registerPlatformFontsUsedByFontConfiguration()
boolean useAbsoluteFontFileNames()
Whether registerFontFile expects absolute or relative font file names.
[Expand]
Inherited Methods
From class java.awt.GraphicsEnvironment
From class java.lang.Object
From interface sun.awt.DisplayChangedListener
From interface sun.java2d.FontSupport

Constants

public static final String lucidaFileName

Constant Value: "LucidaSansRegular.ttf"

public static final String lucidaFontName

Constant Value: "Lucida Sans Regular"

Fields

public static boolean debugFonts

protected SunDisplayChanger displayChanger

public static String eudcFontFileName

protected String fontPath

public static boolean isLinux

public static boolean isSolaris

public static boolean isWindows

public static String jreFontDirName

public static String jreLibDirName

protected static Logger logger

public static boolean noType1Font

protected HashSet registeredFontFiles

protected GraphicsDevice[] screens

public static final SunGraphicsEnvironment.T1Filter t1Filter

public static final SunGraphicsEnvironment.TTFilter ttFilter

Public Constructors

public SunGraphicsEnvironment ()

Public Methods

public void addDisplayChangedListener (DisplayChangedListener client)

Add a DisplayChangeListener to be notified when the display settings are changed.

public void createCompositeFonts (ConcurrentHashMap<StringFont2D> altNameCache, boolean preferLocale, boolean preferProportional)

public abstract FontConfiguration createFontConfiguration (boolean preferLocaleFonts, boolean preferPropFonts)

public Graphics2D createGraphics (BufferedImage img)

Returns a Graphics2D object for rendering into the given BufferedImage.

Parameters
img the specified BufferedImage
Returns
  • a Graphics2D to be used for rendering into the specified BufferedImage
Throws
NullPointerException if BufferedImage argument is null

public void displayChanged ()

From the DisplayChangedListener interface; called when the display mode has been changed.

public static boolean fontSupportsDefaultEncoding (Font font)

This method is provided for internal and exclusive use by Swing. This method should no longer be called, instead directly call FontManager.fontSupportsDefaultEncoding(Font). This method will be removed once Swing is updated to no longer call it.

public Font[] getAllFonts ()

Returns all fonts available in this environment.

Returns
  • an array of Font objects

public Font[] getAllInstalledFonts ()

Returns all fonts installed in this environment.

public String[] getAvailableFontFamilyNames (Locale requestedLocale)

Returns an array containing the names of all font families in this GraphicsEnvironment localized for the specified locale.

Typical usage would be for presentation to a user for selection of a particular family name. An application can then specify this name when creating a font, in conjunction with a style, such as bold or italic, giving the font system flexibility in choosing its own best match among multiple fonts in the same font family.

Parameters
requestedLocale a Locale object that represents a particular geographical, political, or cultural region. Specifying null is equivalent to specifying Locale.getDefault().
Returns
  • an array of String containing font family names localized for the specified Locale, or a suitable alternative name if no name exists for the specified locale.

public String[] getAvailableFontFamilyNames ()

Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale, as returned by Locale.getDefault().

Typical usage would be for presentation to a user for selection of a particular family name. An application can then specify this name when creating a font, in conjunction with a style, such as bold or italic, giving the font system flexibility in choosing its own best match among multiple fonts in the same font family.

Returns
  • an array of String containing font family names localized for the default locale, or a suitable alternative name if no name exists for this locale.

public String getDefaultFontFaceName ()

Returns face name for default font, or null if no face names are used for CompositeFontDescriptors for this platform.

public String getDefaultFontFile ()

Returns file name for default font, either absolute or relative as needed by registerFontFile.

public GraphicsDevice getDefaultScreenDevice ()

Returns the default screen graphics device.

Returns
  • the GraphicsDevice that represents the default screen device

public FontConfiguration getFontConfiguration ()

Return the default font configuration.

public String[] getInstalledFontFamilyNames (Locale requestedLocale)

public String[] getPlatformFontDirs ()

Get all directories which contain installed fonts.

public synchronized GraphicsDevice[] getScreenDevices ()

Returns an array of all of the screen devices.

Returns
  • an array containing all the GraphicsDevice objects that represent screen devices

public static Locale getSystemStartupLocale ()

public static Rectangle getUsableBounds (GraphicsDevice gd)

Return the bounds of a GraphicsDevice, less its screen insets. See also java.awt.GraphicsEnvironment.getUsableBounds();

public static boolean isLogicalFont (Font f)

Determines whether the given font is a logical font.

public static boolean isOpenJDK ()

A few things in Java 2D code are different in OpenJDK, so need a way to tell which implementation this is. The absence of Lucida Sans Regular is the simplest way for now.

public void loadFontFiles ()

public void loadFonts ()

public void paletteChanged ()

Part of the DisplayChangedListener interface: propagate this event to listeners

public void register1dot0Fonts ()

public void registerFontsInDir (String dirName)

public void removeDisplayChangedListener (DisplayChangedListener client)

Remove a DisplayChangeListener from Win32GraphicsEnvironment

public static void useAlternateFontforJALocales ()

Protected Methods

protected void addFontToPlatformFontPath (String platformFontName)

Notifies graphics environment that the logical font configuration uses the given platform font name. The graphics environment may use this for platform specific initialization.

protected void addToMissingFontFileList (String fileName)

protected abstract FontConfiguration createFontConfiguration ()

Creates this environment's FontConfiguration.

protected String getFileNameFromPlatformName (String platformFontName)

Returns a file name for the physical font represented by this platform font name. The default implementation tries to obtain the file name from the font configuration. Subclasses may override to provide information from other sources.

protected void getJREFontFamilyNames (TreeMap<StringString> familyNames, Locale requestedLocale)

protected String[] getNativeNames (String fontFileName, String platformName)

protected abstract int getNumScreens ()

protected String getPlatformFontPath (boolean noType1Font)

protected void getPlatformFontPathFromFontConfig ()

protected abstract GraphicsDevice makeScreenDevice (int screennum)

protected void registerFontDir (String path)

protected void registerFontDirs (String pathName)

protected void registerFontFile (String fontFileName, String[] nativeNames, int fontRank, boolean defer)

protected void registerJREFontsWithPlatform (String pathName)

protected void registerPlatformFontsUsedByFontConfiguration ()

protected boolean useAbsoluteFontFileNames ()

Whether registerFontFile expects absolute or relative font file names.