public abstract class FontDescriptor extends DeviceResourceDescriptor
Constructor and Description |
---|
FontDescriptor() |
Modifier and Type | Method and Description |
---|---|
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.
|
@Deprecated 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 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 FontData[] getFontData()
public static FontData[] copy(FontData[] original)
original
- array to copypublic static FontData copy(FontData next)
next
- FontData to copypublic final FontDescriptor setStyle(int style)
Does not modify the reciever.
style
- a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLDpublic 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.BOLDpublic 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 pointspublic 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 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(...).
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.