public class Typeface extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BOLD |
static int |
BOLD_ITALIC |
static Typeface |
DEFAULT
The default NORMAL typeface object
|
static Typeface |
DEFAULT_BOLD
The default BOLD typeface object.
|
static int |
ITALIC |
static Typeface |
MONOSPACE
The NORMAL style of the default monospace typeface.
|
long |
native_instance |
static int |
NORMAL |
static Typeface |
SANS_SERIF
The NORMAL style of the default sans serif typeface.
|
static Typeface |
SERIF
The NORMAL style of the default serif typeface.
|
Modifier and Type | Method and Description |
---|---|
static Typeface |
create(String familyName,
int style)
Create a typeface object given a family name, and option style information.
|
static Typeface |
create(Typeface family,
int style)
Create a typeface object that best matches the specified existing
typeface and the specified Style.
|
static Typeface |
createFromAsset(AssetManager mgr,
String path)
Create a new typeface from the specified font data.
|
static Typeface |
createFromFamilies(FontFamily[] families)
Create a new typeface from an array of font families.
|
static Typeface |
createFromFamiliesWithDefault(FontFamily[] families)
Create a new typeface from an array of font families, including
also the font families in the fallback list.
|
static Typeface |
createFromFile(File path)
Create a new typeface from the specified font file.
|
static Typeface |
createFromFile(String path)
Create a new typeface from the specified font file.
|
static Typeface |
defaultFromStyle(int style)
Returns one of the default typeface objects, based on the specified style
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
int |
getStyle()
Returns the typeface's intrinsic style attributes
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isBold()
Returns true if getStyle() has the BOLD bit set.
|
boolean |
isItalic()
Returns true if getStyle() has the ITALIC bit set.
|
public static final Typeface DEFAULT
public static final Typeface DEFAULT_BOLD
public static final Typeface SANS_SERIF
public static final Typeface SERIF
public static final Typeface MONOSPACE
public long native_instance
public static final int NORMAL
public static final int BOLD
public static final int ITALIC
public static final int BOLD_ITALIC
public int getStyle()
public final boolean isBold()
public final boolean isItalic()
public static Typeface create(String familyName, int style)
familyName
- May be null. The name of the font family.style
- The style (normal, bold, italic) of the typeface.
e.g. NORMAL, BOLD, ITALIC, BOLD_ITALICpublic static Typeface create(Typeface family, int style)
family
- May be null. The name of the existing type face.style
- The style (normal, bold, italic) of the typeface.
e.g. NORMAL, BOLD, ITALIC, BOLD_ITALICpublic static Typeface defaultFromStyle(int style)
public static Typeface createFromAsset(AssetManager mgr, String path)
mgr
- The application's asset managerpath
- The file name of the font data in the assets directorypublic static Typeface createFromFile(File path)
path
- The path to the font data.public static Typeface createFromFile(String path)
path
- The full path to the font data.public static Typeface createFromFamilies(FontFamily[] families)
families
- array of font familiespublic static Typeface createFromFamiliesWithDefault(FontFamily[] families)
families
- array of font familiesprotected void finalize() throws Throwable
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 JavaTM 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.
public boolean equals(Object o)
Object
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
equals
in class Object
o
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public int hashCode()
Object
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)