public abstract class FontDescriptor extends DeviceResourceDescriptor
Constructor and Description |
---|
FontDescriptor() |
Modifier and Type | Method and Description |
---|---|
abstract Font |
createFont(Device device)
Creates the Font described by this descriptor.
|
static FontDescriptor |
createFrom(Font font)
Creates a FontDescriptor that describes an existing font.
|
static FontDescriptor |
createFrom(FontData data)
Creates a new FontDescriptor given the associated FontData
|
static FontDescriptor |
createFrom(FontData[] data)
Creates a new FontDescriptor given the an array of FontData that describes
the font.
|
static FontDescriptor |
createFrom(Font font,
Device originalDevice)
Creates a FontDescriptor that describes an existing font.
|
static FontDescriptor |
createFrom(String name,
int height,
int style)
Creates a new FontDescriptor given an OS-specific font name, height, and style.
|
Object |
createResource(Device device)
Creates the resource described by this descriptor
|
abstract void |
destroyFont(Font previouslyCreatedFont)
Deallocates anything that was allocated by createFont, given a font
that was allocated by an equal FontDescriptor.
|
void |
destroyResource(Object previouslyCreatedObject)
Undoes everything that was done by a previous call to create(...), given
the object that was returned by create(...).
|
public static FontDescriptor createFrom(Font font, Device originalDevice)
font
- a font to describeoriginalDevice
- must be the same Device that was passed into
the font's constructor when it was first created.public static FontDescriptor createFrom(Font font)
createFrom(Font, Device)
, so the other version should be used whenever possible.font
- font to createpublic static FontDescriptor createFrom(FontData[] data)
data
- an array of FontData that describes the font (will be passed into
the Font's constructor)public static FontDescriptor createFrom(FontData data)
data
- FontData describing the font to createpublic static FontDescriptor createFrom(String name, int height, int style)
name
- os-specific font nameheight
- height (pixels)style
- a bitwise combination of NORMAL, BOLD, ITALICFont.Font(org.eclipse.swt.graphics.Device, java.lang.String, int, int)
public abstract Font createFont(Device device) throws DeviceResourceException
device
- device on which to allocate the fontDeviceResourceException
- if unable to allocate the Fontpublic abstract void destroyFont(Font previouslyCreatedFont)
previouslyCreatedFont
- previously allocated fontpublic final Object createResource(Device device) throws DeviceResourceException
DeviceResourceDescriptor
createResource
in class DeviceResourceDescriptor
device
- the Device on which to allocate the resourceDeviceResourceException
- if unable to allocate the resourcepublic final void destroyResource(Object previouslyCreatedObject)
DeviceResourceDescriptor
destroyResource
in class DeviceResourceDescriptor
previouslyCreatedObject
- an object that was returned by an equal
descriptor in a previous call to createResource(...).Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.