org.eclipse.swt.graphics
Class Font

java.lang.Object
  |
  +--org.eclipse.swt.graphics.Font

public final class Font
extends Object

Safe:


Field Summary
(package private)  Device device
          the device where this font was created
 int handle
          Suppressed: the handle to the OS font resource (Warning: This field is platform dependent)
 
Constructor Summary
(package private) Font()
          Prevents uninitialized instances from being created outside the package.
  Font(Device device, FontData fd)
          Enabled: Constructs a new font given a device and font data which describes the desired font's appearance.
  Font(Device device, FontData[] fds)
          Suppressed: Constructs a new font given a device and an array of font data which describes the desired font's appearance.
  Font(Device device, String name, int height, int style)
          Enabled: Constructs a new font given a device, a font name, the height of the desired font in points, and a font style.
 
Method Summary
 void dispose()
          Enabled: Disposes of the operating system resources associated with the font.
 boolean equals(Object object)
          Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 FontData[] getFontData()
          Enabled: Returns an array of FontDatas representing the receiver.
 int hashCode()
          Suppressed: Returns an integer hash code for the receiver.
(package private)  void init(Device device, FontData fd)
           
 boolean isDisposed()
          Enabled: Returns true if the font has been disposed, and false otherwise.
 String toString()
          Suppressed: Returns a string containing a concise, human-readable description of the receiver.
static Font win32_new(Device device, int handle)
          Suppressed: Invokes platform specific functionality to allocate a new font.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

handle

public int handle
Suppressed: the handle to the OS font resource (Warning: This field is platform dependent)


device

Device device
the device where this font was created

Constructor Detail

Font

Font()
Prevents uninitialized instances from being created outside the package.


Font

public Font(Device device,
            FontData fd)
Enabled: Constructs a new font given a device and font data which describes the desired font's appearance.

You must dispose the font when it is no longer required.

Parameters:
device - the device to create the font on
fd - the FontData that describes the desired font (must not be null)

Font

public Font(Device device,
            FontData[] fds)
Suppressed: Constructs a new font given a device and an array of font data which describes the desired font's appearance.

You must dispose the font when it is no longer required.

Parameters:
device - the device to create the font on
fds - the array of FontData that describes the desired font (must not be null)
Since:
2.1

Font

public Font(Device device,
            String name,
            int height,
            int style)
Enabled: Constructs a new font given a device, a font name, the height of the desired font in points, and a font style.

You must dispose the font when it is no longer required.

Parameters:
device - the device to create the font on
name - the name of the font (must not be null)
height - the font height in points
style - a bit or combination of NORMAL, BOLD, ITALIC
Method Detail

dispose

public void dispose()
Enabled: Disposes of the operating system resources associated with the font. Applications must dispose of all fonts which they allocate.


equals

public boolean equals(Object object)
Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
equals in class Object
Parameters:
object - the object to compare with this object
Returns:
true if the object is the same as this object and false otherwise
See Also:
hashCode()

getFontData

public FontData[] getFontData()
Enabled: Returns an array of FontDatas representing the receiver. On Windows, only one FontData will be returned per font. On X however, a Font object may be composed of multiple X fonts. To support this case, we return an array of font data objects.

Returns:
an array of font data objects describing the receiver

hashCode

public int hashCode()
Suppressed: Returns an integer hash code for the receiver. Any two objects which return true when passed to equals must return the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

init

void init(Device device,
          FontData fd)

isDisposed

public boolean isDisposed()
Enabled: Returns true if the font has been disposed, and false otherwise.

This method gets the dispose state for the font. When a font has been disposed, it is an error to invoke any other method using the font.

Returns:
true when the font is disposed and false otherwise

toString

public String toString()
Suppressed: Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a string representation of the receiver

win32_new

public static Font win32_new(Device device,
                             int handle)
Suppressed: Invokes platform specific functionality to allocate a new font.

IMPORTANT: This method is not part of the public API for Font. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.

Parameters:
device - the device on which to allocate the color
handle - the handle for the font


comments?