Fields Summary |
---|
public static final Typeface | DEFAULTThe default NORMAL typeface object |
public static final Typeface | DEFAULT_BOLDThe default BOLD typeface object. Note: this may be not actually be
bold, depending on what fonts are installed. Call getStyle() to know
for sure. |
public static final Typeface | SANS_SERIFThe NORMAL style of the default sans serif typeface. |
public static final Typeface | SERIFThe NORMAL style of the default serif typeface. |
public static final Typeface | MONOSPACEThe NORMAL style of the default monospace typeface. |
private static Typeface[] | sDefaults |
int | native_instance |
public static final int | NORMAL |
public static final int | BOLD |
public static final int | ITALIC |
public static final int | BOLD_ITALIC |
Methods Summary |
---|
public static android.graphics.Typeface | create(java.lang.String familyName, int style)Create a typeface object given a family name, and option style information.
If null is passed for the name, then the "default" font will be chosen.
The resulting typeface object can be queried (getStyle()) to discover what
its "real" style characteristics are.
return new Typeface(nativeCreate(familyName, style));
|
public static android.graphics.Typeface | create(android.graphics.Typeface family, int style)Create a typeface object that best matches the specified existing
typeface and the specified Style. Use this call if you want to pick a new
style from the same family of an existing typeface object. If family is
null, this selects from the default font's family.
int ni = 0;
if (family != null) {
ni = family.native_instance;
}
return new Typeface(nativeCreateFromTypeface(ni, style));
|
public static android.graphics.Typeface | createFromAsset(android.content.res.AssetManager mgr, java.lang.String path)Create a new typeface from the specified font data.
return new Typeface(nativeCreateFromAsset(mgr, path));
|
public static android.graphics.Typeface | defaultFromStyle(int style)Returns one of the default typeface objects, based on the specified style
return sDefaults[style];
|
protected void | finalize()
DEFAULT = create((String)null, 0);
DEFAULT_BOLD = create((String)null, Typeface.BOLD);
SANS_SERIF = create("sans-serif", 0);
SERIF = create("serif", 0);
MONOSPACE = create("monospace", 0);
sDefaults = new Typeface[] {
DEFAULT,
DEFAULT_BOLD,
create((String)null, Typeface.ITALIC),
create((String)null, Typeface.BOLD_ITALIC),
};
nativeUnref(native_instance);
|
public int | getStyle()Returns the typeface's intrinsic style attributes
return nativeGetStyle(native_instance);
|
public final boolean | isBold()Returns true if getStyle() has the BOLD bit set.
return (getStyle() & BOLD) != 0;
|
public final boolean | isItalic()Returns true if getStyle() has the ITALIC bit set.
return (getStyle() & ITALIC) != 0;
|
private static native int | nativeCreate(java.lang.String familyName, int style)
|
private static native int | nativeCreateFromAsset(android.content.res.AssetManager mgr, java.lang.String path)
|
private static native int | nativeCreateFromTypeface(int native_instance, int style)
|
private static native int | nativeGetStyle(int native_instance)
|
private static native void | nativeUnref(int native_instance)
|