Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.graphics
Class Font  view Font download Font.java

java.lang.Object
  extended byorg.eclipse.swt.graphics.Font

public final class Font
extends java.lang.Object

Instances of this class manage operating system resources that define how text looks when it is displayed. Fonts may be constructed by providing a device and either name, size and style information or a FontData object which encapsulates this data.

Application code must explicitly invoke the Font.dispose() method to release the operating system resources managed by each instance when those instances are no longer required.


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

Field Detail

handle

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


device

Device device
The device where this image was created.

Constructor Detail

Font

Font()

Font

public Font(Device device,
            FontData fd)
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.


Font

public Font(Device device,
            FontData[] fds)
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.

Since:
2.1

Font

public Font(Device device,
            java.lang.String name,
            int height,
            int style)
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.

Method Detail

dispose

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


equals

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


getFontData

public FontData[] getFontData()
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.


gtk_new

public static Font gtk_new(Device device,
                           long handle)
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.


hashCode

public int hashCode()
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.


init

void init(Device device,
          java.lang.String name,
          int height,
          int style,
          byte[] fontString)

isDisposed

public boolean isDisposed()
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.


toString

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