FontData

Instances of this class describe operating system fonts. <p> For platform-independent behaviour, use the get and set methods corresponding to the following properties: <dl> <dt>height</dt><dd>the height of the font in points</dd> <dt>name</dt><dd>the face name of the font, which may include the foundry</dd> <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd> </dl> If extra, platform-dependent functionality is required: <ul> <li>On <em>Windows</em>, the data member of the <code>FontData</code> corresponds to a Windows <code>LOGFONT</code> structure whose fields may be retrieved and modified.</li> <li>On <em>X</em>, the fields of the <code>FontData</code> correspond to the entries in the font's XLFD name and may be retrieved and modified. </ul> Application code does <em>not</em> need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no <code>dispose()</code> method is provided.

@see Font @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

Constructors

this
this()

Constructs a new uninitialized font data.

this
this(String str)

Constructs a new FontData given a string representation in the form generated by the <code>FontData.toString</code> method. <p> Note that the representation varies between platforms, and a FontData can only be created from a string that was generated on the same platform. </p>

this
this(String name, int height, int style)

Constructs a new font data given a font name, the height of the desired font in points, and a font style.

Members

Functions

getHeight
int getHeight()

Returns the height of the receiver in points.

getLocale
String getLocale()

Returns the locale of the receiver. <p> The locale determines which platform character set this font is going to use. Widgets and graphics operations that use this font will convert UNICODE strings to the platform character set of the specified locale. </p> <p> On platforms where there are multiple character sets for a given language/country locale, the variant portion of the locale will determine the character set. </p>

getName
String getName()

Returns the name of the receiver. On platforms that support font foundries, the return value will be the foundry followed by a dash ("-") followed by the face name.

getStyle
int getStyle()

Returns the style of the receiver which is a bitwise OR of one or more of the <code>SWT</code> constants NORMAL, BOLD and ITALIC.

opEquals
equals_t opEquals(Object object)

Compares the argument to the receiver, and returns true if they represent the <em>same</em> object using a class specific comparison.

setHeight
void setHeight(int height)

Sets the height of the receiver. The parameter is specified in terms of points, where a point is one seventy-second of an inch.

setLocale
void setLocale(String locale)

Sets the locale of the receiver. <p> The locale determines which platform character set this font is going to use. Widgets and graphics operations that use this font will convert UNICODE strings to the platform character set of the specified locale. </p> <p> On platforms where there are multiple character sets for a given language/country locale, the variant portion of the locale will determine the character set. </p>

setName
void setName(String name)

Sets the name of the receiver. <p> Some platforms support font foundries. On these platforms, the name of the font specified in setName() may have one of the following forms: <ol> <li>a face name (for example, "courier")</li> <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li> </ol> In either case, the name returned from getName() will include the foundry. </p> <p> On platforms that do not support font foundries, only the face name (for example, "courier") is used in <code>setName()</code> and <code>getName()</code>. </p>

setStyle
void setStyle(int style)

Sets the style of the receiver to the argument which must be a bitwise OR of one or more of the <code>SWT</code> constants NORMAL, BOLD and ITALIC. All other style bits are ignored.

toHash
hash_t toHash()

Returns an integer hash code for the receiver. Any two objects that return <code>true</code> when passed to <code>equals</code> must return the same value for this method.

toString
String toString()

Returns a string representation of the receiver which is suitable for constructing an equivalent instance using the <code>FontData(String)</code> constructor.

Variables

country
String country;

The locales of the font

height
float height;

The height of the font data in points (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. 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 accessed from application code. </p>

lang
String lang;

The locales of the font

name
String name;

the font name (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. 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 accessed from application code. </p>

str
String str;

the Pango string (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. 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 accessed from application code. </p>

style
int style;

the font style (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. 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 accessed from application code. </p>

variant
String variant;

The locales of the font

Meta