For platform-independent behaviour, use the get and set methods corresponding to the following properties:
FontData
corresponds to a Windows LOGFONT structure whose fields
may be retrieved and modified.FontData correspond
to the entries in the font's XLFD name and may be retrieved and modified.
dispose() method is provided.
Font, Sample code and further information
| Modifier and Type | Field and Description |
|---|---|
| pack-priv String | country
The locales of the font |
| public float | height
The height of the font data in points (Warning: This field is platform dependent) Important Note This field is not part of the SWT public API. |
| pack-priv String | lang
The locales of the font |
| public String | name
the font name (Warning: This field is platform dependent) Important Note This field is not part of the SWT public API. |
| public byte[] | string
the Pango string (Warning: This field is platform dependent) Important Note This field is not part of the SWT public API. |
| public int | style
the font style (Warning: This field is platform dependent) Important Note This field is not part of the SWT public API. |
| pack-priv String | variant
The locales of the font |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the object is the same as this object and false otherwisethe object to compare with this object object)Overrides java. |
| public int | |
| pack-priv float | |
| public String | |
| public String | |
| public int | Returns: the style of thisFontDataReturns the style of the receiver which is a bitwise OR of
one or more of the |
| public int | Returns: the receiver's hashOverrides java. |
| public void | |
| pack-priv void | |
| public void | |
| public void | |
| public void | setStyle(int
the new style for this style)FontDataSets the style of the receiver to the argument which must
be a bitwise OR of one or more of the |
| public String | Returns: a string representation of the FontDataOverrides java. FontData(String) constructor.
|
| country | back to summary |
|---|---|
| pack-priv String country The locales of the font | |
| height | back to summary |
|---|---|
| public float height The height of the font data in points (Warning: This field is platform dependent) Important Note This field is not 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. | |
| lang | back to summary |
|---|---|
| pack-priv String lang The locales of the font | |
| name | back to summary |
|---|---|
| public String name the font name (Warning: This field is platform dependent) Important Note This field is not 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. | |
| string | back to summary |
|---|---|
| public byte[] string the Pango string (Warning: This field is platform dependent) Important Note This field is not 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. | |
| style | back to summary |
|---|---|
| public int style the font style (Warning: This field is platform dependent) Important Note This field is not 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. | |
| variant | back to summary |
|---|---|
| pack-priv String variant The locales of the font | |
| FontData | back to summary |
|---|---|
| public FontData() Constructs a new uninitialized font data. | |
| FontData | back to summary |
|---|---|
| public FontData(String string) Constructs a new FontData given a string representation
in the form generated by the Note that the representation varies between platforms, and a FontData can only be created from a string that was generated on the same platform.
| |
| FontData | back to summary |
|---|---|
| public FontData(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.
| |
| FontData | back to summary |
|---|---|
| pack-priv FontData(String name, float height, int style) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. | |
| getHeight | back to summary |
|---|---|
| public int getHeight() Returns the height of the receiver in points.
| |
| getHeightF | back to summary |
|---|---|
| pack-priv float getHeightF() | |
| getLocale | back to summary |
|---|---|
| public String getLocale() Returns the locale of the receiver. 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. 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.
| |
| getName | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public int getStyle() Returns the style of the receiver which is a bitwise OR of
one or more of the
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns an integer hash code for the receiver. Any two
objects that return | |
| setHeight | back to summary |
|---|---|
| public 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.
| |
| setHeight | back to summary |
|---|---|
| pack-priv void setHeight(float height) | |
| setLocale | back to summary |
|---|---|
| public void setLocale(String locale) Sets the locale of the receiver. 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. 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.
| |
| setName | back to summary |
|---|---|
| public void setName(String name) Sets the name of the receiver. Some platforms support font foundries. On these platforms, the name of the font specified in setName() may have one of the following forms:
In either case, the name returned from getName() will include the foundry.
On platforms that do not support font foundries, only the face name
(for example, "courier") is used in
| |
| setStyle | back to summary |
|---|---|
| public 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
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string representation of the receiver which is suitable
for constructing an equivalent instance using the
| |