public final class GraphicsFont extends Object implements IDisposable
TextBatchPrimitive
.
For best performance, avoid creating duplicate font objects.
Instead assign the same font object to several text batch primitives.TextBatchPrimitive
Constructor and Description |
---|
GraphicsFont(Font font)
Initializes a graphics font using a
Font object. |
GraphicsFont(Font font,
boolean outline)
Initializes a graphics font using a
Font object. |
GraphicsFont(String name,
int size)
Initializes a graphics font with the typeface
name and size . |
GraphicsFont(String name,
int size,
FontStyle fontStyle,
boolean outline)
Initializes a graphics font with the given arguments.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting
unmanaged resources.
|
protected void |
dispose(boolean disposing) |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
boolean |
getAntialias()
Gets a value that indicates whether this font is antialiased.
|
boolean |
getBold()
Gets a value that indicates whether this font is bold.
|
boolean |
getItalic()
Gets a value that indicates whether this font is italic.
|
String |
getName()
Gets the typeface name of the font.
|
boolean |
getOutline()
Gets a value that indicates whether this font has an outline around its characters.
|
int |
getSize()
Gets the size of the font.
|
boolean |
getStrikeout()
Gets a value that indicates whether this font has a horizontal line through its characters.
|
FontStyle |
getStyle()
Gets the
FontStyle enumeration that contains the style for this font. |
boolean |
getUnderline()
Gets a value that indicates whether this font is underlined.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public GraphicsFont(String name, int size, FontStyle fontStyle, boolean outline)
For best performance, avoid creating duplicate font objects. Instead assign the same font object to several text batch primitives.
name
- The typeface name of the font.size
- The size of the font.fontStyle
- The style of the font. FontStyle
enumeration
values can be logically or
ed together to apply more than one style.outline
- true
if the font should be created with an outline around its characters;
otherwise, false
.ArgumentException
- The font could not be created. In most cases, a font with a typeface
name equal to name
could not be found on the system.Outline
public GraphicsFont(String name, int size)
name
and size
.
This is the same as initializing a graphics font using
GraphicsFont.GraphicsFont(java.lang.String,int,agi.foundation.compatibility.FontStyle,boolean)
with a regular font style and no outline.
name
- The typeface name of the font.size
- The size of the font.GraphicsFont.GraphicsFont(java.lang.String,int,agi.foundation.compatibility.FontStyle,boolean)
public GraphicsFont(Font font)
Font
object.
This is the same as initializing a graphics font using
GraphicsFont.GraphicsFont(java.awt.Font,boolean)
with no outline.
font
- The Font
object specifying the font's typeface name,
size, and style.ArgumentNullException
- font
is null
.GraphicsFont.GraphicsFont(java.awt.Font,boolean)
public GraphicsFont(Font font, boolean outline)
Font
object.font
- The Font
object specifying the font's typeface name,
size, and style.outline
- true
if the font should be created with an outline around its characters;
otherwise, false
.ArgumentNullException
- font
is null
.GraphicsFont.GraphicsFont(java.lang.String,int,agi.foundation.compatibility.FontStyle,boolean)
,
Outline
protected void finalize() throws Throwable
java.lang.Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the Java™ virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize
in class Object
Throwable
- the Exception
raised by this methodWeakReference
,
PhantomReference
public final void dispose()
IDisposable
dispose
in interface IDisposable
protected void dispose(boolean disposing)
public String getName()
public int getSize()
public boolean getBold()
public boolean getItalic()
public boolean getUnderline()
public boolean getStrikeout()
public boolean getOutline()
A font with an outline around its characters generally stands out against the
background better than the same font without an outline. When a font is applied to a
TextBatchPrimitive
, the character color
and the outline color can be different. Use
TextBatchPrimitive.OutlineColor
(get
)
to set the outline color.
true
if this font has an outline around its characters; otherwise, false
.TextBatchPrimitive.OutlineColor (get)
public boolean getAntialias()
true
if this font is antialiased; otherwise, false
.