|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jface.resource.DeviceResourceDescriptor
org.eclipse.jface.resource.FontDescriptor
public abstract class FontDescriptor
Lightweight descriptor for a font. Creates the described font on demand. Subclasses can implement different ways of describing a font. These objects will be compared, so hashCode(...) and equals(...) must return something meaningful.
| Constructor Summary | |
|---|---|
FontDescriptor()
|
|
| Method Summary | |
|---|---|
static FontData |
copy(FontData next)
Returns a copy of the original FontData |
static FontData[] |
copy(FontData[] original)
Returns an array of FontData containing copies of the FontData from the original. |
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)
Deprecated. use createFrom(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(...). |
FontData[] |
getFontData()
Returns the set of FontData associated with this font. |
FontDescriptor |
increaseHeight(int heightDelta)
Returns a FontDescriptor that is equivalent to the reciever, but whose height is larger by the given number of points. |
FontDescriptor |
setHeight(int height)
Returns a new FontDescriptor that is equivalent to the reciever, but has the given height. |
FontDescriptor |
setStyle(int style)
Returns a FontDescriptor that is equivalent to the reciever, but uses the given style bits. |
FontDescriptor |
withStyle(int style)
Returns a FontDescriptor that is equivalent to the reciever, but has the given style bits, in addition to any styles the reciever already has. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FontDescriptor()
| Method Detail |
|---|
public static FontDescriptor createFrom(Font font,
Device originalDevice)
createFrom(Font)
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)
font - font to create
public 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 create
public static FontDescriptor createFrom(String name,
int height,
int style)
name - os-specific font nameheight - height (pixels)style - a bitwise combination of NORMAL, BOLD, ITALIC
Font.Font(org.eclipse.swt.graphics.Device, java.lang.String, int, int)public FontData[] getFontData()
public static FontData[] copy(FontData[] original)
original - array to copy
public static FontData copy(FontData next)
next - FontData to copy
public final FontDescriptor setStyle(int style)
Does not modify the reciever.
style - a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD
public final FontDescriptor withStyle(int style)
Returns a FontDescriptor that is equivalent to the reciever, but has the given style bits, in addition to any styles the reciever already has.
Does not modify the reciever.
style - a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD
public final FontDescriptor setHeight(int height)
Returns a new FontDescriptor that is equivalent to the reciever, but has the given height.
Does not modify the reciever.
height - a height, in points
public final FontDescriptor increaseHeight(int heightDelta)
Returns a FontDescriptor that is equivalent to the reciever, but whose height is larger by the given number of points.
Does not modify the reciever.
heightDelta - a change in height, in points. Negative values will return smaller
fonts.
public abstract Font createFont(Device device)
throws DeviceResourceException
device - device on which to allocate the font
DeviceResourceException - if unable to allocate the Fontpublic abstract void destroyFont(Font previouslyCreatedFont)
previouslyCreatedFont - previously allocated font
public final Object createResource(Device device)
throws DeviceResourceException
DeviceResourceDescriptor
createResource in class DeviceResourceDescriptordevice - the Device on which to allocate the resource
DeviceResourceException - if unable to allocate the resourcepublic final void destroyResource(Object previouslyCreatedObject)
DeviceResourceDescriptor
destroyResource in class DeviceResourceDescriptorpreviouslyCreatedObject - an object that was returned by an equal
descriptor in a previous call to createResource(...).
|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.